Skip to main content
Glama

ThinMCP

ThinMCP 是一个 MCP 网关,它通过一个稳定的双工具接口公开许多上游 MCP 服务器:

  • search()

  • execute()

ThinMCP 不会将每个上游工具定义加载到模型上下文中,而是维护一个本地目录,让模型按需发现工具,并仅转发它需要进行的调用。

为什么选择 ThinMCP

将多个 MCP 服务器直接连接到模型会随着工具数量的增加而增加上下文大小。ThinMCP 在保持模型面向的表面积固定的同时,仍然允许访问庞大的工具生态系统。

其结果是为客户端提供了更简单的集成点,并为生产部署提供了更可预测的运行时形态。

架构

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 start

HTTP 模式:

npm start -- --transport http --port 8787

验证设置:

npm run doctor

配置

ThinMCP 读取 config/mcp-sources.yaml。每个上游服务器都可以使用 httpstdio 传输。

最小示例:

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 start

HTTP 模式:

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

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VenkatGGG/ThinMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server