ThinMCP
ThinMCP
ThinMCP 是一个 MCP 网关,它通过一个稳定的双工具接口公开许多上游 MCP 服务器:
search()execute()
ThinMCP 不会将每个上游工具定义加载到模型上下文中,而是维护一个本地目录,让模型按需发现工具,并仅转发它需要进行的调用。
为什么选择 ThinMCP
将多个 MCP 服务器直接连接到模型会随着工具数量的增加而增加上下文大小。ThinMCP 在保持模型面向的表面积固定的同时,仍然允许访问庞大的工具生态系统。
其结果是为客户端提供了更简单的集成点,并为生产部署提供了更可预测的运行时形态。
Related MCP server: MCP Gateway
架构
flowchart LR
A["LLM or MCP Client"] --> B["ThinMCP Gateway"]
B --> C["Local Catalog"]
B --> D["Execution Layer"]
D --> E["Schema Validation"]
E --> F["Upstream MCP Servers"]
G["Sync Process"] --> F
G --> C
G --> H["Snapshots"]关键功能
面向模型的固定双工具接口
支持 HTTP 和 stdio 上游服务器
用于发现的本地 SQLite 支持目录
上游执行前的输入验证
网关工具调用的沙盒执行
带有健康检查和指标端点的 HTTP 传输
上游工具元数据的定期同步
快速入门
npm install
npm run build
cp config/mcp-sources.example.yaml config/mcp-sources.yaml编辑 config/mcp-sources.yaml,然后同步并启动:
npm run sync
npm startHTTP 模式:
npm start -- --transport http --port 8787验证设置:
npm run doctor配置
ThinMCP 读取 config/mcp-sources.yaml。每个上游服务器都可以使用 http 或 stdio 传输。
最小示例:
servers:
- id: exa
name: Exa MCP
transport: http
url: https://mcp.exa.ai/mcp
auth:
type: bearer_env
env: EXA_API_KEY
allowTools: ["*"]
- id: local-fs
name: Local Filesystem MCP
transport: stdio
command: npx
args:
- -y
- "@modelcontextprotocol/server-filesystem"
- /tmp
cwd: .
allowTools:
- "filesystem.*"
sync:
intervalSeconds: 300
onStart: true
runtime:
codeTimeoutMs: 15000
maxCodeLength: 20000
maxResultChars: 60000
catalog:
dbPath: ../data/thinmcp.db
snapshotDir: ../snapshots使用 allowTools 将每个上游服务器限制为您实际希望通过网关公开的工具。
运行 ThinMCP
开发:
npm run dev生产构建:
npm run build
npm startHTTP 模式:
npm start -- --transport http --host 127.0.0.1 --port 8787可用的 HTTP 端点:
/mcp/healthz/metrics
操作
常用命令:
npm run build
npm run sync
npm run doctor
npm test
THINMCP_RUN_E2E=1 npm run test:e2e操作指南:
将上游凭据保存在环境变量中
将
allowTools限制为最小的有用表面积在本地开发之外公开网关时,启用 HTTP 身份验证和速率限制
如果目录新鲜度很重要,请将
npm run sync作为部署或启动验证的一部分运行
客户端集成
客户端示例记录在 docs/CLIENT_INTEGRATIONS.md 中。
许可证
ISC
This server cannot be deployed
Maintenance
Related MCP Connectors
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Find, vet, and run MCP tools through a secure audited gateway with prompt-injection risk scoring
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA universal gateway that aggregates multiple MCP servers into a single interface while providing advanced token optimization, result filtering, and automated summarization. It enables efficient management of large tool catalogs and reduces context usage by up to 95% for major AI clients.13 npm15MIT
- AlicenseNot gradedqualityCmaintenanceAggregates multiple Model Context Protocol servers into a single gateway to provide unified search, description, and execution of tools. It reduces context limit issues by dynamically fetching specific tool schemas only when needed rather than loading all available tools at once.13 npm22MIT
- AlicenseNot gradedqualityBmaintenanceA single MCP endpoint for AI agents to browse, inspect, and call tools from multiple upstream MCP servers without loading all schemas upfront, reducing context overhead.11 npmISC
- AlicenseNot gradedqualityCmaintenanceA unified MCP gateway that reduces context token usage by exposing all services through just two tools (search and execute), supporting built-in services like Asana and Sentry as well as proxied external MCP servers.8 npm1MIT