Skip to content

MCP Server

GraphQL Analyzer includes an MCP (Model Context Protocol) server that gives AI agents like Claude access to GraphQL analysis capabilities.

Add to your Claude Desktop config:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
"mcpServers": {
"graphql": {
"command": "/path/to/graphql",
"args": ["mcp", "--workspace", "/path/to/project"]
}
}
}
Terminal window
# Load all projects (default)
graphql mcp --workspace /path/to/project
# Load specific projects only
graphql mcp --workspace /path/to/project --preload frontend,backend
# Load on demand (for large workspaces)
graphql mcp --workspace /path/to/project --no-preload
OptionDescription
--workspaceProject path (defaults to current directory)
--preloadComma-separated projects to preload
--no-preloadDon’t load any projects at startup

Validate a GraphQL document against the schema.

Parameters:

  • document (required) — GraphQL source to validate
  • file_path (optional) — Virtual file path for error reporting
  • project (optional) — Project name

Run lint rules on a GraphQL document.

Parameters:

  • document (required) — GraphQL source to lint
  • file_path (optional) — Virtual file path for error reporting
  • project (optional) — Project name

List all GraphQL projects in the workspace. No parameters.

Load a specific project by name.

Parameters:

  • project (required) — Project name to load

Get all diagnostics for all loaded projects. No parameters.

Find the definition of a GraphQL symbol (type, field, fragment, directive, etc.) at a given file position. Returns file locations with ranges.

Parameters:

  • file_path (required) — Absolute path to the file
  • line (required) — Zero-based line number
  • character (required) — Zero-based character offset
  • project (optional) — Project name

Find all references to a GraphQL symbol across the project at a given file position. Returns all file locations where the symbol is used.

Parameters:

  • file_path (required) — Absolute path to the file
  • line (required) — Zero-based line number
  • character (required) — Zero-based character offset
  • include_declaration (optional) — Whether to include the declaration itself
  • project (optional) — Project name

Get hover information (type details, documentation, deprecation) for a GraphQL symbol at a given position. Returns markdown content.

Parameters:

  • file_path (required) — Absolute path to the file
  • line (required) — Zero-based line number
  • character (required) — Zero-based character offset
  • project (optional) — Project name

Get a hierarchical symbol outline for a GraphQL file (types, operations, fragments, fields). Useful for understanding file structure at a glance.

Parameters:

  • file_path (required) — Absolute path to the file
  • project (optional) — Project name

Search for GraphQL symbols by name across all workspace files. Returns matching symbols with their locations and kinds.

Parameters:

  • query (required) — Symbol name or prefix to search for
  • project (optional) — Project name

Get completion suggestions at a cursor position in a GraphQL file. Returns labeled items with kind, detail, and documentation.

Parameters:

  • file_path (required) — Absolute path to the file
  • line (required) — Zero-based line number
  • character (required) — Zero-based character offset
  • project (optional) — Project name

Get diagnostics (errors and warnings) for a specific file. More targeted than get_project_diagnostics when you only need one file.

Parameters:

  • file_path (required) — Absolute path to the file
  • project (optional) — Project name

List all types in the schema with their kind and metadata. Optionally filter by kind (object, interface, union, enum, scalar, input_object).

Parameters:

  • kind (optional) — Filter by type kind
  • project (optional) — Project name

Get full details for a named type: fields, arguments, interfaces, directives, enum values, and union members.

Parameters:

  • type_name (required) — Name of the type to look up
  • project (optional) — Project name

Return the full merged schema as SDL text, with all extensions applied.

Parameters:

  • project (optional) — Project name

Extract all operations from the loaded project with their names, types, variables, and fragment dependencies. Optionally filter by file.

Parameters:

  • file_path (optional) — Filter to operations in a specific file
  • project (optional) — Project name

Calculate complexity scores for operations. Returns total complexity, depth, per-field breakdown, and warnings. Optionally filter by operation name.

Parameters:

  • operation_name (optional) — Filter to a specific operation
  • project (optional) — Project name

Fetch a schema from a remote GraphQL endpoint via introspection and return the SDL. Supports custom headers for authentication (e.g., Authorization).

Parameters:

  • url (required) — GraphQL endpoint URL
  • headers (optional) — Map of HTTP headers to include in the request