Skip to main content
Glama

Cover

Context9 - Bring Live Doc into Your Agent Context

X · Discord · Issues

Apache 2.0 licensed MCP

简体中文 繁體中文 日本語 한국어 문서


https://github.com/user-attachments/assets/553ab8a2-5227-42fa-a8bd-692cd13c0b96

Why Context9?

  • 🎯 Up-to-date knowledge: Real-time knowledge synchronization and reduce AI agent hallucinations.

  • 🔐 Local-first: Fully open sourced and deploy on your own server, safely access your private knowledge.

  • ⚙️ Easy-to-use Web UI: Easily manage your repositories and API-key permissions through the Context9 Panel.

Related MCP server: OmniDocs MCP

What Context9 Actually Does

Context9 (Context Mine) is an MCP (Model Context Protocol) server. With local deployment, Context9 securely feeds agents with the most up-to-date documentation, reducing LLM hallucinations.

Install Context9

Run Context9 server

docker run -d \
    --name context9 \
    -p 8011:8011 \
    --restart unless-stopped \
    ghcr.io/prism-shadow/context9:latest \
    python -m context9.server --github_sync_interval 600

Or you can specify the port on which Context9 runs.

docker run -d \
    --name context9 \
    -e CONTEXT9_PORT=<port> \
    -p <port>:<port> \
    --restart unless-stopped \
    ghcr.io/prism-shadow/context9:latest \
    python -m context9.server --github_sync_interval 600

Configure Context9

Login to Context9

Visit http://<server_ip>:8011/ to login to Context9

  • Default username: ctx9-admin

  • Default password: 88888888

Remember to change the default password when you first log in to Context9.

login

Add repositories

Add the repositories you need in Context9 by filling in the repository owner, repository name, and branch.

  • For private repositories, you also need to provide a GitHub Token

Export & Import Repos using the Context9 template

  • Export Repos: You can click the Export Repos button to export the current repository configuration as a local template, making it easy to reuse later.

  • Import Repos: You can click the Import Repos button to import a Context9 template into your repository configuration. Context9 also provides several templates for reference and use.

repo

Add API Keys

Generate an API key that can be used to access Context9.

api_key

After generating the API key, you need to configure which repositories the API key is allowed to access.

key2repo

Test Context9 (Optional)

You can test your configured Context9 instance by simply entering the current Context9 Server IP and API key in the MCP Inspector.

inspector

Integrate Context9 with Agent

After deploying the Context9 service, you can seamlessly integrate both private and public real-time code documentation into your agents. You can connect to the Context9 MCP service using tools such as Cursor and Claude Code.

Install in Cursor

Go to: Settings ->Cursor Settings -> Tools & MCP -> Add a Custom MCP Server

Paste the configuration below into ~/.cursor/mcp.json. If you want to configure Context9 for a specific project only, create .cursor/mcp.json in the project directory and paste the configuration there.

{
  "mcpServers": {
    "Context9": {
      "url": "http://<server_ip>:8011/api/mcp/",
      "headers": {
        "Authorization": "Bearer <CTX9_API_KEY>"
      }
    }
  }
}

Install in Claude Code

Run the following command to add Context9 to Claude Code.

claude mcp add --transport http Context9 http://<server_ip>:8011/api/mcp/ --header "Authorization: Bearer <CTX9_API_KEY>"

Suggestions for Context9 Usage

To avoid adding extra prompts every time you use Context9, we recommend that you:

  • Use CLAUDE.md in Claude Code.

  • Use AGENTS.md for Cursor, CodeX and other agents.

  • Add rules in Cursor.

Use CLAUDE.md for Claude Code

Add a prompt to CLAUDE.md to enable Context9:

- Always retrieve required documentation via Context9

Use AGENT.md for Cursor, CodeX and other agents

Add rules to AGENTS.md, for example:

Rules:
- Always retrieve required documentation via Context9

Add Rule for Cursor

Go to: Setting -> Rules and Commands -> Add Rule

Rule example:

Always use Context9 MCP to obtain the necessary documentation, regardless of whether I explicitly ask for it.

Work with Context9

Set up entry documentation

To enable Context9 to correctly discover and index your repository documentation, each repository should provide a Spec document. By default, Context9 expects a file named spec.md at the root of the repository.

your-repo/
├── spec.md          ← Specification entry point
├── README.md
├── docs/
│   └── ...
└── ...

If you need to use a different filename or path, remember to update the repository configuration.

You do not need to think about MCP, indexing, or document resolution. Just maintain documentation links using normal repository-relative paths, exactly as you would for human readers.

Example in documentation.

## Related Documents
- [Detailed Guide](docs/detailed-guide.md)
- [API Reference](guides/api-reference.md)
- [FAQ](faq.md)

As long as these links are valid within the repository, Context9 will:

  • Discover the documents

  • Index them correctly

  • Make them available to AI agents in real time

Deploy Context9 from source

License

Licensed under the Apache License, version 2.0. See LICENSE for details.

Acknowledge

This repo benefits from context7. Thanks to the authors and contributors for their excellent work and inspiration.

⭐ Star History

Star History Chart

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Context7 MCP is a service that provides developers with the latest code documentation and examples. By integrating into the development environment, it ensures that the code generated by LLMS is based on the latest library documentation.
    Last updated
    2
    2
    Apache 2.0
  • F
    license
    -
    quality
    D
    maintenance
    An intelligent MCP server that enables AI agents to crawl, index, and semantically search official framework documentation using local RAG. It prevents hallucinations by providing precise, up-to-date documentation excerpts directly into the AI's context window.
    Last updated
    1
  • A
    license
    -
    quality
    B
    maintenance
    An MCP server that provides tools to fetch live, version-accurate documentation, changelogs, examples, and method signatures for npm and PyPI packages, preventing AI coding agents from hallucinating stale APIs.
    Last updated
    32
    ISC

View all related MCP servers

Related MCP Connectors

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

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

  • One shared context your team's AI tools read & write over MCP. No re-explaining. Free.

View all MCP Connectors

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/Prism-Shadow/context9'

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