home / mcp / text-to-graphql mcp server
Transforms natural language into GraphQL queries, with schema loading, validation, execution, history, and MCP compatibility.
Configuration
View docs{
"mcpServers": {
"arize-ai-text-to-graphql-mcp": {
"url": "https://placeholder.example.com/mcp",
"headers": {
"MODEL_NAME": "gpt-4o",
"OPENAI_API_KEY": "sk-...",
"GRAPHQL_API_KEY": "your_api_key_here",
"GRAPHQL_HEADERS": "{\"x-api-key\": \"...\"}",
"GRAPHQL_ENDPOINT": "https://api.example.com/graphql",
"GRAPHQL_AUTH_TYPE": "bearer",
"MODEL_TEMPERATURE": "0"
}
}
}
}You can transform natural language queries into GraphQL queries by running a Text-to-GraphQL MCP server. It bridges human language and GraphQL APIs, letting you build, validate, and execute queries with support for schema introspection, caching, and session history all through MCP clients like Cursor and Claude Desktop.
Start by running the MCP server locally or in a container, then connect your MCP client to it. You will ask in plain language for what you want, and the server will generate a corresponding GraphQL query, validate it against the loaded schema, and execute it against your GraphQL endpoint if you choose.
- Convert natural language requests into GraphQL queries.
- Load and introspect GraphQL schemas so queries are always aligned with the available data.
- Validate generated queries against the active schema before execution.
- Execute queries against your GraphQL endpoint with proper authentication.
- Keep a history of queries across sessions for quick reference.
Use a configuration block that runs the MCP server through the UV runner, providing the directory to the MCP and the command to start it. The environment variables must include your API keys and endpoint details for GraphQL communication.
{
"text-to-graphql": {
"command": "uv",
"args": [
"--directory",
"/path/to/text-to-graphql-mcp",
"run",
"text-to-graphql-mcp"
],
"env": {
"PATH": "/path/to/uv/bin:/usr/bin:/bin",
"OPENAI_API_KEY": "your_openai_api_key_here",
"GRAPHQL_ENDPOINT": "https://your-graphql-api.com/graphql",
"GRAPHQL_API_KEY": "your_api_key_here",
"GRAPHQL_AUTH_TYPE": "bearer"
}
}
}Run the MCP server directly for a quick test or execute it as a module when you are in a development environment.
text-to-graphql-mcpKeep your OpenAI API key and GraphQL credentials secure. Use environment-specific keys and restrict access to the host running the MCP server. When deploying, prefer server-side secrets management and avoid embedding keys in client configurations.
Prerequisites you need before starting install include Python tooling and the UV package manager. You will set up UV, install the MCP package, and prepare the environment for running the server.
# Prerequisites
# Install UV (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS/Linux
# Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Find UV path
which uv
# Typical path examples to set up in MCP config
# macOS/Linux: ~/.local/bin/uv
# Windows: %APPDATA%\uv\bin\uv.exeClone the Text-to-GraphQL MCP project, install dependencies, and verify the command help to ensure the server starts correctly.
git clone https://github.com/Arize-ai/text-to-graphql-mcp.git
cd text-to-graphql-mcp
uv sync
uv run text-to-graphql-mcp --helpIf you publish or obtain a package, you can install it via a package manager when available.
pip install text-to-graphql-mcpConfigure the MCP client to point to the server using the standard UV-driven command. The directory should point to the MCP location and the command runs the server with UV in the correct environment.
{
"text-to-graphql": {
"command": "uv",
"args": [
"--directory",
"/path/to/text-to-graphql-mcp",
"run",
"text-to-graphql-mcp"
],
"env": {
"PATH": "/path/to/uv/bin:/usr/bin:/bin",
"OPENAI_API_KEY": "your_openai_api_key_here",
"GRAPHQL_ENDPOINT": "https://your-graphql-api.com/graphql",
"GRAPHQL_API_KEY": "your_api_key_here",
"GRAPHQL_AUTH_TYPE": "bearer"
}
}
}You can run the MCP server in a Docker container and connect MCP clients to it. Provide the API keys and endpoint details as environment variables when starting the container, and connect clients to the running container.
docker build -t text-to-graphql-mcp .
docker run -d \
--name text-to-graphql-mcp \
-p 8000:8000 \
-e OPENAI_API_KEY=your_openai_api_key_here \
-e GRAPHQL_ENDPOINT=https://your-graphql-api.com/graphql \
-e GRAPHQL_API_KEY=your_api_key_here \
-e GRAPHQL_AUTH_TYPE=bearer \
text-to-graphql-mcpMonitor MCP server health and query performance to ensure smooth operation. Log outputs and error traces help diagnose schema issues, authentication failures, or invalid queries.
The server uses a multi-agent workflow to recognize intent, manage the GraphQL schema, construct queries, validate them, execute against the endpoint, and visualize results.
Convert natural language to GraphQL queries.
Validate GraphQL queries against the loaded schema.
Execute GraphQL queries and return formatted results.
Retrieve the history of all queries in the current session.
Get example queries to understand the system's capabilities.