You can connect your Mastra agent to Observee’s secure, enterprise-ready MCP servers to access all your Observee-managed tools, agents, and workflows.First, configure the MCPClient to point to your Observee MCP endpoint. You can find your {customer_id} and generate an API key in the Observee dashboard.
Copy
Ask AI
import { MCPClient } from "@mastra/mcp";const mcpClient = new MCPClient({ servers: { observee: { url: new URL("https://mcp.observee.ai/customer/{customer_id}"), // Replace with your customer ID requestInit: { headers: { Authorization: "Bearer <your-observee-api-key>", // Replace with your API key }, }, }, },});
For simple scripts or single-user applications, fetch all tools once and initialize the agent with them.
Copy
Ask AI
import { Agent } from "@mastra/core/agent";// Fetch all available tools from Observeeconst tools = await mcpClient.getTools();// Create your agent with the static toolsetconst agent = new Agent({ tools, // ...other agent config});// Use the agent to handle user promptsconst response = await agent.generate("Summarize the latest sales data");console.log(response);