An MCP server that helps AI agents interact with GraphQL APIs through structured tools instead of raw query generation.
QuerySculptor provides 26 tools via the Model Context Protocol (MCP) that allow agents to build, validate, and execute GraphQL queries step-by-step rather than generating complete query strings.
Traditional approaches:
- Hardcoded queries lack flexibility and are hard to maintain
- Raw GraphQL generation has high error rates and complex syntax requirements
- Agents struggle with complex schema relationships
- No validation leads to runtime failures
- Monolithic queries require all-or-nothing construction
QuerySculptor approach:
- Guided construction with step-by-step query building and validation
- Schema-aware with real-time introspection and type safety
- Error prevention catches issues during construction rather than execution
- Incremental building works well with conversational AI workflows
- MCP standard compatibility with Claude, Cursor, and other MCP clients
Works best with Claude Sonnet models - results may vary with other LLMs.
New to QuerySculptor?
- ๐ Agent System Prompt - Complete guide for AI agents
- โก Quick Reference - Essential workflow and tools
# Agent tries to generate this complex query in one go:
query GetUserWithPostsAndComments($userId: ID!, $postLimit: Int = 10) {
user(id: $userId) {
id
name
email
posts(first: $postLimit) {
edges {
node {
id
title
content
comments(first: 5) {
edges {
node {
id
content
author {
name
}
}
}
}
}
}
}
}
}Result: Syntax errors, wrong types, missing fields, frustrated developers
// Agent builds this incrementally with guided tools:
1. startQuerySession()
2. introspectSchema()
3. selectField("user")
4. setTypedArgument("id", userId)
5. selectField("user.name")
6. selectField("user.posts")
7. setTypedArgument("user.posts", "first", 10)
// ... continue building step by step
8. validateQuery() โ
9. executeQuery() ๐Result: Well-formed queries, reduced syntax errors, built-in validation
- Live schema discovery and API understanding
- Type relationship mapping for complex schemas
- Field-level insights showing available fields and requirements
- 26 tools organized into 7 categories
- Step-by-step building suitable for AI reasoning workflows
- Real-time validation to catch errors before execution
- Fragment support for reusable query components
- Redis-backed sessions for persistent state across interactions
- Rate limiting for API protection
- Vercel deployment ready
- Comprehensive test coverage including agent-like workflow testing
- Session persistence fixes for reliable inline fragment operations
- MCP Standard - works with Claude Desktop, Cursor, and other MCP clients
- TypeScript native with full type safety
QuerySculptor requires Redis for session management and query state persistence.
Redis Options:
- Upstash - Serverless Redis (recommended for production)
- Local Redis - For development (
redis-server) - Docker Redis -
docker run -d -p 6379:6379 redis:alpine - Any Redis provider - AWS ElastiCache, Google Cloud Memorystore, etc.
MCP Endpoint: https://querysculptor.com/mcp
The demo is pre-configured to use the Pokemon API for testing QuerySculptor features.
๐ฌ Query Sculptor Chat Pokemon GraphQL API: QuerySculptor Chat - Chat with Pokemon's GraphQL API powered by QuerySculptor MCP server
Our demo uses the Pokemon API - here's what you can ask:
Discover Pokemon:
- "Show me the first 10 Pokemon with their types and sprites"
- "Find all Pokemon that are both Fire and Flying type"
- "What are the stats for Charizard?"
Explore Abilities & Moves:
- "List all Pokemon abilities and their effects"
- "What moves can Pikachu learn?"
- "Show me all Electric-type moves with their power and accuracy"
Regional & Species Data:
- "List all Pokemon from the Kanto region"
- "Show me Pokemon species with their evolution chains"
- "What berries are available and what do they do?"
Complex Queries:
- "Find Pokemon with abilities that boost attack in a pinch"
- "Show me all legendary Pokemon with their types and base stats"
- "List Pokemon that can learn both Water and Ice moves"
Add to your Cursor mcp.json:
{
"mcpServers": {
"graphql-query-builder-demo": {
"url": "https://querysculptor.com/mcp"
}
}
}# Clone and setup
git clone https://github.com/flinstonedev/querysculptor.git
cd querysculptor
pnpm install
# Configure (copy example.env to .env and customize)
cp example.env .env
# Launch
vercel dev
# ๐ Your MCP server is live at http://localhost:3000/mcpTo set custom endpoint and bearer token, edit your .env file:
DEFAULT_GRAPHQL_ENDPOINT=https://your-api.com/graphql
DEFAULT_GRAPHQL_HEADERS={"Authorization": "Bearer your_token"}"Agent, find all users who posted in the last week and show their top comments."
The agent uses QuerySculptor to:
- Introspect any GraphQL API
- Build queries targeting users, posts, and comments
- Execute with proper syntax and structure
Transform chatbots into GraphQL-capable agents:
- User: "Show me recent fiction books under $20"
- Agent: Uses QuerySculptor tools to query bookstore APIs
- Result: Structured data retrieval without manual query writing
Create agents that generate business insights:
- Sales dashboards from e-commerce APIs
- User engagement from social media APIs
- Performance metrics from any GraphQL source
- IDE integration - AI assistants that help write queries
- API exploration - Discover and understand any GraphQL API
- Query optimization - AI-suggested performance improvements
26 Tools Across 7 Categories:
introspect-schema- API schema understandingget-root-operation-types- Entry point discoveryget-type-info- Type analysisget-field-info- Field-level informationget-input-object-help- Input object guidance
start-query-session- Session initializationend-query-session- Resource cleanupget-current-query- Query visualizationget-selections- Field suggestions
select-field- Field targetingselect-multiple-fields- Batch operationsselect-field-simple- Simple selections
set-query-variable- Variable definitionset-variable-value- Value assignmentremove-query-variable- Variable removal
set-string-argument- String and enum handlingset-typed-argument- Numbers, booleans, complex typesset-input-object-argument- Nested object constructionset-variable-argument- Variable references
define-named-fragment- Reusable query componentsapply-named-fragment- Fragment applicationapply-inline-fragment- Type-conditional selections
set-field-directive- Field-level directives (@include, @skip)set-operation-directive- Operation-level directives
validate-query- Schema compliance verificationexecute-query- Query execution
QuerySculptor works with Claude Desktop through mcp-remote, which acts as a bridge between Claude Desktop and remote MCP servers.
Edit your configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
For Remote Demo:
{
"mcpServers": {
"querysculptor": {
"command": "npx",
"args": [
"mcp-remote",
"https://querysculptor.com/mcp"
]
}
}
}For Local Development:
{
"mcpServers": {
"querysculptor-local": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:3000/mcp",
"--allow-http"
]
}
}
}To set custom endpoint and bearer token, add env to your configuration:
{
"mcpServers": {
"querysculptor": {
"command": "npx",
"args": ["mcp-remote", "https://your-querysculptor.vercel.app/mcp"],
"env": {
"DEFAULT_GRAPHQL_ENDPOINT": "https://your-api.com/graphql",
"DEFAULT_GRAPHQL_HEADERS": "{\"Authorization\": \"Bearer your_token\"}"
}
}
}
}If you encounter issues:
-
Clear mcp-remote cache:
rm -rf ~/.mcp-auth -
Check logs:
- macOS/Linux:
tail -n 20 -F ~/Library/Logs/Claude/mcp*.log - Windows:
Get-Content "C:\Users\YourUsername\AppData\Local\Claude\Logs\mcp.log" -Wait -Tail 20
- macOS/Linux:
-
Restart Claude Desktop completely after config changes
One-Click Deploy:
After deployment, configure these environment variables in your Vercel dashboard:
REDIS_URL- your Redis connection stringDEFAULT_GRAPHQL_ENDPOINT- your GraphQL API endpoint (optional)DEFAULT_GRAPHQL_HEADERS- JSON string with headers for authentication (optional)
Manual Deploy:
# Clone and deploy
git clone https://github.com/flinstonedev/querysculptor.git
cd querysculptor
vercel --prodConfigure environment variables in Vercel dashboard.
To set custom endpoint and bearer token, add these to your Vercel environment variables:
DEFAULT_GRAPHQL_ENDPOINT=https://your-api.com/graphql
DEFAULT_GRAPHQL_HEADERS={"Authorization": "Bearer your_token"}
QuerySculptor includes comprehensive testing frameworks:
pnpm test # Run all tests
pnpm test:watch # Watch mode
pnpm test:coverage # Coverage reportTest tools exactly as AI agents would use them:
pnpm test:agent # Run all agent workflow tests
pnpm test:agent:basic # Basic workflow tests
pnpm test:agent:debug # Debug mode with detailed output
pnpm test:agent:errors # Error scenario testsThe agent testing framework:
- โ Real MCP Protocol: Tests through actual MCP communication layer
- โ Session Persistence: Validates Redis-backed session management
- โ Workflow Simulation: Executes realistic multi-step agent workflows
- โ Error Recovery: Tests common failure modes and recovery patterns
- โ Debug Utilities: Detailed analysis and debugging capabilities
- Session ID validation prevents injection attacks
- Proper whitespace handling and normalization
- Clear error messages for invalid session formats
- Backwards compatible with existing implementations
- Add proper logging - Structured logging for debugging and monitoring
- Query Optimization AI - Automatic performance improvements
- Visual Query Builder - Web UI for query construction
- Enhanced Agent Testing - Expand agent workflow test coverage
- Documentation improvements - Help others understand the project
- Tool enhancements - Add new capabilities
- Client integrations - Support more MCP clients
- Performance optimizations - Improve performance
- Agent testing scenarios - Add more real-world workflow tests
