Skip to main content
Glama
README.md
<p align="center">
  <img src="assets/logo.svg" alt="AI Context MCP" width="400"/>
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/ai-context-mcp"><img src="https://img.shields.io/npm/v/ai-context-mcp?style=flat-square&color=6366f1&label=npm" alt="npm version"/></a>
  <a href="https://www.npmjs.com/package/ai-context-mcp"><img src="https://img.shields.io/npm/dm/ai-context-mcp?style=flat-square&color=8b5cf6&label=downloads" alt="npm downloads"/></a>
  <a href="https://github.com/Prathmeshkunturwar/Context_Mcp/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="License"/></a>
  <a href="https://github.com/Prathmeshkunturwar/Context_Mcp/actions"><img src="https://img.shields.io/github/actions/workflow/status/Prathmeshkunturwar/Context_Mcp/ci.yml?style=flat-square&label=CI&color=22c55e" alt="CI"/></a>
  <a href="https://github.com/Prathmeshkunturwar/Context_Mcp/blob/main/TESTING.md"><img src="https://img.shields.io/badge/tests-39%20passing-22c55e?style=flat-square" alt="Tests"/></a>
  <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen?style=flat-square" alt="Node.js"/></a>
</p>

<p align="center">
  <strong>Give your LLM real-time, version-pinned documentation instead of hallucinated APIs.</strong><br/>
  An MCP server that injects live docs from <strong>57+ AI/ML libraries</strong> directly into Claude, Cursor, or any MCP-compatible client.
</p>

<p align="center">
  ๐Ÿšซ No outdated training data &nbsp;ยท&nbsp; โœ… Zero telemetry &nbsp;ยท&nbsp; ๐Ÿ“ฆ Fully local &nbsp;ยท&nbsp; โšก SQLite offline cache
</p>

---

## Table of Contents

