Mastra MCP Tools

Mastra MCP integration guide - MCPClient for consuming tools, MCPServer for exposing agents/workflows, tool creation, and publishing. Covers createTool() with Zod input/output schemas and execute context, MCPClient getTools()/listToolsets(), MCPServer transports (startStdio/startSSE/startHTTP), and reusing external MCP servers instead of rebuilding tools.

artsmc Updated

File contents

Mastra MCP (Model Context Protocol) Integration

Comprehensive guide for MCP integration with Mastra. Covers MCPClient for consuming external MCP servers (stdio/HTTP), MCPServer for exposing Mastra agents and workflows as MCP tools, custom tool creation with createTool(), and publishing MCP servers.

Usage

/mastra-mcp-tools

Provides context for:

  • MCPClient with listTools() and listToolsets()
  • MCPServer constructor: { name, version, tools, agents }
  • Server methods: startStdio(), startSSE(), startHTTP()
  • createTool() with execute: async ({ context }) => {}
  • Agents become ask_<key> tools, workflows become run_<key> tools
  • Tool annotations (readOnlyHint, destructiveHint)
  • Publishing via npm, Docker, or HTTP

artsmc/claude-dev-agents/tree/main/skills/mastra-mcp-tools commit a27b31fb47

Frequently asked questions

npx skillmds@latest add artsmc-claude-dev-agents/mastra-mcp-tools