GitHub Repository Intelligence MCP Server
Allows AI agents to interact with GitHub repositories, including listing repositories, retrieving repository details, exploring file structures, reading file contents, and searching code across a repository.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub Repository Intelligence MCP ServerShow me the structure of my Autonomous-research-agent repository"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitHub Repository Intelligence MCP Server ๐ค
An AI-powered GitHub Repository Intelligence system that allows a Large Language Model (LLM) to explore, inspect, and analyze GitHub repositories through the Model Context Protocol (MCP).
The system combines Qwen, Groq, MCP, and the GitHub REST API to create an agentic workflow where the LLM can understand a user's request, select the appropriate tool, retrieve information from GitHub, and generate a natural-language response.
๐ Table of Contents
Related MCP server: github-repo-mcp-server
๐ Overview
GitHub Repository Intelligence MCP Server is an agentic AI project that enables an LLM to interact with GitHub repositories through the Model Context Protocol (MCP).
Instead of manually navigating GitHub, searching through files, opening repositories, and inspecting source code, users can interact with their GitHub account using natural language.
For example:
What repositories do I have?Tell me about my Autonomous-research-agent repository.Show me the structure of my Autonomous-research-agent repository.Explain agents/researcher.py.Where is Tavily used in my Autonomous-research-agent repository?The AI agent determines which tool is required, calls the MCP server, retrieves the required information from GitHub, and then uses the retrieved information to generate the final response.
๐ก Why This Project?
Modern LLM applications are increasingly moving from simple question-answering systems toward agentic systems that can interact with external tools and data sources.
This project demonstrates how an LLM can be connected to an external system using MCP.
Instead of implementing GitHub functionality directly inside the LLM application, the GitHub capabilities are exposed as independent MCP tools.
This creates a clean separation between:
AI reasoning
Tool orchestration
MCP communication
GitHub API integration
The result is a modular architecture that can be extended with additional tools in the future.
๐ง Architecture
The overall architecture is:
โโโโโโโโโโโโโโโโโโโโโโโโ
โ User โ
โ Natural Language โ
โ Query โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Qwen / Groq โ
โ โ
โ LLM Reasoning โ
โ Tool Selection โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โ Tool Call
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Client โ
โ agent.py โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โ MCP Protocol
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Server โ
โ server.py โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Tool Layer โ
โ repositories.py โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub Client โ
โ github_client.py โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โ GitHub REST API
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub โ
โ Repositories โ
โ Files / Code โ
โโโโโโโโโโโโโโโโโโโโโโโโThe result is then returned through the same chain:
GitHub
โ
GitHub Client
โ
Tool Layer
โ
MCP Server
โ
MCP Client
โ
Qwen / Groq
โ
Natural Language Answer๐ How It Works
The system follows an agentic tool-calling workflow.
Step 1 โ User Query
The user provides a natural-language request.
Example:
Where is Tavily used in my Autonomous-research-agent repository?Step 2 โ Tool Discovery
The MCP client connects to the MCP server and discovers the available tools.
The current MCP server exposes:
get_my_repositories
get_repository
list_files
read_file
search_codeStep 3 โ LLM Reasoning
The available tools are converted into a format that can be used by the Groq API.
Qwen receives:
The system instructions
The user's question
The available tools
The model determines which tool is appropriate.
For the Tavily example, it can select:
search_codeStep 4 โ MCP Tool Execution
The MCP client sends the tool request to the MCP server.
The MCP server executes the corresponding Python function.
Step 5 โ GitHub API Request
The tool layer calls the GitHubClient.
The GitHub client communicates with the GitHub REST API using the authenticated GitHub token.
Step 6 โ Tool Result
The GitHub data is returned to the MCP server and then to the MCP client.
Step 7 โ LLM Receives the Result
The tool result is added to the conversation as a tool message.
Qwen receives the retrieved information and decides whether:
More tools are required
Or enough information exists to answer the user
Step 8 โ Final Answer
Once enough information has been collected, Qwen generates the final natural-language response.
โจ Features
๐ Repository Discovery
Retrieve repositories belonging to the authenticated GitHub account.
The system can return information such as:
Repository name
Full repository name
Visibility
Description
GitHub URL
๐ Repository Information
Retrieve detailed information about a specific repository.
The returned information includes:
Repository name
Full name
Description
Visibility
Primary programming language
Stars
Forks
Open issues
Default branch
Creation date
Last update date
GitHub URL
๐ Repository File Exploration
The list_files tool allows the agent to explore repository files and directories.
The tool supports directory paths, allowing the agent to progressively explore a repository.
For example:
list_files(
repo="Autonomous-research-agent",
path=""
)Then:
list_files(
repo="Autonomous-research-agent",
path="agents"
)Then:
list_files(
repo="Autonomous-research-agent",
path="tools"
)This allows the agent to construct a repository tree.
๐ File Reading
The read_file tool retrieves the content of a specific repository file.
For example:
read_file(
repo="Autonomous-research-agent",
path="agents/researcher.py"
)The retrieved content can then be analyzed by the LLM.
This allows users to ask questions such as:
Explain agents/researcher.py.or:
What does this file do?๐ Code Search
The search_code tool searches for a text string across repository files.
It can be used to find:
Functions
Classes
Variables
Libraries
APIs
Configuration values
Imports
Any specific text
For example:
search_code(
repo="Autonomous-research-agent",
query="Tavily"
)The result includes:
File path
Matching line number
Matching line content
GitHub URL
๐ค Agentic Tool Selection
The LLM automatically determines which tool should be used.
The application does not require the user to manually select a tool.
For example:
User:
"What repositories do I have?"The LLM can select:
get_my_repositoriesFor:
"Tell me about my Autonomous-research-agent repository."The LLM can select:
get_repositoryFor:
"Explain agents/researcher.py."The LLM can select:
read_fileFor:
"Where is Tavily used?"The LLM can select:
search_code๐ Multi-Step Reasoning
The agent can execute multiple tool calls when a request requires additional information.
For example, a repository structure request can result in:
list_files("")
โ
list_files("agents")
โ
list_files("config")
โ
list_files("models")
โ
list_files("reports")
โ
list_files("tests")
โ
list_files("tools")
โ
Final AnswerThis creates a practical agentic workflow instead of a single API call.
๐ ๏ธ MCP Tools
The MCP server currently provides five tools.
Tool | Description |
| Retrieves repositories from the authenticated GitHub account |
| Retrieves detailed information about a repository |
| Lists files and directories at a specific repository path |
| Reads the content of a specific repository file |
| Searches for a text string across repository files |
๐ Project Structure
GitHub-MCP-server/
โ
โโโ src/
โ โ
โ โโโ __init__.py
โ โ
โ โโโ agent.py
โ โ
โ โโโ server.py
โ โ
โ โโโ github_client.py
โ โ
โ โโโ test_client.py
โ โ
โ โโโ tools/
โ โ
โ โโโ __init__.py
โ โ
โ โโโ repositories.py
โ
โโโ .env
โโโ .env.example
โโโ .gitignore
โโโ requirements.txt
โโโ README.md๐งฉ Components
src/agent.py
This is the main AI agent.
It is responsible for:
Starting the MCP server
Creating the MCP client
Connecting to the MCP server using stdio
Discovering available MCP tools
Converting MCP tools into Groq-compatible function tools
Sending user queries to Qwen
Processing LLM tool calls
Calling MCP tools
Sending tool results back to Qwen
Managing the agent loop
Returning the final natural-language response
The agent supports multiple tool-calling steps.
A maximum number of steps is defined to prevent an infinite loop.
MAX_STEPS = 8src/server.py
This file implements the MCP server.
It creates the MCP server using the MCP Python SDK:
from mcp.server.mcpserver import MCPServerThe server exposes the GitHub functionality as MCP tools.
The tools currently exposed are:
get_my_repositories
get_repository
list_files
read_file
search_codeThe server communicates with the MCP client through standard input/output.
src/github_client.py
This module handles communication with the GitHub REST API.
The GitHubClient class is responsible for:
GitHub authentication
Getting the authenticated user
Getting repositories
Getting repository details
Listing repository files
Reading repository files
Searching repository code
The client uses httpx.AsyncClient for asynchronous HTTP requests.
src/tools/repositories.py
This module acts as an abstraction layer between the MCP server and the GitHub client.
It calls the appropriate methods from GitHubClient and converts the raw GitHub API responses into structured results.
This separation keeps the architecture modular.
src/test_client.py
This is a lightweight MCP client used for testing the MCP server independently from the AI agent.
It verifies:
MCP server startup
MCP client connection
Tool discovery
Tool execution
This makes it useful during development and debugging.
๐ Agent Loop
The core agent follows a repeated loop.
Conceptually:
User Query
โ
Qwen
โ
Does Qwen need a tool?
โ
โโโ No โโโ Final Answer
โ
โโโ Yes
โ
Tool Call
โ
MCP Client
โ
MCP Server
โ
GitHub API
โ
Tool Result
โ
Qwen
โ
โโโ Need more information
โ โ
โ Another Tool Call
โ
โโโ Enough information
โ
Final AnswerThe implementation limits the number of iterations using:
MAX_STEPS = 8This prevents the agent from continuing indefinitely.
๐ฌ Example Queries
1. List Repositories
User:
What repositories do I have?Expected tool:
get_my_repositories2. Repository Information
User:
Tell me about my Autonomous-research-agent repository.Expected tool:
get_repository3. Repository Structure
User:
Show me the structure of my Autonomous-research-agent repository.The agent can use:
list_filesmultiple times to explore directories.
Example workflow:
list_files("")
โ
list_files("agents")
โ
list_files("config")
โ
list_files("models")
โ
list_files("reports")
โ
list_files("tests")
โ
list_files("tools")
โ
Final repository tree4. File Explanation
User:
Explain agents/researcher.py in my Autonomous-research-agent repository.The agent uses:
read_fileThe file content is then provided to Qwen for analysis.
5. Code Search
User:
Where is Tavily used in my Autonomous-research-agent repository?The agent uses:
search_codeThe tool searches the repository and returns matching files and lines.
The LLM can then summarize the results.
๐งช Example Result
A query such as:
Where is Tavily used in my Autonomous-research-agent repository?can result in findings such as:
tools/web_search.py
config/settings.py
requirements.txt
agents/researcher.py
agents/report_generator.py
utils/retry.py
.env.example
README.mdThe LLM can then explain how Tavily is integrated and where it is consumed in the project.
๐งฐ Technologies
Python
The main programming language used to implement the application.
Model Context Protocol
MCP is used as the communication protocol between the AI application and the available tools.
Qwen
Qwen is used as the reasoning model responsible for understanding user requests and selecting tools.
Groq
Groq provides the API interface used to run the Qwen model.
GitHub REST API
GitHub's API provides repository information, files, and source-code data.
HTTPX
Used for asynchronous HTTP requests to the GitHub API.
python-dotenv
Used to load environment variables from the .env file.
asyncio
Used to run the asynchronous MCP and GitHub operations.
๐ฆ Installation
Prerequisites
Make sure you have:
Python 3.10+
A GitHub account
A GitHub Personal Access Token
A Groq API key
1. Clone the Repository
git clone https://github.com/Ibrahimhussein711/GitHub-MCP-server.gitMove into the project directory:
cd GitHub-MCP-server2. Create a Virtual Environment
On Windows:
python -m venv .venvActivate the environment:
.venv\Scripts\activate3. Install Dependencies
pip install -r requirements.txt๐ Configuration
Create a .env file in the project root:
GITHUB_TOKEN=your_github_token
GROQ_API_KEY=your_groq_api_keyGitHub Token
The GitHub token is used to authenticate requests to the GitHub REST API.
Groq API Key
The Groq API key is used to access the Qwen model through Groq.
โ ๏ธ Environment Variable Security
Never commit your .env file to GitHub.
The repository includes a .gitignore file that excludes:
.venv/
.env
__pycache__/
*.pycA safe .env.example file is included:
GITHUB_TOKEN=
GROQ_API_KEY=Users can copy this file and add their own credentials.
โถ๏ธ Running the Project
Make sure your virtual environment is activated.
From the project root, run:
python -m src.agentThe application will display:
Ask me something about your GitHub:You can then enter a natural-language request.
For example:
What repositories do I have?or:
Show me the structure of my Autonomous-research-agent repository.or:
Where is Tavily used in my Autonomous-research-agent repository?๐งช Testing
The project includes a lightweight MCP test client.
Run:
python -m src.test_clientThis test verifies that the MCP communication works correctly without involving the LLM.
The test confirms:
MCP Client
โ
MCP Server
โ
MCP Tool
โ
GitHub API
โ
Result๐ฌ MCP Communication
The application uses the MCP Python SDK.
The MCP server is started as a subprocess using:
StdioServerParameters(
command=sys.executable,
args=["-m", "src.server"],
)The client then connects to the server:
async with Client(server) as mcp_client:The client discovers the available tools:
tools_result = await mcp_client.list_tools()The discovered tools are then converted into the format expected by Groq.
๐ Tool Calling
The LLM receives the available tools as function definitions.
Each tool contains:
Name
Description
Input schema
For example:
get_repositorycan be represented to the LLM with a schema containing:
repo: stringWhen the LLM decides to use a tool, it generates a tool call.
The agent extracts:
tool name
tool arguments
tool call IDThe MCP client then executes the corresponding MCP tool.
๐งฑ Layered Architecture
The project follows a layered architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Agent Layer โ
โ agent.py โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ MCP Layer โ
โ server.py โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ Tool Layer โ
โ tools/repositories.py โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ GitHub API Layer โ
โ github_client.py โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ GitHub API โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโThis separation provides better maintainability and makes future extensions easier.
โก Design Decisions
Why MCP?
MCP provides a standardized interface for connecting AI applications with external tools and data sources.
Instead of tightly coupling the AI agent with GitHub-specific logic, GitHub operations are exposed through MCP tools.
This makes the system easier to extend.
Why Separate the GitHub Client?
The GitHub API implementation is isolated inside:
github_client.pyThis prevents GitHub-specific HTTP logic from being mixed with MCP logic.
The MCP server only needs to expose tools.
The GitHub client handles API communication.
Why Have a Tool Layer?
The file:
tools/repositories.pyacts as an abstraction between the MCP server and the GitHub client.
This makes it possible to change the GitHub implementation without heavily modifying the MCP server.
Why Use an Agent Loop?
A single tool call is not enough for complex repository questions.
For example:
Show me the repository structure.may require several calls:
list_files("")
list_files("agents")
list_files("config")
list_files("models")
list_files("tools")
...The agent loop allows the LLM to continue calling tools until it has enough information to answer.
๐ง Current Limitations
The current implementation is an MVP focused on GitHub repository exploration and code intelligence.
Some limitations include:
Large Repository Performance
The current search_code implementation retrieves the repository tree and reads files individually.
For very large repositories, this can result in many GitHub API requests.
GitHub Pagination
The current implementation is primarily designed for the current MVP workflow and does not provide a complete pagination abstraction for every GitHub endpoint.
Search Optimization
The current search implementation performs text matching across repository files.
It does not yet provide semantic code search or advanced ranking.
Repository Scope
The current tools focus mainly on:
Repositories
Files
File content
Code search
Other GitHub resources are not currently exposed as MCP tools.
๐ฎ Future Improvements
Potential future improvements include:
๐ณ Repository Tree Tool
Add a dedicated:
get_repository_treetool to retrieve repository structure more efficiently.
๐ Improved Code Search
Improve code search performance by:
Reducing GitHub API calls
Adding search ranking
Supporting GitHub's native code search
Adding semantic search
๐ง Semantic Code Intelligence
Add embeddings and vector search to allow queries such as:
Where is authentication implemented?even when the exact word "authentication" is not present.
๐๏ธ Architecture Analysis
Add tools that allow the agent to understand:
What are the main components of this project?Explain the architecture of this repository.๐ฆ Dependency Analysis
Analyze:
requirements.txt
package.json
pyproject.tomland explain project dependencies.
๐ Commit Analysis
Add tools for:
Commit history
Recent changes
Contributors
Changed files
๐ Pull Request Intelligence
Allow users to ask:
What changed in the latest pull request?Summarize this pull request.๐ Issue Intelligence
Add GitHub issue tools to support questions such as:
What are the open issues in this repository?๐พ Caching
Add caching to reduce repeated GitHub API requests and improve performance.
๐ Security
The project uses environment variables for sensitive credentials.
Credentials should never be hard-coded into source files.
Sensitive files are excluded through .gitignore:
.envThe GitHub token is only used for authenticated requests to the GitHub API.
Before publishing the project, always verify that no secrets have been committed.
You can check staged files using:
git status๐ฏ Learning Outcomes
This project demonstrates practical experience with:
Generative AI
Agentic AI
LLM tool calling
Function calling
Model Context Protocol
MCP Client / Server architecture
API integration
GitHub REST API
Asynchronous Python
Tool discovery
Multi-step agent loops
Structured tool schemas
Environment variable management
Modular software architecture
๐ What Makes This Project Different?
This is not simply a chatbot connected to GitHub.
The main goal is to demonstrate an agentic architecture.
The LLM is given access to multiple tools and is responsible for determining:
What information do I need?
โ
Which tool can provide it?
โ
What parameters should I provide?
โ
Do I need another tool?
โ
Do I have enough information?
โ
Generate the final answer.This makes the project a practical example of how LLMs can interact with external systems through a standardized tool protocol.
๐งช Verified Workflows
The current implementation has been tested with several workflows.
Repository Discovery
User Query
โ
Qwen
โ
get_my_repositories
โ
GitHub API
โ
Repository List
โ
Qwen
โ
Final AnswerRepository Information
User Query
โ
Qwen
โ
get_repository
โ
GitHub API
โ
Repository Details
โ
Qwen
โ
Final AnswerRepository Structure
User Query
โ
Qwen
โ
list_files
โ
More list_files calls
โ
Repository Structure
โ
Qwen
โ
Clean TreeFile Analysis
User Query
โ
Qwen
โ
read_file
โ
GitHub API
โ
File Content
โ
Qwen
โ
File ExplanationCode Search
User Query
โ
Qwen
โ
search_code
โ
Repository Files
โ
Matching Lines
โ
Qwen
โ
Code Search Summary๐ Project Status
MVP Completed and Functional โ
The current version successfully demonstrates an end-to-end agentic workflow:
User
โ
Qwen / Groq
โ
MCP Client
โ
MCP Server
โ
GitHub API
โ
MCP Client
โ
Qwen / Groq
โ
Natural Language AnswerThe project currently supports:
Repository discovery
Repository information
File exploration
File reading
Code searching
Automatic tool selection
Multi-step tool execution
Natural-language repository analysis
๐จโ๐ป Author
Ibrahim Hussein
Senior Electronics & Electrical Communication Engineering Student
Interests
Generative AI
Agentic AI
Machine Learning
RAG Systems
AI Automation
Software Engineering
Intelligent Systems
โญ Support
If you find this project useful or interesting, consider giving the repository a โญ on GitHub.
Repository:
https://github.com/Ibrahimhussein711/GitHub-MCP-server
๐ License
This project is intended for educational, experimental, and portfolio purposes.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
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
Access the GitHub API, enabling file operations, repository management, search functionality, andโฆ
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP โ built for coding agents.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Repo intel for AI coding agents: overview, PRs, contributors, hot files, CI, deps. Remote MCP.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to discover and interact with GitHub repositories through standardized MCP tools, allowing exploration and retrieval of project information without direct API calls.-
- AlicenseAqualityBmaintenanceEnables AI assistants to query GitHub repositories, issues, pull requests, CI status, and discover trending repos via natural language. Provides MCP tools, resources, and prompts for GitHub data access.14MIT
- FlicenseNot gradedqualityCmaintenanceExposes GitHub repository data via MCP tools, a resource, and a prompt, enabling repo summaries, issue/PR listing, keyword search, and repo health review.-
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with GitHub via MCP, managing repositories, issues, PRs, and analyzing repository health through tools like list_repositories, read_issues, create_issue, comment_on_pr, and analyze_repo_health.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Ibrahimhussein711/GitHub-MCP-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server