- [Why AI Context MCP?](#why-ai-context-mcp)
- [Quick Start](#quick-start)
- [Setup](#setup)
- [Environment Variables](#environment-variables)
- [Tools Reference](#tools-reference)
- [Supported Libraries](#supported-libraries)
- [Architecture](#architecture)
- [Contributing](#contributing)
- [Troubleshooting](#troubleshooting)
- [License](#license)

---

## Why AI Context MCP?

LLMs are trained on static snapshots of the web. By the time you use Claude or Cursor, its knowledge of `langchain`, `openai`, `pytorch` etc. is already months out of date โ€” causing:

- โŒ Hallucinated function signatures that don't exist
- โŒ Deprecated patterns the model confidently recommends
- โŒ Silent breaking changes that crash your app at runtime

**AI Context MCP solves this** by fetching current docs and changelogs from GitHub at query time, ranking them semantically, and injecting them into the model's context window.

---

## Quick Start

**Option 1 โ€” NPM Global Install (recommended)**

```bash
npm install -g ai-context-mcp
```

**Option 2 โ€” Clone & Build**

```bash
git clone https://github.com/Prathmeshkunturwar/Context_Mcp.git
cd Context_Mcp
npm install && npm run build
```

---

## Setup

### Claude Code

Add to your project's `.mcp.json`:

```json
{
  "mcpServers": {
    "ai-context": {
      "command": "npx",
      "args": ["-y", "ai-context-mcp"],
      "env": { "GITHUB_TOKEN": "ghp_your_token_here" }
    }
  }
}
```

### Claude Desktop

Edit `claude_desktop_config.json`:

| OS | Path |
|---|---|
| **Windows** | `%APPDATA%\Claude\claude_desktop_config.json` |
| **macOS** | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| **Linux** | `~/.config/Claude/claude_desktop_config.json` |

```json
{
  "mcpServers": {
    "ai-context": {
      "command": "npx",
      "args": ["-y", "ai-context-mcp"],
      "env": { "GITHUB_TOKEN": "ghp_your_token_here" }
    }
  }
}
```

### Cursor / Other MCP Clients

```json
{
  "mcpServers": {
    "ai-context": {
      "command": "npx",
      "args": ["-y", "ai-context-mcp"],
      "env": { "GITHUB_TOKEN": "ghp_your_token_here" }
    }
  }
}
```

---

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `GITHUB_TOKEN` | **Recommended** | GitHub PAT. Without it: 60 req/hr. With it: 5,000/hr. [Create one](https://github.com/settings/tokens) (no scopes needed). |
| `TRANSPORT` | Optional | Set to `http` for Express HTTP server instead of stdio. |
| `CACHE_TTL_HOURS` | Optional | Cache TTL in hours (default: 24). |
| `PORT` | Optional | HTTP port when `TRANSPORT=http` (default: 3000). |

---

## Tools Reference

### `resolve-library-id`
Maps natural language to a registry library ID.
```
"LangChain JavaScript" โ†’ /langchain-ai/langchainjs
```

### `query-docs`
Fetches version-pinned documentation snippets, semantically ranked using MiniLM-L6.
```
query-docs(libraryId: "/openai/openai-python", query: "streaming", version: "1.0.0")
```

### `get-changelog-diff`
Extracts breaking changes and new features between two versions.
```
get-changelog-diff(libraryId: "/langchain-ai/langchainjs", fromVersion: "0.1.0", toVersion: "0.3.0")
โ†’ 7 BREAKING CHANGES, 12 NEW FEATURES
```

### `get-source-signature`
Extracts raw type/function/class signatures directly from source code.
```
get-source-signature(libraryId: "/langchain-ai/langchainjs", filePath: "...", entityName: "RunnableSequence")
```

### `detect-project-versions`
Scans your local `package.json` or `requirements.txt` to detect installed library versions.
```
detect-project-versions(projectPath: "./")
โ†’ { "langchain": "0.1.0", "@langchain/openai": "0.0.14" }
```

### `auto-migrate-codebase`
Analyzes your codebase against changelog breaking changes and generates migration alerts.
```
auto-migrate-codebase(libraryId: "...", projectPath: "./", fromVersion: "0.1.0", toVersion: "0.3.0")
```

### `suggest-skills`
Scans your project imports and recommends which libraries to look up.
```
suggest-skills(projectPath: "./") โ†’ ["/langchain-ai/langchainjs", "/openai/openai-node"]
```

---

## Supported Libraries

### ๐Ÿค– LLM Provider SDKs
`OpenAI Python` ยท `OpenAI Node.js` ยท `Anthropic Python` ยท `Anthropic TypeScript` ยท `Google Generative AI` ยท `Mistral AI` ยท `Cohere`

### ๐Ÿฆพ Agent Frameworks
`LangChain Python` ยท `LangChain.js` ยท `LangGraph` ยท `LlamaIndex` ยท `CrewAI` ยท `Pydantic AI` ยท `AutoGen` ยท `Letta (MemGPT)` ยท `Vercel AI SDK`

### ๐Ÿง  ML Frameworks
`PyTorch` ยท `HuggingFace Transformers` ยท `Diffusers` ยท `Accelerate` ยท `PEFT` ยท `Pydantic`

### โšก Inference Engines
`vLLM` ยท `llama.cpp` ยท `Ollama`

### ๐Ÿ—„๏ธ Vector Databases
`ChromaDB` ยท `Qdrant` ยท `Pinecone` ยท `Weaviate`

### ๐ŸŒ Web Frameworks
`React` ยท `Next.js` ยท `Vue` ยท `Nuxt` ยท `Svelte` ยท `SvelteKit` ยท `Express` ยท `Fastify` ยท `Hono`

### ๐Ÿ—ƒ๏ธ Database & ORM
`Prisma` ยท `Drizzle` ยท `TypeORM` ยท `Mongoose`

### ๐Ÿ”Œ API & Validation
`tRPC` ยท `Zod` ยท `Apollo Server`

### ๐Ÿงช Testing & Infrastructure
`Vitest` ยท `Playwright` ยท `Supabase JS` ยท `Firebase JS`

> **57 libraries and growing!** Run `npm run add-library` or [open a PR](CONTRIBUTING.md) to add yours.

---

## Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                MCP Client (Claude / Cursor)              โ”‚
โ”‚        resolve โ†’ query โ†’ changelog โ†’ signature           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚ MCP Protocol (stdio / http)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚               AI Context MCP Server                      โ”‚
โ”‚                                                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Registry  โ”‚  โ”‚  Fetcher   โ”‚  โ”‚ Semantic Ranker   โ”‚   โ”‚
โ”‚  โ”‚ (57 libs)  โ”‚  โ”‚ (GitHub +  โ”‚  โ”‚  (MiniLM-L6-v2)  โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  Cache)    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Changelog  โ”‚  โ”‚  Snippet   โ”‚  โ”‚  Source          โ”‚   โ”‚
โ”‚  โ”‚  Parser    โ”‚  โ”‚ Extractor  โ”‚  โ”‚  Signature       โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                          โ”‚
โ”‚      L1: In-Memory LRU  โ”‚  L2: SQLite (offline)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

---

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.

```bash
npm run dev          # ts-node with hot reload
npm test             # 39 Jest tests
npm run build        # Compile TypeScript
npm run add-library  # Interactive library adder
```

**Project structure:**
```
src/
โ”œโ”€โ”€ server.ts              # Entry point
โ”œโ”€โ”€ registry/libraries.json # Add libraries here
โ”œโ”€โ”€ sources/               # GitHub, NPM, PyPI, HuggingFace
โ”œโ”€โ”€ ranking/               # Semantic ranker + snippet extractor
โ”œโ”€โ”€ cache/                 # Two-tier LRU + SQLite cache
โ””โ”€โ”€ tools/                 # changelog, versions, migrate, suggest
```

---

## Troubleshooting

**"Cannot find module" on start**
```bash
npm run build
```

**GitHub 403 / rate limit errors**
Add `GITHUB_TOKEN` to your env โ€” [create a token](https://github.com/settings/tokens) with no extra scopes.

**Stale/outdated docs returned**
```bash
rm -f .cache/ai-context-cache.db
```

**First `npx` run hangs**
The MiniLM model downloads (~25MB) on first run. This is one-time only.

> More help in [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) ยท [Open an issue](https://github.com/Prathmeshkunturwar/Context_Mcp/issues)

---

## License

[MIT](LICENSE) ยฉ [Prathmesh Kunturwar](https://github.com/Prathmeshkunturwar)

---

<p align="center">
  <a href="https://github.com/Prathmeshkunturwar/Context_Mcp/issues">๐Ÿ› Report Bug</a> ยท
  <a href="https://github.com/Prathmeshkunturwar/Context_Mcp/issues">โœจ Request Feature</a> ยท
  <a href="CONTRIBUTING.md">๐Ÿค Contribute</a>
</p>
<p align="center">If this saves you time, please โญ the repo!</p>