Install Page Systems in a Mastra agent
Connect Mastra's MCPClient to the Page Systems MCP server and give its tools to your agent.
Tested with @mastra/core 1.76.0, @mastra/mcp 2.3.0 and @mastra/memory 1.37.0.
1. Set your API key
Create a key in the dashboard (it starts with ap_live_ and is shown once) and set it where your agent runs. Never commit it.
export PAGE_SYSTEMS_API_KEY=ap_live_...2. Install
npm install @mastra/mcp3. Add the tools to your agent
import { Agent } from '@mastra/core/agent';
import { MCPClient } from '@mastra/mcp';
export const pageSystems = new MCPClient({
servers: {
'page-systems': {
url: new URL('https://pagesystems.ai/mcp'),
requestInit: { headers: { Authorization: `Bearer ${process.env.PAGE_SYSTEMS_API_KEY}` } },
},
},
});
const skill = await fetch('https://pagesystems.ai/v1/skill').then((r) => r.text()); // once, at startup
export const assistant = new Agent({
id: 'assistant',
name: 'Assistant',
instructions: [yourInstructions, skill].join('\n\n'),
model,
tools: await pageSystems.listTools(),
memory, // see step 4
});4. Keep the conversation
The answer arrives in a later turn, so give the agent memory and call it with the same thread and resource each turn:
const result = await assistant.generate(userMessage, { memory: { resource: userId, thread: conversationId }, maxSteps: 6 });With the earlier turns in memory, the model calls get_page_result with the page id it already has. maxSteps leaves room for listing page types, reading a schema and creating the page in one turn.
5. Check it works
Ask your agent something a page answers better than chat, for example "Ask Sam which of 9:00, 11:00 or 14:00 next Tuesday works for a call." It should send a link. Open it, pick a time, submit, then ask the agent what Sam picked: it reads the answer with get_page_result.