| name | add-mcp-server |
| description | Use when creating a new MCP tool server or adding tools to an existing one |
Add MCP Server
Guide for creating or extending MCP tool servers in this project.
Rules
- MCP servers are standalone stdio processes in
src/mcp-servers/.
- Never import from application internals.
- Each server loads its own dotenv config.
- All tool params use Zod schemas.
- Return format:
{ content: [{ type: "text", text: "..." }] }.
- Google services use token caching with an
expiresAt check.
Creating A New MCP Server
- Create
src/mcp-servers/{name}.ts.
- Register the server in
src/agents/orchestrator.ts.
- Add exposed tools to
allowedTools.
- Add stage-tracked tools to
TOOL_TO_STEP.
- Update the orchestrator system prompt only when tool behavior or routing changes.
- Add new env vars to
.env.example.
- Check Google OAuth scopes when using Google APIs.
- Add tests for pure helpers and tool behavior.
- Update
.ai/mcp-tools.md.
- Update
.ai/evals/tool-routing.md if routing expectations changed.
Server Template
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { config } from "dotenv";
config();
const server = new McpServer({ name: "{name}", version: "1.0.0" });
server.tool(
"tool_name",
"What this tool does in one sentence.",
{
param: z.string().describe("What this param is"),
},
async ({ param }) => {
return { content: [{ type: "text" as const, text: `Result: ${param}` }] };
},
);
server.connect(new StdioServerTransport());
Adding Tools To An Existing Server
Follow the same registration, docs, eval, and verification steps. Modify the existing server file instead of creating a new one.
Checklist
Verify
npm run typecheck
npm test
npm run check:mcp-isolation
npm run check:ai-docs