Purpose
GitMCP is designed to solve the common "code hallucination" problem in AI programming tools when generating code. It is a free, open-source remote MCP (Model Context Protocol) server that can turn any public GitHub project (including repositories and GitHub Pages sites) into a documentation hub accessible to AI assistants, enabling AI to obtain the latest project documentation and source code, even if the model has never encountered the project before.
Main Capabilities
- Retrieve documentation and code for any GitHub project: Provide AI assistants with the latest documentation and code examples for a project.
- Intelligent search: Built-in intelligent search capability can precisely find the required information in documentation and code, avoiding excessive token consumption.
- Reduce hallucinations: Generate answers based on real documentation and code, improving accuracy and code correctness.
- Embedded chat: Can chat directly with repository documentation in the browser for a quick start.
- Zero configuration, cloud-based operation: No download, installation, or registration required; simply add the GitMCP URL as an MCP server in your IDE.
- Open, free, privacy-preserving: Open source and completely free to use, does not collect personal information, does not store queries, and supports self-hosting.
How to Use
Step 1: Choose the server type
- For a specific GitHub repository:
gitmcp.io/{owner}/{repo} - For a GitHub Pages site:
{owner}.gitmcp.io/{repo} - Universal dynamic endpoint (can access any repository):
gitmcp.io/docs
Replace {owner} with the GitHub username or organization name, and{repo} with the repository name. You can also use the conversion tool on the landing page to convert a GitHub URL into an MCP URL.
Step 2: Connect the AI assistant
For example, with Cursor, configure it in ~/.cursor/mcp.json ; for Claude Desktop, go to Settings > Developer > Edit Config and use the following configuration:
{
"mcpServers": {
"gitmcp": {
"command": "npx",
"args": ["mcp-remote", "https://gitmcp.io/{owner}/{repo}"]
}
}
}
Other tools (Windsurf, VSCode, Cline, Highlight AI, Augment Code, Msty Studio, etc.) also provide corresponding configuration instructions.
How It Works
- The user provides the GitMCP URL to the AI assistant; 2. The user asks a question related to documentation or code; 3. With the user's approval, the AI sends a request to GitMCP; 4. GitMCP executes the request and returns data; 5. The AI generates a more accurate answer based on real data.
Available Tools
fetch_<repo-name>_documentation: Retrieve the repository's main documentation (such as llms.txt).search_<repo-name>_documentation: Perform intelligent search within the documentation.fetch_url_content: Retrieve the content of external links referenced in the documentation and convert it into an easy-to-read format.search_<repo-name>_code: Use GitHub code search to find code examples or implementation details in the repository. When using the dynamic endpoint (gitmcp.io/docs), the tool names arefetch_generic_documentation、search_generic_code、search_generic_documentation, and the target repository must also be specified.
Use Cases
- When using niche, newly released, or rapidly changing libraries, obtain the latest API usage and reliable code examples.
- When you need AI to answer questions based on specific repository documentation.
- Quickly understand project documentation through embedded chat.
Limitations and Notes
- GitMCP only accesses content that is already public, and only accesses it when the user queries, and does not automatically crawl repositories.
- Before accessing GitHub Pages sites, it checks robots.txt and follows the site owner's instructions.
- Does not permanently store project or content data.
- Currently, the documentation priority is: AI-optimized project documentation, README.md.
- This project is provided "as is" without any warranty; it is not affiliated with GitHub or the AI tools mentioned.
- Licensed under the Apache License 2.0.