Skip to main content
Glama
mabdullah679

Apollo MCP Demo

by mabdullah679

Apollo MCP 演示

此文件夹设置了 Apollo 为 MCP 展示的核心架构:

  1. 一个普通的 GraphQL API,

  2. 一个位于其前端的 Apollo MCP 服务器,

  3. 一个作为 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 HTTP

  • URL:http://127.0.0.1:8000/mcp

点击 Connect,然后点击 List Tools

你应该能看到源自以下内容的 MCP 工具:

  • GetBooks

  • GetBookById

  • GetBooksByGenre

可选客户端配置

对于使用 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 工具。

重要的文件包括:

请求流程如下:

  1. 你的 MCP 客户端连接到 http://localhost:8000/mcp

  2. Apollo MCP 服务器根据 .graphql 操作文件发布工具。

  3. 客户端使用参数调用其中一个工具。

  4. Apollo MCP 服务器将该工具调用转换回底层的 GraphQL 操作。

  5. Apollo MCP 服务器将该 GraphQL 请求发送到 http://api:4001/

  6. GraphQL API 执行查询并返回数据。

  7. 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 服务器容器。这就是本项目所使用的方案。

来源

F
license - not found
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    F
    maintenance
    A 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 context
    70
    47
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    GraphQL 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.
    2
    15
    3
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    A 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.
    2
    52
    1
    MIT

View all related MCP servers

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.

View all MCP Connectors

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/mabdullah679/apollo-mcp'

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