Apollo MCP Demo
Apollo MCP 演示
此文件夹设置了 Apollo 为 MCP 展示的核心架构:
一个普通的 GraphQL API,
一个位于其前端的 Apollo MCP 服务器,
一个作为 MCP 工具的 GraphQL 操作白名单。
此版本使用独立的 Apollo MCP 服务器容器,而不是 rover init --mcp 向导,因为它在没有 GraphOS 凭据的情况下在本地运行更简单。
启动内容
api: 一个运行在http://localhost:4001/上的小型 Apollo 服务器mcp: 运行在http://localhost:8000/mcp上的 Apollo MCP 服务器
Related MCP server: mcp4gql
架构图
flowchart LR
subgraph LocalMachine["Local machine"]
Client["MCP client\nInspector / Codex / Cursor"]
subgraph Docker["docker compose"]
MCP["Apollo MCP Server\n:8000/mcp"]
API["Apollo GraphQL API\n:4001"]
end
Ops["graphql/operations/*.graphql\nApproved operations"]
Schema["graphql/api.graphql\nSchema snapshot"]
end
Client -->|"MCP over Streamable HTTP"| MCP
Ops -->|"tool definitions"| MCP
Schema -->|"schema metadata"| MCP
MCP -->|"GraphQL queries/mutations"| API
API -->|"GraphQL JSON response"| MCP
MCP -->|"MCP tool results"| Client运行它
cd C:\Users\muham\Documents\apollo-mcp
npm install
docker compose up --build在第二个终端中,检查 MCP 服务器:
npx @modelcontextprotocol/inspector然后打开它打印的 Inspector URL,选择:
传输类型:
Streamable HTTPURL:
http://127.0.0.1:8000/mcp
点击 Connect,然后点击 List Tools。
你应该能看到源自以下内容的 MCP 工具:
GetBooksGetBookByIdGetBooksByGenre
可选客户端配置
对于使用 mcp-remote 的 MCP 客户端,本地配置格式为:
{
"mcpServers": {
"apollo-demo": {
"command": "npx",
"args": [
"mcp-remote",
"http://127.0.0.1:8000/mcp"
]
}
}
}实际发生的情况
GraphQL API 仍然是真正的数据服务。它了解模式、解析字段并为 GraphQL 查询返回 JSON。
Apollo MCP 服务器不会取代该 API。它位于其前端,并将已批准的 GraphQL 操作转换为 AI 客户端可以发现和调用的 MCP 工具。
重要的文件包括:
mcp-config.yaml:告诉 Apollo MCP 服务器 GraphQL 端点在哪里、模式文件在哪里、允许的操作在哪里,以及如何通过 HTTP 公开 MCP。
graphql/api.graphql:Apollo MCP 服务器使用的模式快照,以便它可以正确描述工具。
graphql/operations/GetBooks.graphql:一个成为 MCP 工具的已批准查询。
src/server.mjs:实际的 GraphQL API 实现。
docker-compose.yml:在同一个本地网络上同时运行这两个服务。
请求流程如下:
你的 MCP 客户端连接到
http://localhost:8000/mcp。Apollo MCP 服务器根据
.graphql操作文件发布工具。客户端使用参数调用其中一个工具。
Apollo MCP 服务器将该工具调用转换回底层的 GraphQL 操作。
Apollo MCP 服务器将该 GraphQL 请求发送到
http://api:4001/。GraphQL API 执行查询并返回数据。
Apollo MCP 服务器以 MCP 格式将结果返回给 MCP 客户端。
请求流程图
sequenceDiagram
autonumber
participant C as MCP Client
participant M as Apollo MCP Server
participant O as Operation Files
participant G as GraphQL API
C->>M: Connect to http://localhost:8000/mcp
M->>O: Load approved .graphql operations
O-->>M: GetBooks / GetBookById / GetBooksByGenre
M-->>C: Advertise MCP tools
C->>M: Invoke tool with arguments
M->>M: Convert tool call to GraphQL operation
M->>G: Send GraphQL request to http://api:4001/
G-->>M: Return GraphQL JSON data
M-->>C: Return MCP-formatted tool result为什么这里没有路由器
Apollo Router 在以下情况下很有用:
你正在提供联合超图 (federated supergraph),
你想要 Apollo 的 GraphOS 管理的运行时,
或者你希望将 GraphQL 和 MCP 捆绑在 Apollo Runtime 中。
对于只有一个现有 GraphQL API 的简单本地演示,Apollo 自己的部署文档支持直接针对该端点使用独立的 Apollo MCP 服务器容器。这就是本项目所使用的方案。
来源
Apollo MCP 服务器快速入门:https://www.apollographql.com/docs/apollo-mcp-server/quickstart
Apollo MCP 服务器配置参考:https://www.apollographql.com/docs/apollo-mcp-server/command-reference
Apollo MCP 服务器部署文档:https://www.apollographql.com/docs/apollo-mcp-server/deploy
Apollo MCP 服务器调试文档:https://www.apollographql.com/docs/apollo-mcp-server/debugging
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA MCP server that exposes GraphQL schema information to LLMs like Claude. This server allows an LLM to explore and understand large GraphQL schemas through a set of specialized tools, without needing to load the whole schema into the context7047MIT
- AlicenseAqualityDmaintenanceGraphQL MCP Server that acts as a bridge allowing MCP clients (like Cursor or Claude Desktop) to interact with target GraphQL APIs through standard tools for schema introspection and operation execution.2153MIT
- AlicenseAqualityAmaintenanceA generic MCP (Model Context Protocol) server that bridges any GraphQL API to Claude Code. It introspects your GraphQL schema and exposes each query and mutation as an individual tool, letting Claude interact with your API directly.2521MIT
- AlicenseNot gradedqualityDmaintenanceA generic MCP server that converts .graphql query files into tools for Claude, enabling interaction with any GraphQL API without coding.MIT
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for AI access to Swagger by SmartBear.
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/mabdullah679/apollo-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server