GraphQL Schema Embedder MCP Server
Indexes GraphQL schemas using embeddings to enable semantic search of types and fields for fast lookup. It allows LLMs to discover relevant schema signatures and execute queries against live GraphQL endpoints.
README
GraphQL schema embedder MCP server
Python MCP server for LLMs that indexes a GraphQL schema, stores embeddings per type->field via an embeddings endpoint, and enables fast lookup plus run_query execution once relevant types are identified to fetch data from your GraphQL endpoint.
Architecture
- GraphQL schema: provide a schema file (SDL) to exercise parsing and indexing.
- Indexer:
schema_indexer.pyflattens the schema intotype.fieldsignatures (with arguments and return types), embeds each summary via the configured embeddings endpoint, and persists todata/metadata.json+data/vectors.npz(normalized embeddings for cosine search). - Server:
server.pyexposes MCP toolslist_typesandrun_query. The server ensures the schema index exists on startup; it only calls the embeddings endpoint when reindexing or embedding a new query. - Persistence:
data/is.gitignore'd so you can regenerate locally without polluting the repo.
Setup
Set env vars. You can start from .env.example.
Environment configuration:
GRAPHQL_EMBED_API_KEY(orOPENAI_API_KEY)GRAPHQL_EMBEDDINGS_URL(full embeddings URL)GRAPHQL_EMBED_MODELGRAPHQL_EMBED_API_KEY_HEADER/GRAPHQL_EMBED_API_KEY_PREFIXGRAPHQL_EMBED_HEADERS(JSON object string for extra headers) Endpoint auth (when usingGRAPHQL_ENDPOINT_URL):GRAPHQL_ENDPOINT_HEADERS(JSON object string, merged with any--headerflags)
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 src/server.py
Run the MCP server
python3 src/server.py # SSE on 127.0.0.1:8000/sse by default
python3 src/server.py --transport sse # explicit SSE
python3 src/server.py --transport streamable-http # Streamable HTTP on 127.0.0.1:8000/mcp
# Or: point at a live GraphQL endpoint (requires introspection enabled)
python3 src/server.py --endpoint https://api.example.com/graphql
# Endpoint auth headers (repeat --header)
python3 src/src/server.py --endpoint https://api.example.com/graphql --header "Authorization: Bearer $TOKEN"
# Options: --host 0.0.0.0 --port 9000 --log-level DEBUG --mount-path /myapp
Tools:
list_types(query, limit=5)– fuzzy search overtype.fieldsignatures (embeddings; auto-build index if missing). Results are ordered withQueryfields first and include aquery_templateforQueryfields plus aselection_hintfor object fields.run_query(query)– if--endpointis set, proxies the query to the endpoint; otherwise validates/runs against the local schema (no resolvers; primarily for validation/shape checking, data resolves to null). Both indexing and querying use the same embedding model (text-embedding-3-smallby default, override via config/env or--model).
Example list_types output:
[
{
"type": "Query",
"field": "users",
"summary": "Query.users(limit: Int = 10, offset: Int = 0) -> [User!]!",
"query_template": "query { users(limit: <Int = 10>, offset: <Int = 0>) { id name email profile { joinedAt preferences { newsletter } } orders { id status total } } }"
},
{
"type": "User",
"field": "orders",
"summary": "User.orders -> [Order!]!",
"selection_hint": "orders { id status total items { quantity subtotal } }"
},
{
"type": "Product",
"field": "reviews",
"summary": "Product.reviews -> [Review!]!",
"selection_hint": "reviews { id rating title author { id name } }"
}
]
Notes:
python3 src/server.pydefaults to thessetransport; pass--transport streamable-httpif you want HTTP instead.- You can also set env vars prefixed with
FASTMCP_(e.g.,FASTMCP_HOST,FASTMCP_PORT,FASTMCP_LOG_LEVEL) to override defaults. - The server exposes MCP
instructions(override withMCP_INSTRUCTIONS) that describe the server as an abstraction layer and tell the LLM to uselist_typesthenrun_querywith minimal tool calls.
Quick test with the MCP Inspector
Requires npm/npx on PATH.
Connect to an already-running SSE server
In one terminal (start the server):
python3 src/server.py --transport sse --port 8000
In another terminal (start the Inspector and point it at /sse):
npx @modelcontextprotocol/inspector --transport sse --server-url http://127.0.0.1:8000/sse
Configure in Claude Desktop / CLI
If you're running this server locally over SSE (default), point Claude at the /sse URL.
claude mcp add --transport sse graphql-mcp http://127.0.0.1:8000/sse
You can also configure via JSON (e.g. config file):
{
"mcpServers": {
"graphql-mcp": {
"type": "sse",
"url": "http://127.0.0.1:8000/sse"
}
}
}
If you expose this server behind auth, pass headers:
claude mcp add --transport sse private-graphql http://127.0.0.1:8000/sse \
--header "Authorization: Bearer your-token-here"
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。