Skip to main content
Glama
wanzunz

GitHub GraphQL API MCP

by wanzunz

GitHub GraphQL API MCP

English | 中文 | 日本語 | Español | Français

A tool based on MCP (Model Context Protocol) for querying and using the GitHub GraphQL API. This project provides a server that allows you to explore the GitHub GraphQL schema and execute GraphQL queries through MCP client tools (such as Claude AI).

Table of Contents

Related MCP server: @cloud9-labs/mcp-github

Why Use GitHub GraphQL API

GitHub GraphQL API offers significant advantages over traditional REST APIs:

  • Precise Data Retrieval: GraphQL allows clients to specify exactly which fields they need, avoiding excess data

  • Reduced Token Consumption: By requesting only necessary fields, API response size is significantly reduced, lowering AI model token consumption

  • Single Request for Related Data: One query can retrieve multiple related resources, reducing the number of requests

  • Self-Documenting: Through its built-in documentation system, you can directly query and understand the API schema without external documentation

  • Strong Type System: Provides type checking, reducing errors

This project leverages these advantages to provide tools that help you effectively explore the GitHub GraphQL API schema and execute optimized queries, providing AI assistants with efficient GitHub data retrieval capabilities.

Application Scenarios

Basic Functions

This tool easily implements the following common operations:

  1. Repository Basic Information Query: Get repository name, description, star count, branch list, and other basic information

  2. Issue Data Retrieval: Query issue lists, details, or comment content for specific repositories

  3. User Profile Access: Retrieve users' personal profiles, contribution statistics, and other public information

  4. Pull Request Status View: Get PR basic status, comment content, and merge information

  5. Project Dependency Query: Retrieve project dependency package lists and version information

Exploratory Advanced Functions

With GraphQL's flexible query capabilities, you can also try to implement the following advanced analysis functions:

  1. Repository Contribution Trend Analysis: Analyze code update frequency and contributor participation by aggregating commit data, evaluating project activity

  2. Issue Management and Classification: Organize issue data according to custom conditions, discover problems that need priority handling, and improve project management efficiency

  3. Code Review Pattern Analysis: Analyze PR comments and review processes, identify common problem patterns, and optimize code review workflow

  4. Contributor Network Visualization: Build collaboration relationships between project contributors, discover key contributors and areas of expertise

  5. Dependency Health Assessment: Evaluate the update frequency and potential security issues of project dependencies, providing dependency management suggestions

Features

  • Query GitHub GraphQL schema root types (Query/Mutation)

  • Get detailed documentation for specific types

  • Query documentation and parameters for specific fields

  • Execute GitHub GraphQL API queries directly, precisely retrieving needed data, reducing token consumption

  • Multilingual support (English/Chinese/Japanese/Spanish/French)

Comparison with Official GitHub MCP Server

Compared to the official github-mcp-server, this project offers distinct advantages in specific scenarios:

Feature

GitHub GraphQL API MCP

Official GitHub MCP Server

Core Mechanism

Single GraphQL Query

Multiple REST API / Granular Tools

Data Retrieval

One-shot: Fetch repository details, issues, PRs, history, and releases in a single request

Multi-step: Requires chaining search_repositories, get_file_contents, list_commits, etc.

Efficiency

High. Minimizes network latency and round-trips.

Lower for complex data gathering. High latency due to sequential tool calls.

Token Usage

Optimized. Returns only requested fields.

Higher. Intermediate tool outputs (full JSON responses) consume context window.

Flexibility

High. Client defines exact data structure needed.

Fixed. Client must work with predefined API response structures.

API Coverage

Complete. Access any field exposed by GitHub's GraphQL API.

Partial. Limited to the specific REST endpoints hardcoded by the maintainers.

Introspection

Built-in. AI can query the schema to learn about new API fields dynamically.

None. AI relies on its training data; cannot discover new API features without tool updates.

Maintainability

Zero-code updates. Often just requires a schema file update to support new GitHub features.

Code-heavy. Requires writing new Go handlers and struct definitions for every new feature.

