Cover image
Try Now
2025-02-07

Serve tRPC routes as an MCP server

3 years

Works with Finder

1

Github Watches

2

Github Forks

11

Github Stars

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);

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • Gil kaminski
  • Make sure you are post-ready before you post on social media

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • momi
  • Provides initial medical assessments and advice.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • WILLIAM JOEL FOTEPING
  • Friendly music guide for 60s-2000s songs, with links to listen online.

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

  • zhaoyunxing92
  • 本项目是一个钉钉MCP(Message Connector Protocol)服务,提供了与钉钉企业应用交互的API接口。项目基于Go语言开发,支持员工信息查询和消息发送等功能。

  • justmywyw
  • Short and sweet example MCP server / client implementation for Tools, Resources and Prompts.

  • sligter
  • Lite-MCP-Client是一个基于命令行的轻量级MCP客户端工具

    Reviews

    3 (1)
    Avatar
    user_MoKCyTVO
    2025-04-17

    As a dedicated user of trpc-mcp, I must say this tool is exceptional. Created by Jacse, this GitHub-hosted project offers a seamless and efficient way to develop and manage RPC endpoints. Its integration and ease of use have significantly enhanced my workflow. Highly recommended for any developer looking for a reliable RPC solution!