- Explore MCP Servers
- trpc-mcp
Trpc Mcp
What is Trpc Mcp
trpc-mcp is a server that allows you to serve tRPC routes as an MCP server, enabling seamless integration between tRPC and the Model Context Protocol (MCP).
Use cases
Use cases for trpc-mcp include building APIs that require both tRPC functionality and MCP compatibility, creating microservices that need to communicate via MCP, and developing applications that leverage OpenAPI specifications for documentation and client generation.
How to use
To use trpc-mcp, first initialize it with tRPC by importing the necessary modules and creating a router. Then, define your procedures with metadata for OpenAPI. Finally, create an MCP server instance and connect it using a transport method, such as StdioServerTransport.
Key features
Key features of trpc-mcp include easy integration with tRPC, support for OpenAPI metadata, and the ability to serve multiple routes through a single MCP server instance.
Where to use
undefined
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Trpc Mcp
trpc-mcp is a server that allows you to serve tRPC routes as an MCP server, enabling seamless integration between tRPC and the Model Context Protocol (MCP).
Use cases
Use cases for trpc-mcp include building APIs that require both tRPC functionality and MCP compatibility, creating microservices that need to communicate via MCP, and developing applications that leverage OpenAPI specifications for documentation and client generation.
How to use
To use trpc-mcp, first initialize it with tRPC by importing the necessary modules and creating a router. Then, define your procedures with metadata for OpenAPI. Finally, create an MCP server instance and connect it using a transport method, such as StdioServerTransport.
Key features
Key features of trpc-mcp include easy integration with tRPC, support for OpenAPI metadata, and the ability to serve multiple routes through a single MCP server instance.
Where to use
undefined
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
tRPC <-> MCP
Serve tRPC routes via MCP.
Usage
2. Add to meta
import { initTRPC } from '@trpc/server';
import { type McpMeta } from 'trpc-to-openapi';
const t = initTRPC.meta<McpMeta>().create();
3. Enable for routes
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
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);
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