Complexity

Requires LLM to write GraphQL (supported by schema introspection tools).

Easier for LLMs that prefer simple function calls, but harder to manage state across calls.

Example: To get "latest important updates for a project", this tool can fetch releases, recent commits, and open issues in one go, whereas the official server might require 5+ separate tool calls and round trips.

Why This Matters for AI Agents

  1. Context Window Efficiency: Official tools often return massive JSON objects (e.g., a full repository object might be 5KB+). With GraphQL, you fetch only the name and description, saving 99% of tokens.

  2. Complex Reasoning: AI agents often need to traverse relationships (e.g., "Find the author of the PR that closed this Issue"). In REST/Official tools, this is a multi-step "Search -> Get ID -> Get PR -> Get Author" process. In GraphQL, it's a single nested query, allowing the AI to focus on reasoning rather than data plumbing.

  3. Future Proofing: When GitHub adds a new feature (e.g., a new field on Discussions), this MCP server can support it immediately via schema introspection, while the official server waits for a code update.

Prerequisites

  • Python 3.10 or higher

  • GitHub personal access token (for accessing the GitHub API)

  • Poetry (recommended dependency management tool)

Installation & Usage

We recommend using uv for management, which is currently the fastest and simplest Python project management tool. Alternatively, you can use standard pip.

With uv, you don't need to manually create virtual environments or install dependencies; it handles everything for you automatically.

  1. Install uv (Skip if already installed):

    # MacOS / Linux
    curl -lsSf https://astral.sh/uv/install.sh | sh
    
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
  2. Configure Environment Variables: Copy .env.example to .env and fill in your GitHub Token:

    cp .env.example .env
    # Edit .env file and fill in your token
  3. One-click Run:

    uv run github_graphql_api_mcp_server.py

    uv will automatically create a virtual environment, download and install all dependencies, and then start the server.

Method 2: Standard pip

If you prefer not to install extra tools, you can use the traditional Python method:

  1. Create and Activate Virtual Environment:

    python -m venv .venv
    source .venv/bin/activate  # Windows: .venv\Scripts\activate
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Configure Environment Variables: Create and configure .env file as above.

  4. Run:

    python github_graphql_api_mcp_server.py

Configure in Claude Desktop

You can configure this MCP server in the Claude desktop app for one-click startup:

  1. Open the Claude desktop app

  2. Go to settings, find the MCP server configuration section

  3. Add the following configuration (modify according to your actual path):

{
    "mcpServers": {
        "github_mcp": {
            "command": "/path/to/uv",
            "args": [
                "run",
                "--directory",
                "<project path>",
                "github_graphql_api_mcp_server.py"
            ]
        }
    }
}

Configuration example (using uv):

{
    "mcpServers": {
        "github_mcp": {
            "command": "/Users/username/.cargo/bin/uv",
            "args": [
                "run",
                "--directory",
                "/Users/username/github/github_graphql_api_mcp/",
                "github_graphql_api_mcp_server.py"
            ]
        }
    }
}

If using standard Python (Method 2):

{
    "mcpServers": {
        "github_mcp": {
            "command": "/path/to/project/.venv/bin/python",
            "args": [
                "github_graphql_api_mcp_server.py"
            ]
        }
    }
}

After configuration, you can start the MCP server directly from the Claude desktop app without having to start it manually.

Available Tools

The server provides the following tools:

  1. print_type_field: Query fields of GitHub GraphQL schema root types

  2. graphql_schema_root_type: Get documentation for root types (Query/Mutation)

  3. graphql_schema_type: Query documentation for specific types

  4. call_github_graphql: Execute GitHub GraphQL API queries

Usage Examples

After connecting to the server with an MCP client, you can:

  1. Query root type documentation:

    Use the graphql_schema_root_type tool, parameter type_name="QUERY"
  2. Query fields of specific types:

    Use the print_type_field tool, parameters type_name="QUERY", type_fields_name="repository"
  3. Query documentation for specific types:

    Use the graphql_schema_type tool, parameter type_name="Repository"
  4. Execute GraphQL queries:

    Use the call_github_graphql tool, parameter:
    graphql="""
    query {
      viewer {
        login
        name
      }
    }
    """

