trackmcp
Back to directory

Serve tRPC routes as an MCP server

33 stars TypeScriptServers & Infrastructure Updated Oct 30, 2025

Documentation

tRPC MCP

Serve tRPC routes via MCP.

Usage

2. Add to meta

ts
import { initTRPC } from '@trpc/server';
import { type McpMeta } from 'trpc-to-openapi';

const t = initTRPC.meta().create();

3. Enable for routes

ts
export const appRouter = t.router({
  sayHello: t.procedure
    .meta({ openapi: { enabled: true, description: 'Greet the user' } })
    .input(z.object({ name: z.string() }))
    .output(z.object({ greeting: z.string() }))
    .query(({ input }) => {
      return { greeting: `Hello ${input.name}!` };
    });
});

4. Serve

ts
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { createMcpServer } from 'trpc-mcp';

const mcpServer = createMcpServer(
  { name: 'trpc-mcp-example', version: '0.0.1' },
  appRouter,
);

const transport = new StdioServerTransport();
await mcpServer.connect(transport);

Frequently asked questions

What is trpc-mcp?

trpc-mcp is Serve tRPC routes as an MCP server

How do I install trpc-mcp?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is trpc-mcp open source?

Yes — it is hosted on GitHub at https://github.com/Jacse/trpc-mcp and has 33 stars.

Related MCP tools

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP