Expose GraphQL APIs as MCP Tools
MCP server that auto-exposes every GraphQL query as its own MCP tool via schema introspection, with configurable auth.
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Seamlessly interact with GraphQL APIs by automatically exposing each query as a distinct MCP tool. This asset dynamically generates tools from your GraphQL schema, simplifying data extraction and integration.
Outcomes
What it gets done
Dynamically generate MCP tools from GraphQL schemas.
Map GraphQL query parameters to tool inputs automatically.
Support customizable authentication methods for secure API access.
Enable predefined queries for controlled data retrieval.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-graphql | bash Capabilities
Tools your agent gets
Execute a GraphQL query against the configured API with dynamically generated parameters.
Overview
GraphQL MCP Server
GraphQL MCP Server automatically turns each query of a target GraphQL API into an MCP tool via schema introspection, with configurable authentication and query-depth limits. Use it to query arbitrary GraphQL APIs without custom wrappers; for production, predefine specific queries rather than relying on unconstrained auto-generation, and note mutations aren't yet supported.
What it does
GraphQL MCP Server automatically exposes each GraphQL query as a separate MCP tool, enabling seamless interaction with any GraphQL API through dynamic schema generation and configurable authentication. It requires no manual schema definition - you simply point it at an API URL and credentials, and the server performs GraphQL introspection to dynamically create tools, with JSON input schemas generated from each query's parameters.
It supports GraphQL queries (with mutation support planned), configurable authentication (Bearer, Basic, custom headers), automatic handling of complex GraphQL types, and a configurable maximum depth for auto-generated queries to avoid overloading the LLM's context window. For production use, specific queries can be predefined via a file or string input (--queries-file or --queries) for tighter control and better performance.
When to use - and when NOT to
Use this connector when you want an AI assistant to query any GraphQL API - a CMS, GitHub's GraphQL API, or an e-commerce product catalog - without hand-writing a wrapper for each query, letting introspection generate the available tools automatically.
Do not rely on fully automatic query generation for production workloads without setting a depth limit or predefining specific queries via --queries-file/--queries - unconstrained introspection-based generation can overload context and hurt performance. It also does not yet support GraphQL mutations.
Inputs and outputs
Each auto-generated tool's inputs mirror the corresponding GraphQL query's parameters, with a JSON schema derived from the query definition. Outputs are the JSON results of executing that GraphQL query against the configured API endpoint.
Capabilities
- Exposes each GraphQL query as an individual MCP tool via automatic schema introspection
- Auto-generates JSON input schemas matching each query's parameters
- Configurable authentication: Bearer tokens, Basic auth, or custom headers
- Automatic handling of complex GraphQL types
- Configurable maximum query-generation depth to control context usage
- Supports predefined queries via a queries file or inline string for production use
How to install
uvx mcp-graphql --api-url="https://api.example.com/graphql" --auth-token="your-token"
Or via pip: pip install mcp-graphql. Configure Claude Desktop:
{
"mcpServers": {
"graphql": {
"command": "uvx",
"args": ["mcp-graphql", "--api-url", "https://api.example.com/graphql"]
}
}
}
Requires Python 3.11+. Set MCP_AUTH_TOKEN for authentication to the target GraphQL API.
Who it's for
Developers who need an AI assistant to query arbitrary GraphQL APIs on the fly without writing per-query integration code.
Source README
An MCP server that automatically exposes each GraphQL query as a separate MCP tool, enabling seamless interaction with GraphQL APIs through dynamic schema generation and customizable authentication.
Installation
uvx (recommended)
uvx mcp-graphql --api-url="https://api.example.com/graphql" --auth-token="your-token"
pip
pip install mcp-graphql
From source
git clone https://github.com/your-username/mcp_graphql.git
cd mcp_graphql
pip install .
Configuration
Claude Desktop (uvx)
"mcpServers": {
"graphql": {
"command": "uvx",
"args": ["mcp-graphql", "--api-url", "https://api.example.com/graphql"]
}
}
Claude Desktop (Docker)
"mcpServers": {
"graphql": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/graphql", "--api-url", "https://api.example.com/graphql"]
}
}
Claude Desktop (pip)
"mcpServers": {
"graphql": {
"command": "python",
"args": ["-m", "mcp_graphql", "--api-url", "https://api.example.com/graphql"]
}
}
Features
- Each GraphQL query is exposed as a separate MCP tool
- Tool parameters automatically map to GraphQL query parameters
- JSON schema for tool inputs is dynamically generated from GraphQL query parameters
- No schema definition required - just provide the API URL and credentials
- Supports GraphQL queries (mutation support planned)
- Customizable authentication (Bearer, Basic, custom headers)
- Automatic handling of complex GraphQL types
- Automatic query generation via GraphQL schema introspection
- Configurable maximum depth for query generation
- Support for predefined queries via file or string input
Environment Variables
Optional
MCP_AUTH_TOKEN- Authentication token for accessing the GraphQL API
Usage Examples
Query user data from a GraphQL API
Fetch posts and articles from a content management system
Extract data from the GitHub GraphQL API
Access product catalogs from e-commerce platforms via GraphQL
Resources
Notes
Requires Python 3.11 or higher. The server automatically introspects the GraphQL API and dynamically creates tools. When using auto-generated queries, be mindful of depth limitations to avoid overwhelming the LLM's context window. For production use, it's recommended to define specific queries via --queries-file or --queries for better control and performance.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.