# 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.

- Skill: `artsmc-claude-dev-agents/mastra-mcp-tools` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add artsmc-claude-dev-agents/mastra-mcp-tools`
- Raw SKILL.md: https://api.skillmd.com/api/skills/artsmc-claude-dev-agents/mastra-mcp-tools/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: artsmc (https://skillmd.com/u/artsmc-claude-dev-agents)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/artsmc-claude-dev-agents/mastra-mcp-tools

---


# 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

```bash
/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