Example Screenshot

Below is an example of using the GitHub GraphQL API MCP with Claude:

GitHub GraphQL API MCP Usage Example

Notes

  • Make sure your GitHub token has appropriate permissions before use

  • The token is stored in the .env file, which should not be committed to version control systems

  • Queries should comply with GitHub API usage limits

License

This project is licensed under the MIT License - a very permissive license that allows users to freely use, modify, distribute, and commercialize this software, as long as they retain the copyright notice and license statement.

See MIT License for detailed terms.

Available Tools

4 tools
call_github_graphqlB

A tool to execute GitHub GraphQL API queries. Before using, it's recommended to check the documentation first, and include ID fields in your queries for easier follow-up operations Args: graphql: The GraphQL query Returns: str: Execution result

ParametersJSON Schema
NameRequiredDescriptionDefault
graphqlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions checking documentation and including ID fields, which adds some operational context, but fails to address critical traits like authentication requirements, rate limits, error handling, or mutation vs. query behavior. For a GraphQL API tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose and usage recommendation in the first sentence. The Args and Returns sections are structured but could be more integrated. There's minimal waste, though the 'Returns: str: Execution result' is redundant given the output schema, slightly reducing efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (GraphQL API execution) and the presence of an output schema (which handles return values), the description is partially complete. It covers basic purpose and some usage tips but lacks details on authentication, error cases, or integration with sibling tools. Without annotations and with low schema coverage, it doesn't fully equip an agent for reliable tool invocation in a GitHub context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal meaning beyond the input schema: it names the single parameter 'graphql' and states it's 'The GraphQL query', which the schema already indicates as a string type. With 0% schema description coverage, the description doesn't compensate by explaining query syntax, validation rules, or examples. The baseline is 3 because the schema covers the parameter's existence and type, but the description fails to enhance understanding significantly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'execute GitHub GraphQL API queries' with a specific verb (execute) and resource (GitHub GraphQL API queries). It distinguishes itself from sibling tools like graphql_schema_root_type and graphql_schema_type by focusing on query execution rather than schema exploration. However, it doesn't explicitly contrast with print_type_field, leaving some sibling differentiation incomplete.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by recommending checking documentation first and including ID fields for follow-up operations, which suggests context for when to use this tool effectively. However, it lacks explicit when/when-not criteria or named alternatives to sibling tools, leaving the agent to infer optimal usage scenarios without clear boundaries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

graphql_schema_root_typeC

A tool to query GitHub GraphQL schema root types. You need to provide the root type name (QUERY/MUTATION) Args: type_name: root type (QUERY or MUTATION) Returns: str: Documentation content

ParametersJSON Schema
NameRequiredDescriptionDefault
type_nameYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states the tool returns documentation content as a string but doesn't disclose authentication requirements, rate limits, error handling, or what specific documentation format to expect. The 'query' verb implies read-only, but this isn't explicitly confirmed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences: purpose statement, parameter guidance, and return value. It's front-loaded with the core function. Minor improvements could include bullet points for Args/Returns, but overall it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, no output schema, and low schema coverage, the description is incomplete. It lacks details on authentication, error cases, the structure of returned documentation, or how this integrates with sibling tools. The return type 'str: Documentation content' is vague without examples or format specifications.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description compensates by explaining that 'type_name' should be 'QUERY or MUTATION' and represents the 'root type name.' This adds meaningful context beyond the schema's generic 'Type Name' title, though it doesn't detail format constraints or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'query GitHub GraphQL schema root types' with specific resource (GitHub GraphQL schema) and verb (query). It distinguishes from sibling 'graphql_schema_type' by focusing on root types only, though it doesn't explicitly contrast with 'call_github_graphql' or 'print_type_field'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'graphql_schema_type' for non-root types or 'call_github_graphql' for actual queries. The description mentions needing to provide root type name but doesn't explain use cases or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

