Apollo MCP Demo
Apollo MCP デモ
このフォルダーは、Apollo が MCP 用にデモンストレーションしているコアアーキテクチャを構築します。
通常の GraphQL API
その手前に配置された Apollo MCP サーバー
MCP ツールとなる GraphQL 操作の小さな許可リスト
このバージョンでは、GraphOS の認証情報なしでローカルで簡単に実行できるように、rover init --mcp ウィザードの代わりにスタンドアロンの Apollo MCP サーバーコンテナを使用しています。
開始されるもの
api:http://localhost:4001/で動作する小さな Apollo Servermcp: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次に、表示されたインスペクターの URL を開き、以下を選択します:
Transport Type:
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: GraphQL エンドポイントの場所、スキーマファイルの場所、許可された操作の場所、および MCP を HTTP 経由で公開する方法を Apollo MCP サーバーに伝えます。
graphql/api.graphql: Apollo MCP サーバーがツールを正しく記述できるように使用されるスキーマのスナップショットです。
graphql/operations/GetBooks.graphql: 1 つの MCP ツールとなる承認済みのクエリです。
src/server.mjs: 実際の GraphQL API 実装です。
docker-compose.yml: 両方のサービスを 1 つのローカルネットワーク上で同時に実行します。
リクエストの流れは以下の通りです:
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 は以下の場合に役立ちます:
フェデレーションされたスーパーグラフを提供している場合
Apollo の GraphOS 管理ランタイムを使用したい場合
または、GraphQL と MCP を Apollo Runtime にバンドルしたい場合
既存の GraphQL API が 1 つあるシンプルなローカルデモの場合、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 deployed
Maintenance
Related MCP Connectors
The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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 context83 npm46MIT
- 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.213 npm3MIT
- 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.230 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA generic MCP server that converts .graphql query files into tools for Claude, enabling interaction with any GraphQL API without coding.MIT