Skip to main content
Glama
caa1211

GenPDM MCP Server

by caa1211

GenPDM MCP Server

一个 TypeScript/Express MCP 服务器骨架,用于将固定业务 GraphQL API 以安全、类型化的 MCP 工具形式暴露。

功能

  • 位于 ALL /mcp 的 MCP SDK v2 Streamable HTTP 端点

  • HS256 Bearer JWT 验证与作用域检查

  • 基于内存的按 IP 和按主体速率限制

  • 基于有界 Undici keep-alive 连接池的 GraphQL 客户端

  • 仅查询重试、变更幂等性、并发与响应大小限制

  • 可复现的 mock GraphQL 上游

  • 存活/就绪端点与优雅关闭

当前速率限制存储有意采用进程本地实现。src/rate-limit.ts 包含面向未来 Redis 后端存储的适配器边界。运行多个副本时,不要将当前计数器视为全局。

Related MCP server: gqai

文档

仓库自动化:

可运行示例:

本地运行

需要 Node.js 20 或更高版本。

Copy-Item .env.example .env
npm install
npm run dev:mock

在第二个终端中:

npm run dev
$token = npm.cmd run --silent token

使用端点 http://127.0.0.1:3000/mcp 和请求头 Authorization: Bearer <token> 配置 MCP 客户端。

可用工具:

  • get_customer:{ "id": "cust-001" },需要 customers:read 权限

  • create_order:{ "customerId": "cust-001", "items": [{ "sku": "SKU-1", "quantity": 2 }] },需要 orders:write 权限

健康端点无需认证:

  • GET /health/live

  • GET /health/ready

验证

npm run typecheck
npm run build
npm test

生产环境说明

  • 将 HS256 验证替换为公司 IdP 的 JWKS 验证器。

  • 在横向扩展需要严格的全局限制之前,将内存速率限制存储替换为 Redis。

  • 从密钥管理器中注入 JWT 与 GraphQL 凭据。

  • 根据部署拓扑限制 ALLOWED_HOSTS、CORS_ORIGINS 和受信任代理设置。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Turn any GraphQL endpoint into a set of MCP tools
    23
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP that can proxy any GraphQL API and expose graphql operations as mcp tools.
    10 npm
    18
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Automatically generates MCP tools from any GraphQL API by introspecting its schema, supporting queries, mutations, and authentication.
    5
    GPL 3.0