MCP Server
The MCP (Model Context Protocol) Server exposes GraphQL operations as tools for AI assistants like Claude Desktop.
Repository Location
- GitHub Repository: https://github.com/credinvest/cred-mcp
- Main Working Folder:
graphql-mcp-server - Operations Folder: https://github.com/credinvest/cred-mcp/tree/develop/graphql-mcp-server/data/operations
Overview
The MCP server transforms GraphQL operations into tools that can be used by AI assistants. GraphQL queries and mutations defined in the operations folder are automatically exposed as MCP tools.
Running the Server
Using Docker Compose
The server can be started using docker-compose:
cd graphql-mcp-server
docker-compose up
Environment Configuration
Create a .env file or set the following environment variables in graphql-mcp-server:
# Apollo GraphQL Configuration
APOLLO_KEY="your-apollo-key-here"
APOLLO_GRAPH_REF="your-apollo-graph-ref-here"
# GraphQL Endpoint
GRAPHQL_ENDPOINT=https://api-dev.credplatform.com/graphql
Development Environment Variables
For development, you can use these Apollo credentials:
APOLLO_KEY="service:cred-supergraph-api:1zBIZ8UjuGCA_yF8hDQLDA"
APOLLO_GRAPH_REF="cred-supergraph-api@dev"
How It Works
- GraphQL Operations as Tools: GraphQL operations defined in the
data/operationsfolder automatically become MCP tools - Operation Definitions: Each GraphQL query or mutation in the operations folder is exposed as a tool that can be called by the MCP client
- Automatic Tool Generation: The server reads operation files and creates corresponding MCP tools without manual configuration
Testing with Claude Desktop
To test the MCP server with Claude Desktop, you need to configure it in your claude_desktop_config.json file.
Configuration Location
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Configuration Example
Add the following configuration to your claude_desktop_config.json:
{
"mcpServers": {
"cred_supergraph": {
"command": "npx",
"args": [
"mcp-remote",
"http://127.0.0.1:5000/mcp",
"--header",
"Authorization:${AUTH_HEADER}",
"--header",
"X-LLM-Conversation-Source:${CONVERSATION_SOURCE}"
],
"env": {
"AUTH_HEADER": "Bearer <from commercial web dev>",
"CONVERSATION_SOURCE": "MCP_CLIENT"
}
}
}
}
Getting the Auth Token
The AUTH_HEADER should contain a Bearer token obtained from the commercial web application in the development environment.
After Configuration
Once configured, you should be able to use the MCP tools in Claude Desktop. The tools will appear in Claude's interface and can be called directly.
Adding New Operations
To add new API operations:
- Create Operation File: Add a new GraphQL operation file in
graphql-mcp-server/data/operations/ - Define GraphQL Query/Mutation: Write your GraphQL operation in the file
- Automatic Tool Creation: The server will automatically create an MCP tool from your operation
- Test in Claude Desktop: Restart Claude Desktop and test your new tool
Troubleshooting
- Server Not Starting: Ensure Docker is running and all environment variables are set
- Tools Not Appearing: Restart Claude Desktop after making configuration changes
- Authentication Issues: Verify your
AUTH_HEADERtoken is valid and not expired - Connection Errors: Ensure the MCP server is running on
http://127.0.0.1:5000/mcp