graphql_schema_typeB

A tool to query specific type documentation in GitHub GraphQL schema. You need to provide the type_name Args: type_name: Type name like SecurityAdvisoryConnection Returns: str: Documentation content

ParametersJSON Schema
NameRequiredDescriptionDefault
type_nameYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool queries documentation, implying a read-only operation, but doesn't specify if it's safe, requires authentication, has rate limits, or what happens on errors. For a query tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly. The 'Args:' and 'Returns:' sections are structured but slightly redundant with the schema. It's concise with no wasted words, though the formatting could be more integrated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is somewhat complete but has gaps. It covers the basic purpose and parameter semantics but lacks usage guidelines, behavioral details, and output explanation. For a simple query tool, it's adequate but not fully comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It explains the single parameter 'type_name' as 'Type name like `SecurityAdvisoryConnection`,' adding meaning beyond the schema's basic 'string' type. This clarifies the parameter's purpose and provides an example, though it could be more detailed about valid type names or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'query specific type documentation in GitHub GraphQL schema.' It specifies the verb ('query'), resource ('type documentation'), and domain ('GitHub GraphQL schema'). However, it doesn't explicitly differentiate from sibling tools like 'graphql_schema_root_type' or 'print_type_field' beyond mentioning 'specific type' documentation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: 'You need to provide the type_name' and gives an example ('SecurityAdvisoryConnection'). It doesn't explain when to use this tool versus alternatives like 'graphql_schema_root_type' or 'print_type_field,' nor does it mention prerequisites or exclusions. The guidance is basic and lacks context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updates
    • First observedcall_github_graphql
    • First observedgraphql_schema_root_type
    • First observedgraphql_schema_type
    • First observedprint_type_field

TDQS

B3.1/5.0
Disambiguation3/5

The tools have overlapping purposes focused on GitHub GraphQL schema exploration, which could cause confusion. call_github_graphql is distinct for executing queries, but graphql_schema_root_type, graphql_schema_type, and print_type_field all retrieve schema documentation with subtle differences in scope (root types vs. specific types vs. root type fields). Descriptions help clarify, but an agent might struggle to choose between them for schema inspection tasks.

Naming Consistency4/5

Tool names follow a consistent snake_case pattern with clear verb_noun structure (e.g., call_github_graphql, graphql_schema_type). Minor deviations exist, such as graphql_schema_root_type using 'root_type' while print_type_field uses 'type_field', but overall the naming is predictable and readable across all tools.

Tool Count4/5

With 4 tools, the count is reasonable for a GitHub GraphQL API server, providing a focused set for query execution and schema exploration. It's slightly thin for comprehensive API coverage but well-scoped for its intended purpose, avoiding bloat while supporting core workflows like querying and schema lookup.

Completeness3/5

The tool set covers query execution and schema documentation retrieval, but has notable gaps for a GitHub API surface. It lacks CRUD operations for resources like repositories, issues, or pull requests, and doesn't support mutations or advanced query building. Agents can work around this by crafting GraphQL queries, but the surface is incomplete for typical GitHub automation tasks.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.

  • Token-free MCP server for structured RevoGrid Core, Pro, and Enterprise knowledge retrieval.

Related MCP Servers

  • F
    license
    A
    quality
    B
    maintenance
    Refined MCP server for GitHub GraphQL API. GitHub's official MCP Server exposes dozens of low-level tools that bloat token usage and are mostly impractical for LLMs. gh-mcp achieves the best of both worlds by providing a single, powerful interface: GitHub GraphQL, wrapped with smart abstractions.
    2
    -
  • A
    license
    B
    quality
    D
    maintenance
    MCP (Model Context Protocol) server for GitHub API integration. This server provides comprehensive tools for interacting with GitHub repositories, issues, pull requests, branches, and code search through a unified interface.
    15
    14
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    A lightweight MCP server that exposes GitHub operations as tools over HTTP, enabling any MCP-compatible client to interact with GitHub repositories without a built-in connector.
    1
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wanzunz/github_graphql_api_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server