#
tokens: 46620/50000 27/36 files (page 2/3)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 2 of 3. Use http://codebase.md/upstash/context7-mcp?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .github
│   ├── dependabot.yml
│   ├── ISSUE_TEMPLATE
│   │   ├── bug_report.yml
│   │   ├── documentation.yml
│   │   └── feature_request.yml
│   └── workflows
│       ├── check.yaml
│       ├── publish-mcp.yml
│       └── release.yml
├── .gitignore
├── bun.lock
├── Dockerfile
├── docs
│   ├── adding-projects.md
│   ├── README.ar.md
│   ├── README.de.md
│   ├── README.es.md
│   ├── README.fr.md
│   ├── README.id-ID.md
│   ├── README.it.md
│   ├── README.ja.md
│   ├── README.ko.md
│   ├── README.pt-BR.md
│   ├── README.ru.md
│   ├── README.tr.md
│   ├── README.uk.md
│   ├── README.vi.md
│   ├── README.zh-CN.md
│   └── README.zh-TW.md
├── eslint.config.js
├── gemini-extension.json
├── LICENSE
├── mcpb
│   ├── .mcpbignore
│   ├── context7.mcpb
│   └── manifest.json
├── package.json
├── prettier.config.mjs
├── public
│   ├── context7-icon-green.svg
│   ├── context7-icon.svg
│   ├── context7-logo.svg
│   ├── cover.png
│   └── icon.png
├── README.md
├── schema
│   └── context7.json
├── server.json
├── smithery.yaml
├── src
│   ├── index.ts
│   └── lib
│       ├── api.ts
│       ├── encryption.ts
│       ├── types.ts
│       └── utils.ts
└── tsconfig.json
```

# Files

--------------------------------------------------------------------------------
/docs/README.pt-BR.md:
--------------------------------------------------------------------------------

```markdown
   1 | # Context7 MCP - Documentação de Código Atualizada para Qualquer Prompt
   2 | 
   3 | [![Website](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![smithery badge](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp)
   4 | 
   5 | [<img alt="Instalar no Cursor" src="https://img.shields.io/badge/Instalar%20no%20CURSOR-000000?style=for-the-badge&logo=cursor&logoColor=white">](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D) [<img alt="Instalar no VS Code (npx)" src="https://img.shields.io/badge/Instalar%20no%20VS%20Code-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
   6 | 
   7 | [![Documentation in English](https://img.shields.io/badge/docs-English-purple)](../README.md) [![繁體中文](https://img.shields.io/badge/docs-繁體中文-yellow)](./README.zh-TW.md) [![简体中文](https://img.shields.io/badge/docs-简体中文-yellow)](./README.zh-CN.md) [![日本語](https://img.shields.io/badge/docs-日本語-b7003a)](./README.ja.md) [![한국어 문서](https://img.shields.io/badge/docs-한국어-green)](./README.ko.md) [![Documentación en Español](https://img.shields.io/badge/docs-Español-orange)](./README.es.md) [![Documentation en Français](https://img.shields.io/badge/docs-Français-blue)](./README.fr.md) [![Documentazione in italiano](https://img.shields.io/badge/docs-Italian-red)](./README.it.md) [![Dokumentasi Bahasa Indonesia](https://img.shields.io/badge/docs-Bahasa%20Indonesia-pink)](./README.id-ID.md) [![Dokumentation auf Deutsch](https://img.shields.io/badge/docs-Deutsch-darkgreen)](./README.de.md) [![Документация на русском языке](https://img.shields.io/badge/docs-Русский-darkblue)](./README.ru.md) [![Українська документація](https://img.shields.io/badge/docs-Українська-lightblue)](./README.uk.md) [![Türkçe Doküman](https://img.shields.io/badge/docs-Türkçe-blue)](./README.tr.md) [![Arabic Documentation](https://img.shields.io/badge/docs-Arabic-white)](./README.ar.md) [![Tiếng Việt](https://img.shields.io/badge/docs-Tiếng%20Việt-red)](./README.vi.md)
   8 | 
   9 | ## ❌ Sem o Context7
  10 | 
  11 | Os LLMs dependem de informações desatualizadas ou genéricas sobre as bibliotecas que você usa. Você obtém:
  12 | 
  13 | - ❌ Exemplos de código desatualizados e baseados em dados de treinamento de anos atrás
  14 | - ❌ APIs alucinadas que nem existem
  15 | - ❌ Respostas genéricas para versões antigas de pacotes
  16 | 
  17 | ## ✅ Com o Context7
  18 | 
  19 | O Context7 MCP extrai documentação e exemplos de código atualizados e específicos para cada versão diretamente da fonte — e os coloca diretamente em seu prompt.
  20 | 
  21 | Adicione `use context7` ao seu prompt no Cursor:
  22 | 
  23 | ```txt
  24 | Create a basic Next.js project with app router. use context7
  25 | ```
  26 | 
  27 | ```txt
  28 | Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7
  29 | ```
  30 | 
  31 | O Context7 busca exemplos de código e documentação atualizados diretamente para o contexto do seu LLM.
  32 | 
  33 | - 1️⃣ Escreva seu prompt naturalmente
  34 | - 2️⃣ Diga ao LLM `use context7`
  35 | - 3️⃣ Obtenha respostas com código funcional
  36 | 
  37 | Sem alternar entre abas, sem APIs alucinadas que não existem, sem gerações de código desatualizadas.
  38 | 
  39 | ## 📚 Adicionando Projetos
  40 | 
  41 | Confira nosso [guia de adição de projetos](./adding-projects.md) para aprender como adicionar (ou atualizar) suas bibliotecas favoritas ao Context7.
  42 | 
  43 | ## 🛠️ Instalação
  44 | 
  45 | ### Requisitos
  46 | 
  47 | - Node.js >= v18.0.0
  48 | - Cursor, Claude Code, VSCode, Windsurf ou outro Cliente MCP
  49 | 
  50 | <details>
  51 | <summary><b>Instalando via Smithery</b></summary>
  52 | 
  53 | Para instalar o Context7 MCP Server automaticamente em qualquer cliente via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
  54 | 
  55 | ```bash
  56 | npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
  57 | ```
  58 | 
  59 | Você pode encontrar sua chave Smithery na [página do Smithery.ai](https://smithery.ai/server/@upstash/context7-mcp).
  60 | 
  61 | </details>
  62 | 
  63 | <details>
  64 | <summary><b>Instalar no Cursor</b></summary>
  65 | 
  66 | Vá em: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
  67 | 
  68 | Colar a seguinte configuração no arquivo `~/.cursor/mcp.json` do Cursor é a abordagem recomendada. Você também pode instalar em um projeto específico criando `.cursor/mcp.json` na pasta do seu projeto. Veja mais em [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol).
  69 | 
  70 | > Desde o Cursor 1.0, você pode clicar no botão de instalar abaixo para uma instalação instantânea com um clique.
  71 | 
  72 | #### Conexão Remota do Servidor Cursor
  73 | 
  74 | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
  75 | 
  76 | ```json
  77 | {
  78 |   "mcpServers": {
  79 |     "context7": {
  80 |       "url": "https://mcp.context7.com/mcp"
  81 |     }
  82 |   }
  83 | }
  84 | ```
  85 | 
  86 | #### Conexão Local do Servidor Cursor
  87 | 
  88 | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
  89 | 
  90 | ```json
  91 | {
  92 |   "mcpServers": {
  93 |     "context7": {
  94 |       "command": "npx",
  95 |       "args": ["-y", "@upstash/context7-mcp"]
  96 |     }
  97 |   }
  98 | }
  99 | ```
 100 | 
 101 | </details>
 102 | 
 103 | <details>
 104 | <summary><b>Instalar no Claude Code</b></summary>
 105 | 
 106 | Execute este comando. Veja mais em [Claude Code MCP docs](https://docs.anthropic.com/pt/docs/claude-code/mcp).
 107 | 
 108 | #### Conexão Remota do Servidor Claude Code
 109 | 
 110 | ```sh
 111 | claude mcp add --transport http context7 https://mcp.context7.com/mcp
 112 | ```
 113 | 
 114 | #### Conexão Local do Servidor Claude Code
 115 | 
 116 | ```sh
 117 | claude mcp add context7 -- npx -y @upstash/context7-mcp
 118 | ```
 119 | 
 120 | </details>
 121 | 
 122 | <details>
 123 | <summary><b>Instalar no Windsurf</b></summary>
 124 | 
 125 | Adicione isto ao arquivo de configuração MCP do Windsurf. Veja mais em [Windsurf MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp).
 126 | 
 127 | #### Conexão Remota do Servidor Windsurf
 128 | 
 129 | ```json
 130 | {
 131 |   "mcpServers": {
 132 |     "context7": {
 133 |       "serverUrl": "https://mcp.context7.com/mcp"
 134 |     }
 135 |   }
 136 | }
 137 | ```
 138 | 
 139 | #### Conexão Local do Servidor Windsurf
 140 | 
 141 | ```json
 142 | {
 143 |   "mcpServers": {
 144 |     "context7": {
 145 |       "command": "npx",
 146 |       "args": ["-y", "@upstash/context7-mcp"]
 147 |     }
 148 |   }
 149 | }
 150 | ```
 151 | 
 152 | </details>
 153 | 
 154 | <details>
 155 | <summary><b>Instalar no VS Code</b></summary>
 156 | 
 157 | [<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
 158 | [<img alt="Install in VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
 159 | 
 160 | Adicione isto ao arquivo de configuração MCP do VS Code. Veja mais em [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).
 161 | 
 162 | #### Conexão Remota do Servidor VS Code
 163 | 
 164 | ```json
 165 | "mcp": {
 166 |   "servers": {
 167 |     "context7": {
 168 |       "type": "http",
 169 |       "url": "https://mcp.context7.com/mcp"
 170 |     }
 171 |   }
 172 | }
 173 | ```
 174 | 
 175 | #### Conexão Local do Servidor VS Code
 176 | 
 177 | ```json
 178 | "mcp": {
 179 |   "servers": {
 180 |     "context7": {
 181 |       "type": "stdio",
 182 |       "command": "npx",
 183 |       "args": ["-y", "@upstash/context7-mcp"]
 184 |     }
 185 |   }
 186 | }
 187 | ```
 188 | 
 189 | </details>
 190 | 
 191 | <details>
 192 | <summary>
 193 | <b>Instalar no Cline</b>
 194 | </summary>
 195 | 
 196 | Você pode instalar o Context7 facilmente pelo [Cline MCP Server Marketplace](https://cline.bot/mcp-marketplace) seguindo estas instruções:
 197 | 
 198 | 1. Abra o **Cline**.
 199 | 2. Clique no ícone de menu (☰) para entrar na seção **MCP Servers**.
 200 | 3. Use a barra de busca na aba **Marketplace** para encontrar _Context7_.
 201 | 4. Clique no botão **Install**.
 202 | 
 203 | </details>
 204 | 
 205 | <details>
 206 | <summary><b>Instalar no Zed</b></summary>
 207 | 
 208 | Pode ser instalado via [Zed Extensions](https://zed.dev/extensions?query=Context7) ou você pode adicionar isto ao seu `settings.json` do Zed. Veja mais em [Zed Context Server docs](https://zed.dev/docs/assistant/context-servers).
 209 | 
 210 | ```json
 211 | {
 212 |   "context_servers": {
 213 |     "Context7": {
 214 |       "command": {
 215 |         "path": "npx",
 216 |         "args": ["-y", "@upstash/context7-mcp"]
 217 |       },
 218 |       "settings": {}
 219 |     }
 220 |   }
 221 | }
 222 | ```
 223 | 
 224 | </details>
 225 | 
 226 | <details>
 227 | <summary><b>Instalar no Augment Code</b></summary>
 228 | 
 229 | Para configurar o Context7 MCP no Augment Code, você pode usar a interface gráfica ou a configuração manual.
 230 | 
 231 | ### **A. Usando a UI do Augment Code**
 232 | 
 233 | 1. Clique no menu hambúrguer.
 234 | 
 235 | 2. Selecione **Settings**.
 236 | 
 237 | 3. Navegue até a seção **Tools**.
 238 | 
 239 | 4. Clique no botão **+ Add MCP**.
 240 | 
 241 | 5. Insira o seguinte comando:
 242 | 
 243 |    ```
 244 |    npx -y @upstash/context7-mcp@latest
 245 |    ```
 246 | 
 247 | 6. Nomeie o MCP: **Context7**.
 248 | 
 249 | 7. Clique no botão **Add**.
 250 | 
 251 | Depois que o servidor MCP for adicionado, você pode começar a usar os recursos de documentação de código atualizada do Context7 diretamente no Augment Code.
 252 | 
 253 | ---
 254 | 
 255 | ### **B. Configuração Manual**
 256 | 
 257 | 1. Pressione Cmd/Ctrl Shift P ou vá ao menu hambúrguer no painel do Augment
 258 | 2. Selecione Edit Settings
 259 | 3. Em Advanced, clique em Edit em settings.json
 260 | 4. Adicione a configuração do servidor ao array `mcpServers` no objeto `augment.advanced`
 261 | 
 262 | ```json
 263 | "augment.advanced": {
 264 |   "mcpServers": [
 265 |     {
 266 |       "name": "context7",
 267 |       "command": "npx",
 268 |       "args": ["-y", "@upstash/context7-mcp"]
 269 |     }
 270 |   ]
 271 | }
 272 | ```
 273 | 
 274 | Depois de adicionar o servidor MCP, reinicie seu editor. Se você receber algum erro, verifique a sintaxe para garantir que colchetes ou vírgulas não estejam faltando.
 275 | 
 276 | </details>
 277 | 
 278 | <details>
 279 | <summary><b>Instalar no Roo Code</b></summary>
 280 | 
 281 | Adicione isto ao arquivo de configuração MCP do Roo Code. Veja mais em [Roo Code MCP docs](https://docs.roocode.com/features/mcp/using-mcp-in-roo).
 282 | 
 283 | #### Conexão Remota do Servidor Roo Code
 284 | 
 285 | ```json
 286 | {
 287 |   "mcpServers": {
 288 |     "context7": {
 289 |       "type": "streamable-http",
 290 |       "url": "https://mcp.context7.com/mcp"
 291 |     }
 292 |   }
 293 | }
 294 | ```
 295 | 
 296 | #### Conexão Local do Servidor Roo Code
 297 | 
 298 | ```json
 299 | {
 300 |   "mcpServers": {
 301 |     "context7": {
 302 |       "command": "npx",
 303 |       "args": ["-y", "@upstash/context7-mcp"]
 304 |     }
 305 |   }
 306 | }
 307 | ```
 308 | 
 309 | </details>
 310 | 
 311 | <details>
 312 | <summary><b>Instalar no Gemini CLI</b></summary>
 313 | 
 314 | Veja os detalhes em [Configuração do Gemini CLI](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html).
 315 | 
 316 | 1. Abra o arquivo de configurações do Gemini CLI. A localização é `~/.gemini/settings.json` (onde `~` é o seu diretório home).
 317 | 2. Adicione o seguinte ao objeto `mcpServers` no seu arquivo `settings.json`:
 318 | 
 319 | ```json
 320 | {
 321 |   "mcpServers": {
 322 |     "context7": {
 323 |       "httpUrl": "https://mcp.context7.com/mcp"
 324 |     }
 325 |   }
 326 | }
 327 | ```
 328 | 
 329 | Ou, para um servidor local:
 330 | 
 331 | ```json
 332 | {
 333 |   "mcpServers": {
 334 |     "context7": {
 335 |       "command": "npx",
 336 |       "args": ["-y", "@upstash/context7-mcp"]
 337 |     }
 338 |   }
 339 | }
 340 | ```
 341 | 
 342 | Se o objeto `mcpServers` não existir, crie-o.
 343 | 
 344 | </details>
 345 | 
 346 | <details>
 347 | <summary><b>Instalar no Claude Desktop</b></summary>
 348 | 
 349 | #### Conexão Remota
 350 | 
 351 | Abra o Claude Desktop e navegue até Settings > Connectors > Add Custom Connector. Insira o nome como `Context7` e a URL remota do MCP server como `https://mcp.context7.com/mcp`.
 352 | 
 353 | #### Conexão Local
 354 | 
 355 | Abra as configurações de desenvolvedor do Claude Desktop e edite seu arquivo `claude_desktop_config.json` para adicionar a seguinte configuração. Veja mais em [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user).
 356 | 
 357 | ```json
 358 | {
 359 |   "mcpServers": {
 360 |     "context7": {
 361 |       "command": "npx",
 362 |       "args": ["-y", "@upstash/context7-mcp"]
 363 |     }
 364 |   }
 365 | }
 366 | ```
 367 | 
 368 | </details>
 369 | 
 370 | <details>
 371 | <summary><b>Instalar no Opencode</b></summary>
 372 | 
 373 | Adicione isto ao arquivo de configuração do Opencode. Veja mais em [Opencode MCP docs](https://opencode.ai/docs/mcp-servers).
 374 | 
 375 | #### Conexão Remota do Opencode
 376 | 
 377 | ```json
 378 | "mcp": {
 379 |   "context7": {
 380 |     "type": "remote",
 381 |     "url": "https://mcp.context7.com/mcp",
 382 |     "enabled": true
 383 |   }
 384 | }
 385 | ```
 386 | 
 387 | #### Conexão Local do Opencode
 388 | 
 389 | ```json
 390 | {
 391 |   "mcp": {
 392 |     "context7": {
 393 |       "type": "local",
 394 |       "command": ["npx", "-y", "@upstash/context7-mcp"],
 395 |       "enabled": true
 396 |     }
 397 |   }
 398 | }
 399 | ```
 400 | 
 401 | </details>
 402 | <details>
 403 | <summary><b>Instalar no OpenAI Codex</b></summary>
 404 | 
 405 | Veja mais em [OpenAI Codex](https://github.com/openai/codex).
 406 | 
 407 | Adicione a seguinte configuração às definições do servidor MCP do OpenAI Codex:
 408 | 
 409 | #### Conexão de Servidor Local
 410 | 
 411 | ```toml
 412 | [mcp_servers.context7]
 413 | args = ["-y", "@upstash/context7-mcp"]
 414 | command = "npx"
 415 | ```
 416 | 
 417 | #### Conexão de Servidor Remoto
 418 | 
 419 | ```toml
 420 | [mcp_servers.context7]
 421 | url = "https://mcp.context7.com/mcp"
 422 | http_headers = { "CONTEXT7_API_KEY" = "YOUR_API_KEY" }
 423 | ```
 424 | 
 425 | </details>
 426 | 
 427 | <details>
 428 | <summary><b>Instalar no JetBrains AI Assistant</b></summary>
 429 | 
 430 | Veja mais detalhes na [Documentação do JetBrains AI Assistant](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html).
 431 | 
 432 | 1. Nos IDEs da JetBrains vá em `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`
 433 | 2. Clique em `+ Add`.
 434 | 3. Clique em `Command` no canto superior esquerdo do diálogo e selecione a opção As JSON na lista
 435 | 4. Adicione esta configuração e clique em `OK`
 436 | 
 437 | ```json
 438 | {
 439 |   "mcpServers": {
 440 |     "context7": {
 441 |       "command": "npx",
 442 |       "args": ["-y", "@upstash/context7-mcp"]
 443 |     }
 444 |   }
 445 | }
 446 | ```
 447 | 
 448 | 5. Clique em `Apply` para salvar as alterações.
 449 | 6. Da mesma forma, o context7 pode ser adicionado ao JetBrains Junie em `Settings` -> `Tools` -> `Junie` -> `MCP Settings`
 450 | 
 451 | </details>
 452 | 
 453 | <details>
 454 | 
 455 | <summary><b>Instalar no Kiro</b></summary>
 456 | 
 457 | Veja a [Documentação do Kiro Model Context Protocol](https://kiro.dev/docs/mcp/configuration/) para detalhes.
 458 | 
 459 | 1. Navegue até `Kiro` > `MCP Servers`
 460 | 2. Adicione um novo servidor MCP clicando no botão `+ Add`.
 461 | 3. Cole a configuração abaixo:
 462 | 
 463 | ```json
 464 | {
 465 |   "mcpServers": {
 466 |     "Context7": {
 467 |       "command": "npx",
 468 |       "args": ["-y", "@upstash/context7-mcp"],
 469 |       "env": {},
 470 |       "disabled": false,
 471 |       "autoApprove": []
 472 |     }
 473 |   }
 474 | }
 475 | ```
 476 | 
 477 | 4. Clique em `Save` para aplicar as alterações.
 478 | 
 479 | </details>
 480 | 
 481 | <details>
 482 | <summary><b>Instalar no Trae</b></summary>
 483 | 
 484 | Use o recurso Add manually e preencha as informações de configuração JSON para esse servidor MCP.
 485 | Para mais detalhes, visite a [documentação do Trae](https://docs.trae.ai/ide/model-context-protocol?_lang=en).
 486 | 
 487 | #### Conexão Remota do Servidor Trae
 488 | 
 489 | ```json
 490 | {
 491 |   "mcpServers": {
 492 |     "context7": {
 493 |       "url": "https://mcp.context7.com/mcp"
 494 |     }
 495 |   }
 496 | }
 497 | ```
 498 | 
 499 | #### Conexão Local do Servidor Trae
 500 | 
 501 | ```json
 502 | {
 503 |   "mcpServers": {
 504 |     "context7": {
 505 |       "command": "npx",
 506 |       "args": ["-y", "@upstash/context7-mcp"]
 507 |     }
 508 |   }
 509 | }
 510 | ```
 511 | 
 512 | </details>
 513 | 
 514 | <details>
 515 | <summary><b>Usando Bun ou Deno</b></summary>
 516 | 
 517 | Use estas alternativas para executar o servidor Context7 MCP local com outros runtimes. Esses exemplos funcionam para qualquer cliente que suporte iniciar um servidor MCP local via command + args.
 518 | 
 519 | #### Bun
 520 | 
 521 | ```json
 522 | {
 523 |   "mcpServers": {
 524 |     "context7": {
 525 |       "command": "bunx",
 526 |       "args": ["-y", "@upstash/context7-mcp"]
 527 |     }
 528 |   }
 529 | }
 530 | ```
 531 | 
 532 | #### Deno
 533 | 
 534 | ```json
 535 | {
 536 |   "mcpServers": {
 537 |     "context7": {
 538 |       "command": "deno",
 539 |       "args": [
 540 |         "run",
 541 |         "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION",
 542 |         "--allow-net",
 543 |         "npm:@upstash/context7-mcp"
 544 |       ]
 545 |     }
 546 |   }
 547 | }
 548 | ```
 549 | 
 550 | </details>
 551 | 
 552 | <details>
 553 | <summary><b>Usando Docker</b></summary>
 554 | 
 555 | Se preferir executar o servidor MCP em um contêiner Docker:
 556 | 
 557 | 1. **Crie a Imagem Docker:**
 558 | 
 559 |    Primeiro, crie um `Dockerfile` na raiz do projeto (ou onde preferir):
 560 | 
 561 |    <details>
 562 |    <summary>Clique para ver o conteúdo do Dockerfile</summary>
 563 | 
 564 |    ```Dockerfile
 565 |    FROM node:18-alpine
 566 | 
 567 |    WORKDIR /app
 568 | 
 569 |    # Instalar a versão mais recente globalmente
 570 |    RUN npm install -g @upstash/context7-mcp
 571 | 
 572 |    # Expor porta padrão se necessário (opcional, depende da interação do cliente MCP)
 573 |    # EXPOSE 3000
 574 | 
 575 |    # Comando padrão para rodar o servidor
 576 |    CMD ["context7-mcp"]
 577 |    ```
 578 | 
 579 |    </details>
 580 | 
 581 |    Em seguida, construa a imagem usando uma tag (por exemplo, `context7-mcp`). **Certifique-se de que o Docker Desktop (ou o daemon Docker) esteja em execução.** Execute o comando abaixo no mesmo diretório onde você salvou o `Dockerfile`:
 582 | 
 583 |    ```bash
 584 |    docker build -t context7-mcp .
 585 |    ```
 586 | 
 587 | 2. **Configure seu Cliente MCP:**
 588 | 
 589 |    Atualize a configuração do seu cliente MCP para usar o comando Docker.
 590 | 
 591 |    _Exemplo para um cline_mcp_settings.json:_
 592 | 
 593 |    ```json
 594 |    {
 595 |      "mcpServers": {
 596 |        "Сontext7": {
 597 |          "autoApprove": [],
 598 |          "disabled": false,
 599 |          "timeout": 60,
 600 |          "command": "docker",
 601 |          "args": ["run", "-i", "--rm", "context7-mcp"],
 602 |          "transportType": "stdio"
 603 |        }
 604 |      }
 605 |    }
 606 |    ```
 607 | 
 608 |    _Nota: Este é um exemplo de configuração. Consulte os exemplos específicos do seu cliente MCP (como Cursor, VS Code, etc.) anteriormente neste README para adaptar a estrutura (por exemplo, `mcpServers` vs `servers`). Além disso, garanta que o nome da imagem em `args` corresponda à tag usada durante o comando `docker build`._
 609 | 
 610 | </details>
 611 | 
 612 | <details>
 613 | <summary><b>Instalar Usando a Extensão Desktop</b></summary>
 614 | 
 615 | Instale o arquivo [context7.dxt](dxt/context7.dxt) na pasta dxt e adicione-o ao seu cliente. Para mais informações, confira a [documentação de desktop extensions](https://github.com/anthropics/dxt#desktop-extensions-dxt).
 616 | 
 617 | </details>
 618 | 
 619 | <details>
 620 | <summary><b>Instalar no Windows</b></summary>
 621 | 
 622 | A configuração no Windows é um pouco diferente em comparação ao Linux ou macOS (_`Cline` é usado no exemplo_). O mesmo princípio se aplica a outros editores; consulte a configuração de `command` e `args`.
 623 | 
 624 | ```json
 625 | {
 626 |   "mcpServers": {
 627 |     "github.com/upstash/context7-mcp": {
 628 |       "command": "cmd",
 629 |       "args": ["/c", "npx", "-y", "@upstash/context7-mcp"],
 630 |       "disabled": false,
 631 |       "autoApprove": []
 632 |     }
 633 |   }
 634 | }
 635 | ```
 636 | 
 637 | </details>
 638 | 
 639 | <details>
 640 | <summary><b>Instalar no Amazon Q Developer CLI</b></summary>
 641 | 
 642 | Adicione isto ao arquivo de configuração do Amazon Q Developer CLI. Veja mais em [documentação do Amazon Q Developer CLI](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html).
 643 | 
 644 | ```json
 645 | {
 646 |   "mcpServers": {
 647 |     "context7": {
 648 |       "command": "npx",
 649 |       "args": ["-y", "@upstash/context7-mcp"]
 650 |     }
 651 |   }
 652 | }
 653 | ```
 654 | 
 655 | </details>
 656 | 
 657 | <details>
 658 | <summary><b>Instalar no Warp</b></summary>
 659 | 
 660 | Veja mais em [Documentação do Warp Model Context Protocol](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server).
 661 | 
 662 | 1. Vá em `Settings` > `AI` > `Manage MCP servers`.
 663 | 2. Adicione um novo servidor MCP clicando no botão `+ Add`.
 664 | 3. Cole a configuração abaixo:
 665 | 
 666 | ```json
 667 | {
 668 |   "Context7": {
 669 |     "command": "npx",
 670 |     "args": ["-y", "@upstash/context7-mcp"],
 671 |     "env": {},
 672 |     "working_directory": null,
 673 |     "start_on_launch": true
 674 |   }
 675 | }
 676 | ```
 677 | 
 678 | 4. Clique em `Save` para aplicar as alterações.
 679 | 
 680 | </details>
 681 | 
 682 | <details>
 683 | 
 684 | <summary><b>Instalar no Copilot Coding Agent</b></summary>
 685 | 
 686 | ## Usando o Context7 com o Copilot Coding Agent
 687 | 
 688 | Adicione a seguinte configuração à seção `mcp` do arquivo de configuração do seu Copilot Coding Agent Repository->Settings->Copilot->Coding agent->MCP configuration:
 689 | 
 690 | ```json
 691 | {
 692 |   "mcpServers": {
 693 |     "context7": {
 694 |       "type": "http",
 695 |       "url": "https://mcp.context7.com/mcp",
 696 |       "tools": ["get-library-docs", "resolve-library-id"]
 697 |     }
 698 |   }
 699 | }
 700 | ```
 701 | 
 702 | Para mais informações, veja a [documentação oficial do GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp).
 703 | 
 704 | </details>
 705 | 
 706 | <details>
 707 | <summary><b>Instalar no Copilot CLI</b></summary>
 708 | 
 709 | 1.  Abra o arquivo de configuração MCP do Copilot CLI. A localização é `~/.copilot/mcp-config.json` (onde `~` é o seu diretório home).
 710 | 2.  Adicione o seguinte ao objeto `mcpServers` no seu arquivo `mcp-config.json`:
 711 | 
 712 | ```json
 713 | {
 714 |   "mcpServers": {
 715 |     "context7": {
 716 |       "type": "http",
 717 |       "url": "https://mcp.context7.com/mcp",
 718 |       "headers": {
 719 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 720 |       },
 721 |       "tools": [
 722 |         "get-library-docs", 
 723 |         "resolve-library-id"
 724 |       ]
 725 |     }
 726 |   }
 727 | }
 728 | ```
 729 | 
 730 | Ou, para um servidor local:
 731 | 
 732 | ```json
 733 | {
 734 |   "mcpServers": {
 735 |     "context7": {
 736 |       "type": "local",
 737 |       "command": "npx",
 738 |       "tools": [
 739 |         "get-library-docs", 
 740 |         "resolve-library-id"
 741 |       ],
 742 |       "args": [
 743 |         "-y",
 744 |         "@upstash/context7-mcp",
 745 |         "--api-key",
 746 |         "YOUR_API_KEY"
 747 |       ]
 748 |     }
 749 |   }
 750 | }
 751 | ```
 752 | 
 753 | Se o arquivo `mcp-config.json` não existir, crie-o.
 754 | 
 755 | </details>
 756 | 
 757 | <details>
 758 | <summary><b>Instalar no LM Studio</b></summary>
 759 | 
 760 | Veja mais em [Suporte a MCP no LM Studio](https://lmstudio.ai/blog/lmstudio-v0.3.17).
 761 | 
 762 | #### Instalação com um clique:
 763 | 
 764 | [![Add MCP Server context7 to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJdfQ%3D%3D)
 765 | 
 766 | #### Configuração manual:
 767 | 
 768 | 1. Navegue até `Program` (lado direito) > `Install` > `Edit mcp.json`.
 769 | 2. Cole a configuração abaixo:
 770 | 
 771 | ```json
 772 | {
 773 |   "mcpServers": {
 774 |     "Context7": {
 775 |       "command": "npx",
 776 |       "args": ["-y", "@upstash/context7-mcp"]
 777 |     }
 778 |   }
 779 | }
 780 | ```
 781 | 
 782 | 3. Clique em `Save` para aplicar as alterações.
 783 | 4. Ative/desative o servidor MCP no lado direito, em `Program`, ou clicando no ícone de plug na parte inferior da caixa de chat.
 784 | 
 785 | </details>
 786 | 
 787 | <details>
 788 | <summary><b>Instalar no Visual Studio 2022</b></summary>
 789 | 
 790 | Você pode configurar o Context7 MCP no Visual Studio 2022 seguindo a [documentação de MCP Servers do Visual Studio](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
 791 | 
 792 | Adicione isto ao arquivo de configuração MCP do Visual Studio (veja os [docs do Visual Studio](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) para detalhes):
 793 | 
 794 | ```json
 795 | {
 796 |   "mcp": {
 797 |     "servers": {
 798 |       "context7": {
 799 |         "type": "http",
 800 |         "url": "https://mcp.context7.com/mcp"
 801 |       }
 802 |     }
 803 |   }
 804 | }
 805 | ```
 806 | 
 807 | Ou, para um servidor local:
 808 | 
 809 | ```json
 810 | {
 811 |   "mcp": {
 812 |     "servers": {
 813 |       "context7": {
 814 |         "type": "stdio",
 815 |         "command": "npx",
 816 |         "args": ["-y", "@upstash/context7-mcp"]
 817 |       }
 818 |     }
 819 |   }
 820 | }
 821 | ```
 822 | 
 823 | Para mais informações e solução de problemas, consulte a [documentação de MCP Servers do Visual Studio](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
 824 | 
 825 | </details>
 826 | 
 827 | <details>
 828 | <summary><b>Instalar no Crush</b></summary>
 829 | 
 830 | Adicione isto ao arquivo de configuração do Crush. Veja mais em [Crush MCP docs](https://github.com/charmbracelet/crush#mcps).
 831 | 
 832 | #### Conexão Remota do Crush
 833 | 
 834 | ```json
 835 | {
 836 |   "$schema": "https://charm.land/crush.json",
 837 |   "mcp": {
 838 |     "context7": {
 839 |       "type": "http",
 840 |       "url": "https://mcp.context7.com/mcp"
 841 |     }
 842 |   }
 843 | }
 844 | ```
 845 | 
 846 | #### Conexão Local do Crush
 847 | 
 848 | ```json
 849 | {
 850 |   "$schema": "https://charm.land/crush.json",
 851 |   "mcp": {
 852 |     "context7": {
 853 |       "type": "stdio",
 854 |       "command": "npx",
 855 |       "args": ["-y", "@upstash/context7-mcp"]
 856 |     }
 857 |   }
 858 | }
 859 | ```
 860 | 
 861 | </details>
 862 | 
 863 | <details>
 864 | <summary><b>Instalar no BoltAI</b></summary>
 865 | 
 866 | Abra a página "Settings" do app, navegue até "Plugins" e insira o seguinte JSON:
 867 | 
 868 | ```json
 869 | {
 870 |   "mcpServers": {
 871 |     "context7": {
 872 |       "command": "npx",
 873 |       "args": ["-y", "@upstash/context7-mcp"]
 874 |     }
 875 |   }
 876 | }
 877 | ```
 878 | 
 879 | Depois de salvar, digite no chat `get-library-docs` seguido do seu Context7 documentation ID (por exemplo, `get-library-docs /nuxt/ui`). Mais informações em [BoltAI's Documentation site](https://docs.boltai.com/docs/plugins/mcp-servers). Para o BoltAI no iOS, [veja este guia](https://docs.boltai.com/docs/boltai-mobile/mcp-servers).
 880 | 
 881 | </details>
 882 | 
 883 | <details>
 884 | <summary><b>Instalar no Rovo Dev CLI</b></summary>
 885 | 
 886 | Edite sua configuração MCP do Rovo Dev CLI executando o comando abaixo -
 887 | 
 888 | ```bash
 889 | acli rovodev mcp
 890 | ```
 891 | 
 892 | Configuração de exemplo -
 893 | 
 894 | #### Conexão Remota
 895 | 
 896 | ```json
 897 | {
 898 |   "mcpServers": {
 899 |     "context7": {
 900 |       "url": "https://mcp.context7.com/mcp"
 901 |     }
 902 |   }
 903 | }
 904 | ```
 905 | 
 906 | #### Conexão Local
 907 | 
 908 | ```json
 909 | {
 910 |   "mcpServers": {
 911 |     "context7": {
 912 |       "command": "npx",
 913 |       "args": ["-y", "@upstash/context7-mcp"]
 914 |     }
 915 |   }
 916 | }
 917 | ```
 918 | 
 919 | </details>
 920 | 
 921 | <details>
 922 | <summary><b>Instalar no Zencoder</b></summary>
 923 | 
 924 | Para configurar o Context7 MCP no Zencoder, siga estes passos:
 925 | 
 926 | 1. Vá ao menu do Zencoder (...)
 927 | 2. No menu suspenso, selecione Agent tools
 928 | 3. Clique em Add custom MCP
 929 | 4. Adicione o nome e a configuração do servidor abaixo e certifique-se de clicar no botão Install
 930 | 
 931 | ```json
 932 | {
 933 |   "command": "npx",
 934 |   "args": ["-y", "@upstash/context7-mcp"]
 935 | }
 936 | ```
 937 | 
 938 | Depois que o servidor MCP for adicionado, você pode continuar usando-o facilmente.
 939 | 
 940 | </details>
 941 | 
 942 | <details>
 943 | <summary><b>Instalar no Qodo Gen</b></summary>
 944 | 
 945 | Veja mais em [docs do Qodo Gen](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps).
 946 | 
 947 | 1. Abra o painel de chat do Qodo Gen no VSCode ou IntelliJ.
 948 | 2. Clique em Connect more tools.
 949 | 3. Clique em + Add new MCP.
 950 | 4. Adicione a seguinte configuração:
 951 | 
 952 | #### Conexão Local do Qodo Gen
 953 | 
 954 | ```json
 955 | {
 956 |   "mcpServers": {
 957 |     "context7": {
 958 |       "command": "npx",
 959 |       "args": ["-y", "@upstash/context7-mcp"]
 960 |     }
 961 |   }
 962 | }
 963 | ```
 964 | 
 965 | #### Conexão Remota do Qodo Gen
 966 | 
 967 | ```json
 968 | {
 969 |   "mcpServers": {
 970 |     "context7": {
 971 |       "url": "https://mcp.context7.com/mcp"
 972 |     }
 973 |   }
 974 | }
 975 | ```
 976 | 
 977 | </details>
 978 | 
 979 | <details>
 980 | <summary><b>Instalar no Perplexity Desktop</b></summary>
 981 | 
 982 | Veja mais em [Local and Remote MCPs for Perplexity](https://www.perplexity.ai/help-center/en/articles/11502712-local-and-remote-mcps-for-perplexity).
 983 | 
 984 | 1. Vá em `Perplexity` > `Settings`
 985 | 2. Selecione `Connectors`.
 986 | 3. Clique em `Add Connector`.
 987 | 4. Selecione `Advanced`.
 988 | 5. Insira Server Name: `Context7`
 989 | 6. Cole o seguinte JSON na área de texto:
 990 | 
 991 | ```json
 992 | {
 993 |   "args": ["-y", "@upstash/context7-mcp"],
 994 |   "command": "npx",
 995 |   "env": {}
 996 | }
 997 | ```
 998 | 
 999 | 7. Clique em `Save`.
1000 | 
1001 | </details>
1002 | 
1003 | ## 🔨 Ferramentas Disponíveis
1004 | 
1005 | O Context7 MCP fornece as seguintes ferramentas que LLMs podem usar:
1006 | 
1007 | - `resolve-library-id`: Resolve um nome geral de biblioteca em um ID compatível com o Context7.
1008 |   - `libraryName` (obrigatório): O nome da biblioteca a ser pesquisada
1009 | 
1010 | - `get-library-docs`: Busca documentação para uma biblioteca usando um ID compatível com o Context7.
1011 |   - `context7CompatibleLibraryID` (obrigatório): ID exato compatível com Context7 (por exemplo, `/mongodb/docs`, `/vercel/next.js`)
1012 |   - `topic` (opcional): Focar os docs em um tópico específico (por exemplo, "routing", "hooks")
1013 |   - `tokens` (opcional, padrão 10000): Número máximo de tokens para retornar. Valores menores que o padrão de 10000 são automaticamente aumentados para 10000.
1014 | 
1015 | ## 🛟 Dicas
1016 | 
1017 | ### Adicionar uma Regra
1018 | 
1019 | > Se você não quiser adicionar `use context7` a todo prompt, você pode definir uma regra simples no seu arquivo `.windsurfrules` no Windsurf ou em `Cursor Settings > Rules` no Cursor (ou equivalente no seu cliente MCP) para invocar o Context7 automaticamente em qualquer questão de código:
1020 | >
1021 | > ```toml
1022 | > [[calls]]
1023 | > match = "quando o usuário solicitar exemplos de código, passos de configuração ou documentação de biblioteca/API"
1024 | > tool  = "context7"
1025 | > ```
1026 | >
1027 | > A partir daí você receberá os docs do Context7 em qualquer conversa relacionada sem digitar nada extra. Você pode adicionar seus casos de uso na parte match.
1028 | 
1029 | ### Usar o ID da Biblioteca
1030 | 
1031 | > Se você já sabe exatamente qual biblioteca deseja usar, adicione o ID do Context7 ao seu prompt. Assim, o servidor MCP do Context7 pode pular a etapa de correspondência de biblioteca e ir direto para recuperar os docs.
1032 | >
1033 | > ```txt
1034 | > implementar autenticação básica com supabase. use library /supabase/supabase para api e docs
1035 | > ```
1036 | >
1037 | > A sintaxe com barra informa à ferramenta MCP exatamente qual biblioteca carregar.
1038 | 
1039 | ## 💻 Desenvolvimento
1040 | 
1041 | Clone o projeto e instale as dependências:
1042 | 
1043 | ```bash
1044 | bun i
1045 | ```
1046 | 
1047 | Build:
1048 | 
1049 | ```bash
1050 | bun run build
1051 | ```
1052 | 
1053 | Execute o servidor:
1054 | 
1055 | ```bash
1056 | bun run dist/index.js
1057 | ```
1058 | 
1059 | ### Argumentos de CLI
1060 | 
1061 | `context7-mcp` aceita as seguintes flags de CLI:
1062 | 
1063 | - `--transport <stdio|http>` – Transporte a ser usado (`stdio` por padrão). Use `http` para servidor HTTP remoto ou `stdio` para integração local.
1064 | - `--port <number>` – Porta para escutar ao usar o transporte `http` (padrão `3000`).
1065 | 
1066 | Exemplo com transporte http e porta 8080:
1067 | 
1068 | ```bash
1069 | bun run dist/index.js --transport http --port 8080
1070 | ```
1071 | 
1072 | Outro exemplo com transporte stdio:
1073 | 
1074 | ```bash
1075 | bun run dist/index.js --transport stdio
1076 | ```
1077 | 
1078 | <details>
1079 | <summary><b>Exemplo de Configuração Local</b></summary>
1080 | 
1081 | ```json
1082 | {
1083 |   "mcpServers": {
1084 |     "context7": {
1085 |       "command": "npx",
1086 |       "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
1087 |     }
1088 |   }
1089 | }
1090 | ```
1091 | 
1092 | </details>
1093 | 
1094 | <details>
1095 | <summary><b>Testando com o MCP Inspector</b></summary>
1096 | 
1097 | ```bash
1098 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
1099 | ```
1100 | 
1101 | </details>
1102 | 
1103 | ## 🚨 Solução de Problemas
1104 | 
1105 | <details>
1106 | <summary><b>Erros de Módulo Não Encontrado</b></summary>
1107 | 
1108 | Se você encontrar `ERR_MODULE_NOT_FOUND`, tente usar `bunx` em vez de `npx`:
1109 | 
1110 | ```json
1111 | {
1112 |   "mcpServers": {
1113 |     "context7": {
1114 |       "command": "bunx",
1115 |       "args": ["-y", "@upstash/context7-mcp"]
1116 |     }
1117 |   }
1118 | }
1119 | ```
1120 | 
1121 | Isso frequentemente resolve problemas de resolução de módulos em ambientes onde o `npx` não instala ou resolve os pacotes corretamente.
1122 | 
1123 | </details>
1124 | 
1125 | <details>
1126 | <summary><b>Problemas de Resolução ESM</b></summary>
1127 | 
1128 | Para erros como `Error: Cannot find module 'uriTemplate.js'`, tente a flag `--experimental-vm-modules`:
1129 | 
1130 | ```json
1131 | {
1132 |   "mcpServers": {
1133 |     "context7": {
1134 |       "command": "npx",
1135 |       "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/[email protected]"]
1136 |     }
1137 |   }
1138 | }
1139 | ```
1140 | 
1141 | </details>
1142 | 
1143 | <details>
1144 | <summary><b>Problemas de TLS/Certificados</b></summary>
1145 | 
1146 | Use a flag `--experimental-fetch` para contornar problemas relacionados a TLS:
1147 | 
1148 | ```json
1149 | {
1150 |   "mcpServers": {
1151 |     "context7": {
1152 |       "command": "npx",
1153 |       "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
1154 |     }
1155 |   }
1156 | }
1157 | ```
1158 | 
1159 | </details>
1160 | 
1161 | <details>
1162 | <summary><b>Erros Gerais do Cliente MCP</b></summary>
1163 | 
1164 | 1. Tente adicionar `@latest` ao nome do pacote
1165 | 2. Use `bunx` como alternativa ao `npx`
1166 | 3. Considere usar `deno` como outra alternativa
1167 | 4. Certifique-se de estar usando Node.js v18 ou superior para suporte nativo a fetch
1168 | 
1169 | </details>
1170 | 
1171 | ## ⚠️ Aviso
1172 | 
1173 | Os projetos do Context7 são contribuídos pela comunidade e, embora nos esforcemos para manter alta qualidade, não podemos garantir a precisão, integridade ou segurança de toda a documentação de bibliotecas. Os projetos listados no Context7 são desenvolvidos e mantidos por seus respectivos proprietários, não pelo Context7. Se você encontrar qualquer conteúdo suspeito, impróprio ou potencialmente prejudicial, use o botão "Report" na página do projeto para nos notificar imediatamente. Levamos todos os relatos a sério e revisaremos o conteúdo sinalizado prontamente para manter a integridade e a segurança de nossa plataforma. Ao usar o Context7, você reconhece que o faz por sua própria conta e risco.
1174 | 
1175 | ## 🤝 Conecte-se Conosco
1176 | 
1177 | Mantenha-se atualizado e junte-se à nossa comunidade:
1178 | 
1179 | - 📢 Siga-nos no [X](https://x.com/context7ai) para as últimas notícias e atualizações
1180 | - 🌐 Visite nosso [Website](https://context7.com)
1181 | - 💬 Junte-se ao nosso [Discord Community](https://upstash.com/discord)
1182 | 
1183 | ## 📺 Context7 na Mídia
1184 | 
1185 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
1186 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
1187 | - [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
1188 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
1189 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
1190 | - [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
1191 | - [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
1192 | - [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
1193 | 
1194 | ## ⭐ Histórico de Stars
1195 | 
1196 | [![Gráfico de Histórico de Stars](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
1197 | 
1198 | ## 📄 Licença
1199 | 
1200 | MIT
1201 | 
```

--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------

```markdown
   1 | ![Cover](public/cover.png)
   2 | 
   3 | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D) [<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/Install%20in%20VS%20Code-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
   4 | 
   5 | # Context7 MCP - Up-to-date Code Docs For Any Prompt
   6 | 
   7 | [![Website](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![smithery badge](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp) [![NPM Version](https://img.shields.io/npm/v/%40upstash%2Fcontext7-mcp?color=red)](https://www.npmjs.com/package/@upstash/context7-mcp) [![MIT licensed](https://img.shields.io/npm/l/%40upstash%2Fcontext7-mcp)](./LICENSE)
   8 | 
   9 | [![繁體中文](https://img.shields.io/badge/docs-繁體中文-yellow)](./docs/README.zh-TW.md) [![简体中文](https://img.shields.io/badge/docs-简体中文-yellow)](./docs/README.zh-CN.md) [![日本語](https://img.shields.io/badge/docs-日本語-b7003a)](./docs/README.ja.md) [![한국어 문서](https://img.shields.io/badge/docs-한국어-green)](./docs/README.ko.md) [![Documentación en Español](https://img.shields.io/badge/docs-Español-orange)](./docs/README.es.md) [![Documentation en Français](https://img.shields.io/badge/docs-Français-blue)](./docs/README.fr.md) [![Documentação em Português (Brasil)](<https://img.shields.io/badge/docs-Português%20(Brasil)-purple>)](./docs/README.pt-BR.md) [![Documentazione in italiano](https://img.shields.io/badge/docs-Italian-red)](./docs/README.it.md) [![Dokumentasi Bahasa Indonesia](https://img.shields.io/badge/docs-Bahasa%20Indonesia-pink)](./docs/README.id-ID.md) [![Dokumentation auf Deutsch](https://img.shields.io/badge/docs-Deutsch-darkgreen)](./docs/README.de.md) [![Документация на русском языке](https://img.shields.io/badge/docs-Русский-darkblue)](./docs/README.ru.md) [![Українська документація](https://img.shields.io/badge/docs-Українська-lightblue)](./docs/README.uk.md) [![Türkçe Doküman](https://img.shields.io/badge/docs-Türkçe-blue)](./docs/README.tr.md) [![Arabic Documentation](https://img.shields.io/badge/docs-Arabic-white)](./docs/README.ar.md) [![Tiếng Việt](https://img.shields.io/badge/docs-Tiếng%20Việt-red)](./docs/README.vi.md)
  10 | 
  11 | ## ❌ Without Context7
  12 | 
  13 | LLMs rely on outdated or generic information about the libraries you use. You get:
  14 | 
  15 | - ❌ Code examples are outdated and based on year-old training data
  16 | - ❌ Hallucinated APIs that don't even exist
  17 | - ❌ Generic answers for old package versions
  18 | 
  19 | ## ✅ With Context7
  20 | 
  21 | Context7 MCP pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.
  22 | 
  23 | Add `use context7` to your prompt in Cursor:
  24 | 
  25 | ```txt
  26 | Create a Next.js middleware that checks for a valid JWT in cookies and redirects unauthenticated users to `/login`. use context7
  27 | ```
  28 | 
  29 | ```txt
  30 | Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7
  31 | ```
  32 | 
  33 | Context7 fetches up-to-date code examples and documentation right into your LLM's context.
  34 | 
  35 | - 1️⃣ Write your prompt naturally
  36 | - 2️⃣ Tell the LLM to `use context7`
  37 | - 3️⃣ Get working code answers
  38 | 
  39 | No tab-switching, no hallucinated APIs that don't exist, no outdated code generation.
  40 | 
  41 | > [!NOTE]
  42 | > This repository hosts the source code of Context7 MCP server. The supporting components — API backend, parsing engine, and crawling engine — are private and not part of this release.
  43 | 
  44 | ## 📚 Adding Projects
  45 | 
  46 | Check out our [project addition guide](./docs/adding-projects.md) to learn how to add (or update) your favorite libraries to Context7.
  47 | 
  48 | ## 🛠️ Installation
  49 | 
  50 | ### Requirements
  51 | 
  52 | - Node.js >= v18.0.0
  53 | - Cursor, Claude Code, VSCode, Windsurf or another MCP Client
  54 | - Context7 API Key (Optional) for higher rate limits and private repositories (Get yours by creating an account at [context7.com/dashboard](https://context7.com/dashboard))
  55 | 
  56 | <details>
  57 | <summary><b>Installing via Smithery</b></summary>
  58 | 
  59 | To install Context7 MCP Server for any client automatically via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
  60 | 
  61 | ```bash
  62 | npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
  63 | ```
  64 | 
  65 | You can find your Smithery key in the [Smithery.ai webpage](https://smithery.ai/server/@upstash/context7-mcp).
  66 | 
  67 | </details>
  68 | 
  69 | <details>
  70 | <summary><b>Install in Cursor</b></summary>
  71 | 
  72 | Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
  73 | 
  74 | Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file is the recommended approach. You may also install in a specific project by creating `.cursor/mcp.json` in your project folder. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
  75 | 
  76 | > Since Cursor 1.0, you can click the install button below for instant one-click installation.
  77 | 
  78 | #### Cursor Remote Server Connection
  79 | 
  80 | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
  81 | 
  82 | ```json
  83 | {
  84 |   "mcpServers": {
  85 |     "context7": {
  86 |       "url": "https://mcp.context7.com/mcp",
  87 |       "headers": {
  88 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
  89 |       }
  90 |     }
  91 |   }
  92 | }
  93 | ```
  94 | 
  95 | #### Cursor Local Server Connection
  96 | 
  97 | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
  98 | 
  99 | ```json
 100 | {
 101 |   "mcpServers": {
 102 |     "context7": {
 103 |       "command": "npx",
 104 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 105 |     }
 106 |   }
 107 | }
 108 | ```
 109 | 
 110 | </details>
 111 | 
 112 | <details>
 113 | <summary><b>Install in Claude Code</b></summary>
 114 | 
 115 | Run this command. See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp) for more info.
 116 | 
 117 | #### Claude Code Remote Server Connection
 118 | 
 119 | ```sh
 120 | claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY"
 121 | ```
 122 | 
 123 | #### Claude Code Local Server Connection
 124 | 
 125 | ```sh
 126 | claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
 127 | ```
 128 | 
 129 | </details>
 130 | 
 131 | <details>
 132 | <summary><b>Install in Amp</b></summary>
 133 | 
 134 | Run this command in your terminal. See [Amp MCP docs](https://ampcode.com/manual#mcp) for more info.
 135 | 
 136 | #### Without API Key (Basic Usage)
 137 | 
 138 | ```sh
 139 | amp mcp add context7 https://mcp.context7.com/mcp
 140 | ```
 141 | 
 142 | #### With API Key (Higher Rate Limits & Private Repos)
 143 | 
 144 | ```sh
 145 | amp mcp add context7 --header "CONTEXT7_API_KEY=YOUR_API_KEY" https://mcp.context7.com/mcp
 146 | ```
 147 | 
 148 | </details>
 149 | 
 150 | <details>
 151 | <summary><b>Install in Windsurf</b></summary>
 152 | 
 153 | Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp) for more info.
 154 | 
 155 | #### Windsurf Remote Server Connection
 156 | 
 157 | ```json
 158 | {
 159 |   "mcpServers": {
 160 |     "context7": {
 161 |       "serverUrl": "https://mcp.context7.com/mcp",
 162 |       "headers": {
 163 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 164 |       }
 165 |     }
 166 |   }
 167 | }
 168 | ```
 169 | 
 170 | #### Windsurf Local Server Connection
 171 | 
 172 | ```json
 173 | {
 174 |   "mcpServers": {
 175 |     "context7": {
 176 |       "command": "npx",
 177 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 178 |     }
 179 |   }
 180 | }
 181 | ```
 182 | 
 183 | </details>
 184 | 
 185 | <details>
 186 | <summary><b>Install in VS Code</b></summary>
 187 | 
 188 | [<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
 189 | [<img alt="Install in VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
 190 | 
 191 | Add this to your VS Code MCP config file. See [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more info.
 192 | 
 193 | #### VS Code Remote Server Connection
 194 | 
 195 | ```json
 196 | "mcp": {
 197 |   "servers": {
 198 |     "context7": {
 199 |       "type": "http",
 200 |       "url": "https://mcp.context7.com/mcp",
 201 |       "headers": {
 202 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 203 |       }
 204 |     }
 205 |   }
 206 | }
 207 | ```
 208 | 
 209 | #### VS Code Local Server Connection
 210 | 
 211 | ```json
 212 | "mcp": {
 213 |   "servers": {
 214 |     "context7": {
 215 |       "type": "stdio",
 216 |       "command": "npx",
 217 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 218 |     }
 219 |   }
 220 | }
 221 | ```
 222 | 
 223 | </details>
 224 | 
 225 | <details>
 226 | <summary>
 227 | <b>Install in Cline</b>
 228 | </summary>
 229 | 
 230 | You can easily install Context7 through the [Cline MCP Server Marketplace](https://cline.bot/mcp-marketplace) by following these instructions:
 231 | 
 232 | 1. Open **Cline**.
 233 | 2. Click the hamburger menu icon (☰) to enter the **MCP Servers** section.
 234 | 3. Use the search bar within the **Marketplace** tab to find _Context7_.
 235 | 4. Click the **Install** button.
 236 | 
 237 | Or you can directly edit MCP servers configuration:
 238 | 
 239 | 1. Open **Cline**.
 240 | 2. Click the hamburger menu icon (☰) to enter the **MCP Servers** section.
 241 | 3. Choose **Remote Servers** tab.
 242 | 4. Click the **Edit Configuration** button.
 243 | 5. Add context7 to `mcpServers`:
 244 | 
 245 | ```json
 246 | {
 247 |   "mcpServers": {
 248 |     "context7": {
 249 |       "url": "https://mcp.context7.com/mcp",
 250 |       "type": "streamableHttp",
 251 |       "headers": {
 252 |         "Authorization": "Bearer YOUR_API_KEY"
 253 |       }
 254 |     }
 255 |   }
 256 | }
 257 | ```
 258 | 
 259 | </details>
 260 | 
 261 | <details>
 262 | <summary><b>Install in Zed</b></summary>
 263 | 
 264 | It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Context7) or you can add this to your Zed `settings.json`. See [Zed Context Server docs](https://zed.dev/docs/assistant/context-servers) for more info.
 265 | 
 266 | ```json
 267 | {
 268 |   "context_servers": {
 269 |     "Context7": {
 270 |       "source": "custom",
 271 |       "command": "npx",
 272 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 273 |     }
 274 |   }
 275 | }
 276 | ```
 277 | 
 278 | </details>
 279 | 
 280 | <details>
 281 | <summary><b>Install in Augment Code</b></summary>
 282 | 
 283 | To configure Context7 MCP in Augment Code, you can use either the graphical interface or manual configuration.
 284 | 
 285 | ### **A. Using the Augment Code UI**
 286 | 
 287 | 1. Click the hamburger menu.
 288 | 2. Select **Settings**.
 289 | 3. Navigate to the **Tools** section.
 290 | 4. Click the **+ Add MCP** button.
 291 | 5. Enter the following command:
 292 | 
 293 |    ```
 294 |    npx -y @upstash/context7-mcp@latest
 295 |    ```
 296 | 
 297 | 6. Name the MCP: **Context7**.
 298 | 7. Click the **Add** button.
 299 | 
 300 | Once the MCP server is added, you can start using Context7's up-to-date code documentation features directly within Augment Code.
 301 | 
 302 | ---
 303 | 
 304 | ### **B. Manual Configuration**
 305 | 
 306 | 1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
 307 | 2. Select Edit Settings
 308 | 3. Under Advanced, click Edit in settings.json
 309 | 4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object
 310 | 
 311 | ```json
 312 | "augment.advanced": {
 313 |   "mcpServers": [
 314 |     {
 315 |       "name": "context7",
 316 |       "command": "npx",
 317 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 318 |     }
 319 |   ]
 320 | }
 321 | ```
 322 | 
 323 | Once the MCP server is added, restart your editor. If you receive any errors, check the syntax to make sure closing brackets or commas are not missing.
 324 | 
 325 | </details>
 326 | 
 327 | <details>
 328 | <summary><b>Install in Roo Code</b></summary>
 329 | 
 330 | Add this to your Roo Code MCP configuration file. See [Roo Code MCP docs](https://docs.roocode.com/features/mcp/using-mcp-in-roo) for more info.
 331 | 
 332 | #### Roo Code Remote Server Connection
 333 | 
 334 | ```json
 335 | {
 336 |   "mcpServers": {
 337 |     "context7": {
 338 |       "type": "streamable-http",
 339 |       "url": "https://mcp.context7.com/mcp",
 340 |       "headers": {
 341 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 342 |       }
 343 |     }
 344 |   }
 345 | }
 346 | ```
 347 | 
 348 | #### Roo Code Local Server Connection
 349 | 
 350 | ```json
 351 | {
 352 |   "mcpServers": {
 353 |     "context7": {
 354 |       "command": "npx",
 355 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 356 |     }
 357 |   }
 358 | }
 359 | ```
 360 | 
 361 | </details>
 362 | 
 363 | <details>
 364 | <summary><b>Install in Gemini CLI</b></summary>
 365 | 
 366 | See [Gemini CLI Configuration](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html) for details.
 367 | 
 368 | 1.  Open the Gemini CLI settings file. The location is `~/.gemini/settings.json` (where `~` is your home directory).
 369 | 2.  Add the following to the `mcpServers` object in your `settings.json` file:
 370 | 
 371 | ```json
 372 | {
 373 |   "mcpServers": {
 374 |     "context7": {
 375 |       "httpUrl": "https://mcp.context7.com/mcp",
 376 |       "headers": {
 377 |         "CONTEXT7_API_KEY": "YOUR_API_KEY",
 378 |         "Accept": "application/json, text/event-stream"
 379 |       }
 380 |     }
 381 |   }
 382 | }
 383 | ```
 384 | 
 385 | Or, for a local server:
 386 | 
 387 | ```json
 388 | {
 389 |   "mcpServers": {
 390 |     "context7": {
 391 |       "command": "npx",
 392 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 393 |     }
 394 |   }
 395 | }
 396 | ```
 397 | 
 398 | If the `mcpServers` object does not exist, create it.
 399 | 
 400 | </details>
 401 | 
 402 | <details>
 403 | <summary><b>Install in Qwen Coder</b></summary>
 404 | 
 405 | See [Qwen Coder MCP Configuration](https://qwenlm.github.io/qwen-code-docs/en/tools/mcp-server/#how-to-set-up-your-mcp-server) for details.
 406 | 
 407 | 1.  Open the Qwen Coder settings file. The location is `~/.qwen/settings.json` (where `~` is your home directory).
 408 | 2.  Add the following to the `mcpServers` object in your `settings.json` file:
 409 | 
 410 | ```json
 411 | {
 412 |   "mcpServers": {
 413 |     "context7": {
 414 |       "httpUrl": "https://mcp.context7.com/mcp",
 415 |       "headers": {
 416 |         "CONTEXT7_API_KEY": "YOUR_API_KEY",
 417 |         "Accept": "application/json, text/event-stream"
 418 |       }
 419 |     }
 420 |   }
 421 | }
 422 | ```
 423 | 
 424 | Or, for a local server:
 425 | 
 426 | ```json
 427 | {
 428 |   "mcpServers": {
 429 |     "context7": {
 430 |       "command": "npx",
 431 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 432 |     }
 433 |   }
 434 | }
 435 | ```
 436 | 
 437 | If the `mcpServers` object does not exist, create it.
 438 | 
 439 | </details>
 440 | 
 441 | <details>
 442 | <summary><b>Install in Claude Desktop</b></summary>
 443 | 
 444 | #### Remote Server Connection
 445 | 
 446 | Open Claude Desktop and navigate to Settings > Connectors > Add Custom Connector. Enter the name as `Context7` and the remote MCP server URL as `https://mcp.context7.com/mcp`.
 447 | 
 448 | #### Local Server Connection
 449 | 
 450 | Open Claude Desktop developer settings and edit your `claude_desktop_config.json` file to add the following configuration. See [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user) for more info.
 451 | 
 452 | ```json
 453 | {
 454 |   "mcpServers": {
 455 |     "context7": {
 456 |       "command": "npx",
 457 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 458 |     }
 459 |   }
 460 | }
 461 | ```
 462 | 
 463 | </details>
 464 | 
 465 | <details>
 466 | <summary><b>Install in Opencode</b></summary>
 467 | 
 468 | Add this to your Opencode configuration file. See [Opencode MCP docs](https://opencode.ai/docs/mcp-servers) for more info.
 469 | 
 470 | #### Opencode Remote Server Connection
 471 | 
 472 | ```json
 473 | "mcp": {
 474 |   "context7": {
 475 |     "type": "remote",
 476 |     "url": "https://mcp.context7.com/mcp",
 477 |     "headers": {
 478 |       "CONTEXT7_API_KEY": "YOUR_API_KEY"
 479 |     },
 480 |     "enabled": true
 481 |   }
 482 | }
 483 | ```
 484 | 
 485 | #### Opencode Local Server Connection
 486 | 
 487 | ```json
 488 | {
 489 |   "mcp": {
 490 |     "context7": {
 491 |       "type": "local",
 492 |       "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
 493 |       "enabled": true
 494 |     }
 495 |   }
 496 | }
 497 | ```
 498 | 
 499 | </details>
 500 | 
 501 | <details>
 502 | <summary><b>Install in OpenAI Codex</b></summary>
 503 | 
 504 | See [OpenAI Codex](https://github.com/openai/codex) for more information.
 505 | 
 506 | Add the following configuration to your OpenAI Codex MCP server settings:
 507 | 
 508 | #### Local Server Connection
 509 | 
 510 | ```toml
 511 | [mcp_servers.context7]
 512 | args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 513 | command = "npx"
 514 | startup_timeout_ms = 20_000
 515 | ```
 516 | 
 517 | #### Remote Server Connection
 518 | 
 519 | ```toml
 520 | [mcp_servers.context7]
 521 | url = "https://mcp.context7.com/mcp"
 522 | http_headers = { "CONTEXT7_API_KEY" = "YOUR_API_KEY" }
 523 | ```
 524 | 
 525 | > Optional troubleshooting — only if you see startup "request timed out" or "not found program". Most users can ignore this.
 526 | >
 527 | > - First try: increase `startup_timeout_ms` to `40_000` and retry.
 528 | > - Windows quick fix (absolute `npx` path + explicit env):
 529 | >
 530 | > ```toml
 531 | > [mcp_servers.context7]
 532 | > command = "C:\\Users\\yourname\\AppData\\Roaming\\npm\\npx.cmd"
 533 | > args = [
 534 | >   "-y",
 535 | >   "@upstash/context7-mcp",
 536 | >   "--api-key",
 537 | >   "YOUR_API_KEY"
 538 | > ]
 539 | > env = { SystemRoot="C:\\Windows", APPDATA="C:\\Users\\yourname\\AppData\\Roaming" }
 540 | > startup_timeout_ms = 40_000
 541 | > ```
 542 | >
 543 | > - macOS quick fix (use Node + installed package entry point):
 544 | >
 545 | > ```toml
 546 | > [mcp_servers.context7]
 547 | > command = "/Users/yourname/.nvm/versions/node/v22.14.0/bin/node"
 548 | > args = ["/Users/yourname/.nvm/versions/node/v22.14.0/lib/node_modules/@upstash/context7-mcp/dist/index.js",
 549 | >   "--transport",
 550 | >   "stdio",
 551 | >   "--api-key",
 552 | >   "YOUR_API_KEY"
 553 | > ]
 554 | > ```
 555 | >
 556 | > Notes: Replace `yourname` with your OS username. Explicitly setting `APPDATA` and `SystemRoot` is essential because these are required by `npx` on Windows but not set by certain versions of OpenAI Codex mcp clients by default.
 557 | 
 558 | </details>
 559 | 
 560 | <details>
 561 | 
 562 | <summary><b>Install in JetBrains AI Assistant</b></summary>
 563 | 
 564 | See [JetBrains AI Assistant Documentation](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html) for more details.
 565 | 
 566 | 1. In JetBrains IDEs, go to `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`
 567 | 2. Click `+ Add`.
 568 | 3. Click on `Command` in the top-left corner of the dialog and select the As JSON option from the list
 569 | 4. Add this configuration and click `OK`
 570 | 
 571 | ```json
 572 | {
 573 |   "mcpServers": {
 574 |     "context7": {
 575 |       "command": "npx",
 576 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 577 |     }
 578 |   }
 579 | }
 580 | ```
 581 | 
 582 | 5. Click `Apply` to save changes.
 583 | 6. The same way context7 could be added for JetBrains Junie in `Settings` -> `Tools` -> `Junie` -> `MCP Settings`
 584 | 
 585 | </details>
 586 | 
 587 | <details>
 588 |   
 589 | <summary><b>Install in Kiro</b></summary>
 590 | 
 591 | See [Kiro Model Context Protocol Documentation](https://kiro.dev/docs/mcp/configuration/) for details.
 592 | 
 593 | 1. Navigate `Kiro` > `MCP Servers`
 594 | 2. Add a new MCP server by clicking the `+ Add` button.
 595 | 3. Paste the configuration given below:
 596 | 
 597 | ```json
 598 | {
 599 |   "mcpServers": {
 600 |     "Context7": {
 601 |       "command": "npx",
 602 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
 603 |       "env": {},
 604 |       "disabled": false,
 605 |       "autoApprove": []
 606 |     }
 607 |   }
 608 | }
 609 | ```
 610 | 
 611 | 4. Click `Save` to apply the changes.
 612 | 
 613 | </details>
 614 | 
 615 | <details>
 616 | <summary><b>Install in Trae</b></summary>
 617 | 
 618 | Use the Add manually feature and fill in the JSON configuration information for that MCP server.
 619 | For more details, visit the [Trae documentation](https://docs.trae.ai/ide/model-context-protocol?_lang=en).
 620 | 
 621 | #### Trae Remote Server Connection
 622 | 
 623 | ```json
 624 | {
 625 |   "mcpServers": {
 626 |     "context7": {
 627 |       "url": "https://mcp.context7.com/mcp"
 628 |     }
 629 |   }
 630 | }
 631 | ```
 632 | 
 633 | #### Trae Local Server Connection
 634 | 
 635 | ```json
 636 | {
 637 |   "mcpServers": {
 638 |     "context7": {
 639 |       "command": "npx",
 640 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 641 |     }
 642 |   }
 643 | }
 644 | ```
 645 | 
 646 | </details>
 647 | 
 648 | <details>
 649 | <summary><b>Using Bun or Deno</b></summary>
 650 | 
 651 | Use these alternatives to run the local Context7 MCP server with other runtimes. These examples work for any client that supports launching a local MCP server via command + args.
 652 | 
 653 | #### Bun
 654 | 
 655 | ```json
 656 | {
 657 |   "mcpServers": {
 658 |     "context7": {
 659 |       "command": "bunx",
 660 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 661 |     }
 662 |   }
 663 | }
 664 | ```
 665 | 
 666 | #### Deno
 667 | 
 668 | ```json
 669 | {
 670 |   "mcpServers": {
 671 |     "context7": {
 672 |       "command": "deno",
 673 |       "args": [
 674 |         "run",
 675 |         "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION",
 676 |         "--allow-net",
 677 |         "npm:@upstash/context7-mcp"
 678 |       ]
 679 |     }
 680 |   }
 681 | }
 682 | ```
 683 | 
 684 | </details>
 685 | 
 686 | <details>
 687 | <summary><b>Using Docker</b></summary>
 688 | 
 689 | If you prefer to run the MCP server in a Docker container:
 690 | 
 691 | 1. **Build the Docker Image:**
 692 | 
 693 |    First, create a `Dockerfile` in the project root (or anywhere you prefer):
 694 | 
 695 |    <details>
 696 |    <summary>Click to see Dockerfile content</summary>
 697 | 
 698 |    ```Dockerfile
 699 |    FROM node:18-alpine
 700 | 
 701 |    WORKDIR /app
 702 | 
 703 |    # Install the latest version globally
 704 |    RUN npm install -g @upstash/context7-mcp
 705 | 
 706 |    # Expose default port if needed (optional, depends on MCP client interaction)
 707 |    # EXPOSE 3000
 708 | 
 709 |    # Default command to run the server
 710 |    CMD ["context7-mcp"]
 711 |    ```
 712 | 
 713 |    </details>
 714 | 
 715 |    Then, build the image using a tag (e.g., `context7-mcp`). **Make sure Docker Desktop (or the Docker daemon) is running.** Run the following command in the same directory where you saved the `Dockerfile`:
 716 | 
 717 |    ```bash
 718 |    docker build -t context7-mcp .
 719 |    ```
 720 | 
 721 | 2. **Configure Your MCP Client:**
 722 | 
 723 |    Update your MCP client's configuration to use the Docker command.
 724 | 
 725 |    _Example for a cline_mcp_settings.json:_
 726 | 
 727 |    ```json
 728 |    {
 729 |      "mcpServers": {
 730 |        "Сontext7": {
 731 |          "autoApprove": [],
 732 |          "disabled": false,
 733 |          "timeout": 60,
 734 |          "command": "docker",
 735 |          "args": ["run", "-i", "--rm", "context7-mcp"],
 736 |          "transportType": "stdio"
 737 |        }
 738 |      }
 739 |    }
 740 |    ```
 741 | 
 742 |    _Note: This is an example configuration. Please refer to the specific examples for your MCP client (like Cursor, VS Code, etc.) earlier in this README to adapt the structure (e.g., `mcpServers` vs `servers`). Also, ensure the image name in `args` matches the tag used during the `docker build` command._
 743 | 
 744 | </details>
 745 | 
 746 | <details>
 747 | <summary><b>Install Using the Desktop Extension</b></summary>
 748 | 
 749 | Install the [context7.mcpb](mcpb/context7.mcpb) file under the mcpb folder and add it to your client. For more information, please check out [MCP bundles docs](https://github.com/anthropics/mcpb#mcp-bundles-mcpb).
 750 | 
 751 | </details>
 752 | 
 753 | <details>
 754 | <summary><b>Install in Windows</b></summary>
 755 | 
 756 | The configuration on Windows is slightly different compared to Linux or macOS (_`Cline` is used in the example_). The same principle applies to other editors; refer to the configuration of `command` and `args`.
 757 | 
 758 | ```json
 759 | {
 760 |   "mcpServers": {
 761 |     "github.com/upstash/context7-mcp": {
 762 |       "command": "cmd",
 763 |       "args": ["/c", "npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
 764 |       "disabled": false,
 765 |       "autoApprove": []
 766 |     }
 767 |   }
 768 | }
 769 | ```
 770 | 
 771 | </details>
 772 | 
 773 | <details>
 774 | <summary><b>Install in Amazon Q Developer CLI</b></summary>
 775 | 
 776 | Add this to your Amazon Q Developer CLI configuration file. See [Amazon Q Developer CLI docs](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) for more details.
 777 | 
 778 | ```json
 779 | {
 780 |   "mcpServers": {
 781 |     "context7": {
 782 |       "command": "npx",
 783 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 784 |     }
 785 |   }
 786 | }
 787 | ```
 788 | 
 789 | </details>
 790 | 
 791 | <details>
 792 | <summary><b>Install in Warp</b></summary>
 793 | 
 794 | See [Warp Model Context Protocol Documentation](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server) for details.
 795 | 
 796 | 1. Navigate `Settings` > `AI` > `Manage MCP servers`.
 797 | 2. Add a new MCP server by clicking the `+ Add` button.
 798 | 3. Paste the configuration given below:
 799 | 
 800 | ```json
 801 | {
 802 |   "Context7": {
 803 |     "command": "npx",
 804 |     "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
 805 |     "env": {},
 806 |     "working_directory": null,
 807 |     "start_on_launch": true
 808 |   }
 809 | }
 810 | ```
 811 | 
 812 | 4. Click `Save` to apply the changes.
 813 | 
 814 | </details>
 815 | 
 816 | <details>
 817 | 
 818 | <summary><b>Install in Copilot Coding Agent</b></summary>
 819 | 
 820 | ## Using Context7 with Copilot Coding Agent
 821 | 
 822 | Add the following configuration to the `mcp` section of your Copilot Coding Agent configuration file Repository->Settings->Copilot->Coding agent->MCP configuration:
 823 | 
 824 | ```json
 825 | {
 826 |   "mcpServers": {
 827 |     "context7": {
 828 |       "type": "http",
 829 |       "url": "https://mcp.context7.com/mcp",
 830 |       "headers": {
 831 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 832 |       },
 833 |       "tools": ["get-library-docs", "resolve-library-id"]
 834 |     }
 835 |   }
 836 | }
 837 | ```
 838 | 
 839 | For more information, see the [official GitHub documentation](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp).
 840 | 
 841 | </details>
 842 | 
 843 | <details>
 844 | <summary><b>Install in Copilot CLI</b></summary>
 845 | 
 846 | 1.  Open the Copilot CLI MCP config file. The location is `~/.copilot/mcp-config.json` (where `~` is your home directory).
 847 | 2.  Add the following to the `mcpServers` object in your `mcp-config.json` file:
 848 | 
 849 | ```json
 850 | {
 851 |   "mcpServers": {
 852 |     "context7": {
 853 |       "type": "http",
 854 |       "url": "https://mcp.context7.com/mcp",
 855 |       "headers": {
 856 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 857 |       },
 858 |       "tools": [
 859 |         "get-library-docs", 
 860 |         "resolve-library-id"
 861 |       ]
 862 |     }
 863 |   }
 864 | }
 865 | ```
 866 | 
 867 | Or, for a local server:
 868 | 
 869 | ```json
 870 | {
 871 |   "mcpServers": {
 872 |     "context7": {
 873 |       "type": "local",
 874 |       "command": "npx",
 875 |       "tools": [
 876 |         "get-library-docs", 
 877 |         "resolve-library-id"
 878 |       ],
 879 |       "args": [
 880 |         "-y",
 881 |         "@upstash/context7-mcp",
 882 |         "--api-key",
 883 |         "YOUR_API_KEY"
 884 |       ]
 885 |     }
 886 |   }
 887 | }
 888 | ```
 889 | 
 890 | If the `mcp-config.json` file does not exist, create it.
 891 | 
 892 | </details>
 893 | 
 894 | <details>
 895 | <summary><b>Install in LM Studio</b></summary>
 896 | 
 897 | See [LM Studio MCP Support](https://lmstudio.ai/blog/lmstudio-v0.3.17) for more information.
 898 | 
 899 | #### One-click install:
 900 | 
 901 | [![Add MCP Server context7 to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJdfQ%3D%3D)
 902 | 
 903 | #### Manual set-up:
 904 | 
 905 | 1. Navigate to `Program` (right side) > `Install` > `Edit mcp.json`.
 906 | 2. Paste the configuration given below:
 907 | 
 908 | ```json
 909 | {
 910 |   "mcpServers": {
 911 |     "Context7": {
 912 |       "command": "npx",
 913 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 914 |     }
 915 |   }
 916 | }
 917 | ```
 918 | 
 919 | 3. Click `Save` to apply the changes.
 920 | 4. Toggle the MCP server on/off from the right hand side, under `Program`, or by clicking the plug icon at the bottom of the chat box.
 921 | 
 922 | </details>
 923 | 
 924 | <details>
 925 | <summary><b>Install in Visual Studio 2022</b></summary>
 926 | 
 927 | You can configure Context7 MCP in Visual Studio 2022 by following the [Visual Studio MCP Servers documentation](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
 928 | 
 929 | Add this to your Visual Studio MCP config file (see the [Visual Studio docs](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) for details):
 930 | 
 931 | ```json
 932 | {
 933 |   "inputs": [],
 934 |   "servers": {
 935 |     "context7": {
 936 |       "type": "http",
 937 |       "url": "https://mcp.context7.com/mcp",
 938 |       "headers": {
 939 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 940 |       }
 941 |     }
 942 |   }
 943 | }
 944 | ```
 945 | 
 946 | Or, for a local server:
 947 | 
 948 | ```json
 949 | {
 950 |   "mcp": {
 951 |     "servers": {
 952 |       "context7": {
 953 |         "type": "stdio",
 954 |         "command": "npx",
 955 |         "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 956 |       }
 957 |     }
 958 |   }
 959 | }
 960 | ```
 961 | 
 962 | For more information and troubleshooting, refer to the [Visual Studio MCP Servers documentation](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
 963 | 
 964 | </details>
 965 | 
 966 | <details>
 967 | <summary><b>Install in Crush</b></summary>
 968 | 
 969 | Add this to your Crush configuration file. See [Crush MCP docs](https://github.com/charmbracelet/crush#mcps) for more info.
 970 | 
 971 | #### Crush Remote Server Connection (HTTP)
 972 | 
 973 | ```json
 974 | {
 975 |   "$schema": "https://charm.land/crush.json",
 976 |   "mcp": {
 977 |     "context7": {
 978 |       "type": "http",
 979 |       "url": "https://mcp.context7.com/mcp",
 980 |       "headers": {
 981 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
 982 |       }
 983 |     }
 984 |   }
 985 | }
 986 | ```
 987 | 
 988 | #### Crush Local Server Connection
 989 | 
 990 | ```json
 991 | {
 992 |   "$schema": "https://charm.land/crush.json",
 993 |   "mcp": {
 994 |     "context7": {
 995 |       "type": "stdio",
 996 |       "command": "npx",
 997 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
 998 |     }
 999 |   }
1000 | }
1001 | ```
1002 | 
1003 | </details>
1004 | 
1005 | <details>
1006 | <summary><b>Install in BoltAI</b></summary>
1007 | 
1008 | Open the "Settings" page of the app, navigate to "Plugins," and enter the following JSON:
1009 | 
1010 | ```json
1011 | {
1012 |   "mcpServers": {
1013 |     "context7": {
1014 |       "command": "npx",
1015 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
1016 |     }
1017 |   }
1018 | }
1019 | ```
1020 | 
1021 | Once saved, enter in the chat `get-library-docs` followed by your Context7 documentation ID (e.g., `get-library-docs /nuxt/ui`). More information is available on [BoltAI's Documentation site](https://docs.boltai.com/docs/plugins/mcp-servers). For BoltAI on iOS, [see this guide](https://docs.boltai.com/docs/boltai-mobile/mcp-servers).
1022 | 
1023 | </details>
1024 | 
1025 | <details>
1026 | <summary><b>Install in Rovo Dev CLI</b></summary>
1027 | 
1028 | Edit your Rovo Dev CLI MCP config by running the command below -
1029 | 
1030 | ```bash
1031 | acli rovodev mcp
1032 | ```
1033 | 
1034 | Example config -
1035 | 
1036 | #### Remote Server Connection
1037 | 
1038 | ```json
1039 | {
1040 |   "mcpServers": {
1041 |     "context7": {
1042 |       "url": "https://mcp.context7.com/mcp"
1043 |     }
1044 |   }
1045 | }
1046 | ```
1047 | 
1048 | #### Local Server Connection
1049 | 
1050 | ```json
1051 | {
1052 |   "mcpServers": {
1053 |     "context7": {
1054 |       "command": "npx",
1055 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
1056 |     }
1057 |   }
1058 | }
1059 | ```
1060 | 
1061 | </details>
1062 | 
1063 | <details>
1064 | <summary><b>Install in Zencoder</b></summary>
1065 | 
1066 | To configure Context7 MCP in Zencoder, follow these steps:
1067 | 
1068 | 1. Go to the Zencoder menu (...)
1069 | 2. From the dropdown menu, select Agent tools
1070 | 3. Click on the Add custom MCP
1071 | 4. Add the name and server configuration from below, and make sure to hit the Install button
1072 | 
1073 | ```json
1074 | {
1075 |   "command": "npx",
1076 |   "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
1077 | }
1078 | ```
1079 | 
1080 | Once the MCP server is added, you can easily continue using it.
1081 | 
1082 | </details>
1083 | 
1084 | <details>
1085 | <summary><b>Install in Qodo Gen</b></summary>
1086 | 
1087 | See [Qodo Gen docs](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps) for more details.
1088 | 
1089 | 1. Open Qodo Gen chat panel in VSCode or IntelliJ.
1090 | 2. Click Connect more tools.
1091 | 3. Click + Add new MCP.
1092 | 4. Add the following configuration:
1093 | 
1094 | #### Qodo Gen Local Server Connection
1095 | 
1096 | ```json
1097 | {
1098 |   "mcpServers": {
1099 |     "context7": {
1100 |       "command": "npx",
1101 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
1102 |     }
1103 |   }
1104 | }
1105 | ```
1106 | 
1107 | #### Qodo Gen Remote Server Connection
1108 | 
1109 | ```json
1110 | {
1111 |   "mcpServers": {
1112 |     "context7": {
1113 |       "url": "https://mcp.context7.com/mcp"
1114 |     }
1115 |   }
1116 | }
1117 | ```
1118 | 
1119 | </details>
1120 | 
1121 | <details>
1122 | <summary><b>Install in Perplexity Desktop</b></summary>
1123 | 
1124 | See [Local and Remote MCPs for Perplexity](https://www.perplexity.ai/help-center/en/articles/11502712-local-and-remote-mcps-for-perplexity) for more information.
1125 | 
1126 | 1. Navigate `Perplexity` > `Settings`
1127 | 2. Select `Connectors`.
1128 | 3. Click `Add Connector`.
1129 | 4. Select `Advanced`.
1130 | 5. Enter Server Name: `Context7`
1131 | 6. Paste the following JSON in the text area:
1132 | 
1133 | ```json
1134 | {
1135 |   "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
1136 |   "command": "npx",
1137 |   "env": {}
1138 | }
1139 | ```
1140 | 
1141 | 7. Click `Save`.
1142 | </details>
1143 | 
1144 | <details>
1145 | <summary><b>Install in Factory</b></summary>
1146 | 
1147 | Factory's droid supports MCP servers through its CLI. See [Factory MCP docs](https://docs.factory.ai/cli/configuration/mcp) for more info.
1148 | 
1149 | #### Factory Remote Server Connection (HTTP)
1150 | 
1151 | Run this command in your terminal:
1152 | 
1153 | ```sh
1154 | droid mcp add context7 https://mcp.context7.com/mcp --type http --header "CONTEXT7_API_KEY: YOUR_API_KEY"
1155 | ```
1156 | 
1157 | Or without an API key (basic usage with rate limits):
1158 | 
1159 | ```sh
1160 | droid mcp add context7 https://mcp.context7.com/mcp --type http
1161 | ```
1162 | 
1163 | #### Factory Local Server Connection (Stdio)
1164 | 
1165 | Run this command in your terminal:
1166 | 
1167 | ```sh
1168 | droid mcp add context7 "npx -y @upstash/context7-mcp" --env CONTEXT7_API_KEY=YOUR_API_KEY
1169 | ```
1170 | 
1171 | Once configured, Context7 tools will be available in your droid sessions. Type `/mcp` within droid to manage servers, authenticate, and view available tools.
1172 | 
1173 | </details>
1174 | 
1175 | ## 🔨 Available Tools
1176 | 
1177 | Context7 MCP provides the following tools that LLMs can use:
1178 | 
1179 | - `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
1180 |   - `libraryName` (required): The name of the library to search for
1181 | 
1182 | - `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
1183 |   - `context7CompatibleLibraryID` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
1184 |   - `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")
1185 |   - `tokens` (optional, default 5000): Max number of tokens to return. Values less than 1000 are automatically increased to 1000.
1186 | 
1187 | ## 🛟 Tips
1188 | 
1189 | ### Add a Rule
1190 | 
1191 | If you don’t want to add `use context7` to every prompt, you can define a simple rule in your MCP client's rule section:
1192 | 
1193 | - For Windsurf, in `.windsurfrules` file
1194 | - For Cursor, from `Cursor Settings > Rules` section
1195 | - For Claude Code, in `CLAUDE.md` file
1196 | 
1197 | Or the equivalent in your MCP client to auto-invoke Context7 on any code question.
1198 | 
1199 | #### Example Rule
1200 | 
1201 | ```txt
1202 | Always use context7 when I need code generation, setup or configuration steps, or
1203 | library/API documentation. This means you should automatically use the Context7 MCP
1204 | tools to resolve library id and get library docs without me having to explicitly ask.
1205 | ```
1206 | 
1207 | From then on, you’ll get Context7’s docs in any related conversation without typing anything extra. You can alter the rule to match your use cases.
1208 | 
1209 | ### Use Library Id
1210 | 
1211 | If you already know exactly which library you want to use, add its Context7 ID to your prompt. That way, Context7 MCP server can skip the library-matching step and directly continue with retrieving docs.
1212 | 
1213 | ```txt
1214 | Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.
1215 | ```
1216 | 
1217 | The slash syntax tells the MCP tool exactly which library to load docs for.
1218 | 
1219 | ### HTTPS Proxy
1220 | 
1221 | If you are behind an HTTP proxy, Context7 uses the standard `https_proxy` / `HTTPS_PROXY` environment variables.
1222 | 
1223 | ## 💻 Development
1224 | 
1225 | Clone the project and install dependencies:
1226 | 
1227 | ```bash
1228 | bun i
1229 | ```
1230 | 
1231 | Build:
1232 | 
1233 | ```bash
1234 | bun run build
1235 | ```
1236 | 
1237 | Run the server:
1238 | 
1239 | ```bash
1240 | bun run dist/index.js
1241 | ```
1242 | 
1243 | ### CLI Arguments
1244 | 
1245 | `context7-mcp` accepts the following CLI flags:
1246 | 
1247 | - `--transport <stdio|http>` – Transport to use (`stdio` by default). Use `http` for remote HTTP server or `stdio` for local integration.
1248 | - `--port <number>` – Port to listen on when using `http` transport (default `3000`).
1249 | - `--api-key <key>` – API key for authentication (or set `CONTEXT7_API_KEY` env var). You can get your API key by creating an account at [context7.com/dashboard](https://context7.com/dashboard).
1250 | 
1251 | Example with HTTP transport and port 8080:
1252 | 
1253 | ```bash
1254 | bun run dist/index.js --transport http --port 8080
1255 | ```
1256 | 
1257 | Another example with stdio transport:
1258 | 
1259 | ```bash
1260 | bun run dist/index.js --transport stdio --api-key YOUR_API_KEY
1261 | ```
1262 | 
1263 | ### Environment Variables
1264 | 
1265 | You can use the `CONTEXT7_API_KEY` environment variable instead of passing the `--api-key` flag. This is useful for:
1266 | 
1267 | - Storing API keys securely in `.env` files
1268 | - Integration with MCP server setups that use dotenv
1269 | - Tools that prefer environment variable configuration
1270 | 
1271 | **Note:** The `--api-key` CLI flag takes precedence over the environment variable when both are provided.
1272 | 
1273 | **Example with .env file:**
1274 | 
1275 | ```bash
1276 | # .env
1277 | CONTEXT7_API_KEY=your_api_key_here
1278 | ```
1279 | 
1280 | **Example MCP configuration using environment variable:**
1281 | 
1282 | ```json
1283 | {
1284 |   "mcpServers": {
1285 |     "context7": {
1286 |       "command": "npx",
1287 |       "args": ["-y", "@upstash/context7-mcp"],
1288 |       "env": {
1289 |         "CONTEXT7_API_KEY": "YOUR_API_KEY"
1290 |       }
1291 |     }
1292 |   }
1293 | }
1294 | ```
1295 | 
1296 | <details>
1297 | <summary><b>Local Configuration Example</b></summary>
1298 | 
1299 | ```json
1300 | {
1301 |   "mcpServers": {
1302 |     "context7": {
1303 |       "command": "npx",
1304 |       "args": ["tsx", "/path/to/folder/context7/src/index.ts", "--api-key", "YOUR_API_KEY"]
1305 |     }
1306 |   }
1307 | }
1308 | ```
1309 | 
1310 | </details>
1311 | 
1312 | <details>
1313 | <summary><b>Testing with MCP Inspector</b></summary>
1314 | 
1315 | ```bash
1316 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
1317 | ```
1318 | 
1319 | </details>
1320 | 
1321 | ## 🚨 Troubleshooting
1322 | 
1323 | <details>
1324 | <summary><b>Module Not Found Errors</b></summary>
1325 | 
1326 | If you encounter `ERR_MODULE_NOT_FOUND`, try using `bunx` instead of `npx`:
1327 | 
1328 | ```json
1329 | {
1330 |   "mcpServers": {
1331 |     "context7": {
1332 |       "command": "bunx",
1333 |       "args": ["-y", "@upstash/context7-mcp"]
1334 |     }
1335 |   }
1336 | }
1337 | ```
1338 | 
1339 | This often resolves module resolution issues in environments where `npx` doesn't properly install or resolve packages.
1340 | 
1341 | </details>
1342 | 
1343 | <details>
1344 | <summary><b>ESM Resolution Issues</b></summary>
1345 | 
1346 | For errors like `Error: Cannot find module 'uriTemplate.js'`, try the `--experimental-vm-modules` flag:
1347 | 
1348 | ```json
1349 | {
1350 |   "mcpServers": {
1351 |     "context7": {
1352 |       "command": "npx",
1353 |       "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/[email protected]"]
1354 |     }
1355 |   }
1356 | }
1357 | ```
1358 | 
1359 | </details>
1360 | 
1361 | <details>
1362 | <summary><b>TLS/Certificate Issues</b></summary>
1363 | 
1364 | Use the `--experimental-fetch` flag to bypass TLS-related problems:
1365 | 
1366 | ```json
1367 | {
1368 |   "mcpServers": {
1369 |     "context7": {
1370 |       "command": "npx",
1371 |       "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
1372 |     }
1373 |   }
1374 | }
1375 | ```
1376 | 
1377 | </details>
1378 | 
1379 | <details>
1380 | <summary><b>General MCP Client Errors</b></summary>
1381 | 
1382 | 1. Try adding `@latest` to the package name
1383 | 2. Use `bunx` as an alternative to `npx`
1384 | 3. Consider using `deno` as another alternative
1385 | 4. Ensure you're using Node.js v18 or higher for native fetch support
1386 | 
1387 | </details>
1388 | 
1389 | ## ⚠️ Disclaimer
1390 | 
1391 | 1- Context7 projects are community-contributed and while we strive to maintain high quality, we cannot guarantee the accuracy, completeness, or security of all library documentation. Projects listed in Context7 are developed and maintained by their respective owners, not by Context7. If you encounter any suspicious, inappropriate, or potentially harmful content, please use the "Report" button on the project page to notify us immediately. We take all reports seriously and will review flagged content promptly to maintain the integrity and safety of our platform. By using Context7, you acknowledge that you do so at your own discretion and risk.
1392 | 
1393 | 2- This repository hosts the MCP server’s source code. The supporting components — API backend, parsing engine, and crawling engine — are private and not part of this release.
1394 | 
1395 | ## 🤝 Connect with Us
1396 | 
1397 | Stay updated and join our community:
1398 | 
1399 | - 📢 Follow us on [X](https://x.com/context7ai) for the latest news and updates
1400 | - 🌐 Visit our [Website](https://context7.com)
1401 | - 💬 Join our [Discord Community](https://upstash.com/discord)
1402 | 
1403 | ## 📺 Context7 In Media
1404 | 
1405 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
1406 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
1407 | - [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
1408 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
1409 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
1410 | - [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
1411 | - [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
1412 | - [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
1413 | 
1414 | ## ⭐ Star History
1415 | 
1416 | [![Star History Chart](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
1417 | 
1418 | ## 📄 License
1419 | 
1420 | MIT
1421 | 
```

--------------------------------------------------------------------------------
/prettier.config.mjs:
--------------------------------------------------------------------------------

```
 1 | /**
 2 |  * @type {import('prettier').Config}
 3 |  */
 4 | const config = {
 5 |   endOfLine: "lf",
 6 |   singleQuote: false,
 7 |   tabWidth: 2,
 8 |   trailingComma: "es5",
 9 |   printWidth: 100,
10 |   arrowParens: "always",
11 | };
12 | 
13 | export default config;
14 | 
```

--------------------------------------------------------------------------------
/gemini-extension.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "context7",
 3 |   "description": "Up-to-date code docs for any prompt",
 4 |   "version": "1.0.0",
 5 |   "mcpServers": {
 6 |     "context7": {
 7 |       "command": "npx",
 8 |       "args": ["-y", "@upstash/context7-mcp", "--api-key", "${CONTEXT7_API_KEY}"]
 9 |     }
10 |   }
11 | }
12 | 
```

--------------------------------------------------------------------------------
/smithery.yaml:
--------------------------------------------------------------------------------

```yaml
 1 | # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
 2 | 
 3 | startCommand:
 4 |   type: http
 5 |   configSchema:
 6 |     # JSON Schema defining the configuration options for the MCP.
 7 |     type: object
 8 |     description: No configuration required
 9 |   exampleConfig: {}
10 | 
```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "compilerOptions": {
 3 |     "target": "ES2022",
 4 |     "module": "Node16",
 5 |     "moduleResolution": "Node16",
 6 |     "outDir": "./dist",
 7 |     "rootDir": "./src",
 8 |     "strict": true,
 9 |     "esModuleInterop": true,
10 |     "skipLibCheck": true,
11 |     "forceConsistentCasingInFileNames": true
12 |   },
13 |   "include": ["src/**/*"],
14 |   "exclude": ["node_modules"]
15 | }
16 | 
```

--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------

```yaml
 1 | version: 2
 2 | updates:
 3 |   - package-ecosystem: npm
 4 |     directory: /
 5 |     schedule:
 6 |       interval: monthly
 7 |   - package-ecosystem: bun
 8 |     directory: /
 9 |     schedule:
10 |       interval: monthly
11 |   - package-ecosystem: docker
12 |     directory: /
13 |     schedule:
14 |       interval: monthly
15 |   - package-ecosystem: github-actions
16 |     directory: /
17 |     schedule:
18 |       interval: monthly
19 | 
```

--------------------------------------------------------------------------------
/src/lib/types.ts:
--------------------------------------------------------------------------------

```typescript
 1 | export interface SearchResult {
 2 |   id: string;
 3 |   title: string;
 4 |   description: string;
 5 |   branch: string;
 6 |   lastUpdateDate: string;
 7 |   state: DocumentState;
 8 |   totalTokens: number;
 9 |   totalSnippets: number;
10 |   totalPages: number;
11 |   stars?: number;
12 |   trustScore?: number;
13 |   versions?: string[];
14 | }
15 | 
16 | export interface SearchResponse {
17 |   error?: string;
18 |   results: SearchResult[];
19 | }
20 | 
21 | // Version state is still needed for validating search results
22 | export type DocumentState = "initial" | "finalized" | "error" | "delete";
23 | 
```

--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------

```dockerfile
 1 | # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
 2 | # ----- Build Stage -----
 3 | FROM node:lts-alpine AS builder
 4 | WORKDIR /app
 5 | 
 6 | # Copy package and configuration
 7 | COPY package.json bun.lock tsconfig.json ./
 8 | 
 9 | # Copy source code
10 | COPY src ./src
11 | 
12 | # Install dependencies and build
13 | RUN npm install && npm run build
14 | 
15 | # ----- Production Stage -----
16 | FROM node:lts-alpine
17 | WORKDIR /app
18 | 
19 | # Copy built artifacts
20 | COPY --from=builder /app/dist ./dist
21 | 
22 | # Copy package.json for production install
23 | COPY package.json ./
24 | 
25 | # Install only production dependencies
26 | RUN npm install --production --ignore-scripts
27 | 
28 | # Expose HTTP port
29 | EXPOSE 8080
30 | 
31 | # Default command using CLI flags
32 | CMD ["node", "dist/index.js", "--transport", "http", "--port", "8080"]
33 | 
```

--------------------------------------------------------------------------------
/server.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
 3 |   "name": "io.github.upstash/context7",
 4 |   "title": "Context7",
 5 |   "description": "Up-to-date code docs for any prompt",
 6 |   "repository": {
 7 |     "url": "https://github.com/upstash/context7",
 8 |     "source": "github"
 9 |   },
10 |   "version": "1.0.0",
11 |   "packages": [
12 |     {
13 |       "registryType": "npm",
14 |       "identifier": "@upstash/context7-mcp",
15 |       "version": "1.0.26",
16 |       "transport": {
17 |         "type": "stdio"
18 |       },
19 |       "environmentVariables": [
20 |         {
21 |           "description": "API key for authentication",
22 |           "isRequired": false,
23 |           "format": "string",
24 |           "isSecret": true,
25 |           "name": "CONTEXT7_API_KEY"
26 |         }
27 |       ]
28 |     }
29 |   ]
30 | }
31 | 
```

--------------------------------------------------------------------------------
/.github/workflows/check.yaml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Build Check
 2 | 
 3 | on:
 4 |   push:
 5 |     branches: [master]
 6 |   pull_request:
 7 |     branches: [master]
 8 | 
 9 | concurrency:
10 |   group: ${{ github.workflow }}-${{ github.ref }}
11 |   cancel-in-progress: true
12 | 
13 | jobs:
14 |   build:
15 |     name: Build
16 |     runs-on: ubuntu-latest
17 |     steps:
18 |       - name: Checkout repository
19 |         uses: actions/checkout@v4
20 | 
21 |       - name: Setup Bun
22 |         uses: oven-sh/setup-bun@v2
23 |         with:
24 |           bun-version: latest
25 | 
26 |       - name: Cache dependencies
27 |         uses: actions/cache@v4
28 |         with:
29 |           path: ~/.bun/install/cache
30 |           key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
31 |           restore-keys: |
32 |             ${{ runner.os }}-bun-
33 | 
34 |       - name: Install dependencies
35 |         run: bun install --frozen-lockfile
36 | 
37 |       - name: Run linter
38 |         run: bun run lint:check
39 | 
40 |       - name: Check formatting
41 |         run: bun run format --check
42 | 
43 |       - name: Build project
44 |         run: bun run build
45 | 
```

--------------------------------------------------------------------------------
/eslint.config.js:
--------------------------------------------------------------------------------

```javascript
 1 | import tseslint from "typescript-eslint";
 2 | import eslintPluginPrettier from "eslint-plugin-prettier";
 3 | 
 4 | export default tseslint.config({
 5 |   // Base ESLint configuration
 6 |   ignores: ["node_modules/**", "build/**", "dist/**", ".git/**", ".github/**"],
 7 |   languageOptions: {
 8 |     ecmaVersion: 2020,
 9 |     sourceType: "module",
10 |     parser: tseslint.parser,
11 |     parserOptions: {},
12 |     globals: {
13 |       // Add Node.js globals
14 |       process: "readonly",
15 |       require: "readonly",
16 |       module: "writable",
17 |       console: "readonly",
18 |     },
19 |   },
20 |   // Settings for all files
21 |   linterOptions: {
22 |     reportUnusedDisableDirectives: true,
23 |   },
24 |   // Apply ESLint recommended rules
25 |   extends: [tseslint.configs.recommended],
26 |   plugins: {
27 |     prettier: eslintPluginPrettier,
28 |   },
29 |   rules: {
30 |     // TypeScript rules
31 |     "@typescript-eslint/explicit-module-boundary-types": "off",
32 |     "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
33 |     "@typescript-eslint/no-explicit-any": "warn",
34 |     // Prettier integration
35 |     "prettier/prettier": "error",
36 |   },
37 | });
38 | 
```

--------------------------------------------------------------------------------
/public/context7-icon.svg:
--------------------------------------------------------------------------------

```
1 | <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2 | <rect width="28" height="28" rx="4" fill="black" style="fill:black;fill-opacity:1;"/>
3 | <path d="M10.5724 15.2565C10.5724 17.5025 9.6613 19.3778 8.17805 21.1047H11.6319L11.6319 22.7786H6.33459V21.1895C7.95557 19.3566 8.58065 17.8628 8.58065 15.2565L10.5724 15.2565Z" fill="white" style="fill:white;fill-opacity:1;"/>
4 | <path d="M17.4276 15.2565C17.4276 17.5025 18.3387 19.3778 19.822 21.1047H16.3681V22.7786H21.6654V21.1895C20.0444 19.3566 19.4194 17.8628 19.4194 15.2565H17.4276Z" fill="white" style="fill:white;fill-opacity:1;"/>
5 | <path d="M10.5724 12.7435C10.5724 10.4975 9.66131 8.62224 8.17807 6.89532L11.6319 6.89532V5.22137L6.33461 5.22137V6.81056C7.95558 8.64343 8.58066 10.1373 8.58066 12.7435L10.5724 12.7435Z" fill="white" style="fill:white;fill-opacity:1;"/>
6 | <path d="M17.4276 12.7435C17.4276 10.4975 18.3387 8.62224 19.822 6.89532L16.3681 6.89532L16.3681 5.22138L21.6654 5.22138V6.81056C20.0444 8.64343 19.4194 10.1373 19.4194 12.7435H17.4276Z" fill="white" style="fill:white;fill-opacity:1;"/>
7 | </svg>
8 | 
```

--------------------------------------------------------------------------------
/public/context7-icon-green.svg:
--------------------------------------------------------------------------------

```
1 | <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2 | <rect width="28" height="28" rx="4" fill="#059669" style="fill:#059669;fill:color(display-p3 0.0196 0.5882 0.4118);fill-opacity:1;"/>
3 | <path d="M10.5724 15.2565C10.5724 17.5025 9.6613 19.3778 8.17805 21.1047H11.6319L11.6319 22.7786H6.33459V21.1895C7.95557 19.3566 8.58065 17.8628 8.58065 15.2565L10.5724 15.2565Z" fill="white" style="fill:white;fill-opacity:1;"/>
4 | <path d="M17.4276 15.2565C17.4276 17.5025 18.3387 19.3778 19.822 21.1047H16.3681V22.7786H21.6654V21.1895C20.0444 19.3566 19.4194 17.8628 19.4194 15.2565H17.4276Z" fill="white" style="fill:white;fill-opacity:1;"/>
5 | <path d="M10.5724 12.7435C10.5724 10.4975 9.66131 8.62224 8.17807 6.89532L11.6319 6.89532V5.22137L6.33461 5.22137V6.81056C7.95558 8.64343 8.58066 10.1373 8.58066 12.7435L10.5724 12.7435Z" fill="white" style="fill:white;fill-opacity:1;"/>
6 | <path d="M17.4276 12.7435C17.4276 10.4975 18.3387 8.62224 19.822 6.89532L16.3681 6.89532L16.3681 5.22138L21.6654 5.22138V6.81056C20.0444 8.64343 19.4194 10.1373 19.4194 12.7435H17.4276Z" fill="white" style="fill:white;fill-opacity:1;"/>
7 | </svg>
8 | 
```

--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation.yml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Documentation Issue
 2 | description: Report incorrect or missing documentation
 3 | title: "[Docs]: "
 4 | labels: ["documentation"]
 5 | body:
 6 |   - type: markdown
 7 |     attributes:
 8 |       value: |
 9 |         Found an issue with Context7 documentation? Let us know!
10 | 
11 |   - type: dropdown
12 |     id: doc-type
13 |     attributes:
14 |       label: Documentation Type
15 |       description: Where is the issue?
16 |       options:
17 |         - README
18 |         - Installation instructions
19 |         - API documentation
20 |         - Library-specific docs
21 |         - Configuration examples
22 |     validations:
23 |       required: true
24 | 
25 |   - type: textarea
26 |     id: issue
27 |     attributes:
28 |       label: Issue Description
29 |       description: What's wrong or missing?
30 |     validations:
31 |       required: true
32 | 
33 |   - type: input
34 |     id: location
35 |     attributes:
36 |       label: Documentation Location
37 |       description: Link or section name where the issue exists
38 |       placeholder: e.g., README.md line 45, or "Installation via Smithery" section
39 | 
40 |   - type: textarea
41 |     id: suggestion
42 |     attributes:
43 |       label: Suggested Fix
44 |       description: How should it be corrected or what should be added?
45 | 
46 |   - type: textarea
47 |     id: additional
48 |     attributes:
49 |       label: Additional Context
50 |       description: Any other relevant information
51 | 
```

--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.yml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Feature Request
 2 | description: Suggest a new feature or improvement
 3 | title: "[Feature]: "
 4 | labels: ["enhancement"]
 5 | body:
 6 |   - type: markdown
 7 |     attributes:
 8 |       value: |
 9 |         Thanks for suggesting a feature! We appreciate your input.
10 | 
11 |   - type: textarea
12 |     id: problem
13 |     attributes:
14 |       label: Problem Description
15 |       description: Is your feature request related to a problem? Please describe.
16 |       placeholder: I'm frustrated when...
17 |     validations:
18 |       required: true
19 | 
20 |   - type: textarea
21 |     id: solution
22 |     attributes:
23 |       label: Proposed Solution
24 |       description: Describe the solution you'd like
25 |       placeholder: I would like Context7 to...
26 |     validations:
27 |       required: true
28 | 
29 |   - type: textarea
30 |     id: alternatives
31 |     attributes:
32 |       label: Alternatives Considered
33 |       description: Describe any alternative solutions or features you've considered
34 | 
35 |   - type: dropdown
36 |     id: priority
37 |     attributes:
38 |       label: Priority
39 |       description: How important is this feature to you?
40 |       options:
41 |         - Nice to have
42 |         - Would improve my workflow
43 |         - Blocking my usage
44 |     validations:
45 |       required: true
46 | 
47 |   - type: textarea
48 |     id: additional
49 |     attributes:
50 |       label: Additional Context
51 |       description: Add any other context, screenshots, or examples about the feature request
52 | 
```

--------------------------------------------------------------------------------
/src/lib/encryption.ts:
--------------------------------------------------------------------------------

```typescript
 1 | import { createCipheriv, randomBytes } from "crypto";
 2 | 
 3 | const ENCRYPTION_KEY =
 4 |   process.env.CLIENT_IP_ENCRYPTION_KEY ||
 5 |   "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
 6 | const ALGORITHM = "aes-256-cbc";
 7 | 
 8 | function validateEncryptionKey(key: string): boolean {
 9 |   // Must be exactly 64 hex characters (32 bytes)
10 |   return /^[0-9a-fA-F]{64}$/.test(key);
11 | }
12 | 
13 | function encryptClientIp(clientIp: string): string {
14 |   if (!validateEncryptionKey(ENCRYPTION_KEY)) {
15 |     console.error("Invalid encryption key format. Must be 64 hex characters.");
16 |     return clientIp; // Fallback to unencrypted
17 |   }
18 | 
19 |   try {
20 |     const iv = randomBytes(16);
21 |     const cipher = createCipheriv(ALGORITHM, Buffer.from(ENCRYPTION_KEY, "hex"), iv);
22 |     let encrypted = cipher.update(clientIp, "utf8", "hex");
23 |     encrypted += cipher.final("hex");
24 |     return iv.toString("hex") + ":" + encrypted;
25 |   } catch (error) {
26 |     console.error("Error encrypting client IP:", error);
27 |     return clientIp; // Fallback to unencrypted
28 |   }
29 | }
30 | 
31 | export function generateHeaders(
32 |   clientIp?: string,
33 |   apiKey?: string,
34 |   extraHeaders: Record<string, string> = {}
35 | ): Record<string, string> {
36 |   const headers: Record<string, string> = { ...extraHeaders };
37 |   if (clientIp) {
38 |     headers["mcp-client-ip"] = encryptClientIp(clientIp);
39 |   }
40 |   if (apiKey) {
41 |     headers["Authorization"] = `Bearer ${apiKey}`;
42 |   }
43 |   return headers;
44 | }
45 | 
```

--------------------------------------------------------------------------------
/mcpb/manifest.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "dxt_version": "0.1",
 3 |   "name": "context7",
 4 |   "display_name": "Context7",
 5 |   "version": "1.0.1",
 6 |   "description": "Up-to-date Code Docs For Any Prompt",
 7 |   "long_description": "Context7 MCP pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.",
 8 |   "author": {
 9 |     "name": "Upstash",
10 |     "email": "[email protected]",
11 |     "url": "https://upstash.com"
12 |   },
13 |   "homepage": "https://context7.com",
14 |   "documentation": "https://github.com/upstash/context7",
15 |   "icon": "icon.png",
16 |   "server": {
17 |     "type": "node",
18 |     "entry_point": "dist/index.js",
19 |     "mcp_config": {
20 |       "command": "node",
21 |       "args": ["${__dirname}/dist/index.js"],
22 |       "env": {}
23 |     }
24 |   },
25 |   "tools": [
26 |     {
27 |       "name": "Resolve Context7 Library ID",
28 |       "description": "Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries."
29 |     },
30 |     {
31 |       "name": "Get Library Docs",
32 |       "description": "Fetches up-to-date documentation for a library."
33 |     }
34 |   ],
35 |   "compatibility": {
36 |     "platforms": ["darwin", "win32", "linux"],
37 |     "runtimes": {
38 |       "node": ">=v18.0.0"
39 |     }
40 |   },
41 |   "keywords": ["vibe-coding", "developer tools", "documentation", "context"],
42 |   "license": "MIT",
43 |   "repository": {
44 |     "type": "git",
45 |     "url": "git+https://github.com/upstash/context7.git"
46 |   }
47 | }
48 | 
```

--------------------------------------------------------------------------------
/.github/workflows/publish-mcp.yml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Publish to MCP Registry
 2 | 
 3 | on:
 4 |   workflow_dispatch:
 5 |     inputs:
 6 |       version:
 7 |         description: "Version to publish (defaults to package.json version)"
 8 |         required: false
 9 |         type: string
10 | 
11 | jobs:
12 |   publish-mcp:
13 |     name: Publish to MCP Registry
14 |     runs-on: ubuntu-latest
15 |     permissions:
16 |       id-token: write # Required for OIDC authentication with MCP Registry
17 |       contents: read
18 |     steps:
19 |       - name: Checkout Repo
20 |         uses: actions/checkout@v3
21 | 
22 |       - name: Setup Node
23 |         uses: actions/setup-node@v4
24 |         with:
25 |           node-version: lts/*
26 | 
27 |       - name: Set version
28 |         run: |
29 |           if [ -n "${{ inputs.version }}" ]; then
30 |             VERSION="${{ inputs.version }}"
31 |             # Remove 'v' prefix if it exists
32 |             VERSION="${VERSION#v}"
33 |           else
34 |             VERSION=$(node -p "require('./package.json').version")
35 |           fi
36 |           echo "VERSION=$VERSION" >> $GITHUB_ENV
37 |           echo "Publishing version: $VERSION"
38 | 
39 |       - name: Update package version in server.json
40 |         run: |
41 |           echo $(jq --arg v "${{ env.VERSION }}" '(.packages[0].version) = $v' server.json) > server.json
42 | 
43 |       - name: Validate server.json
44 |         run: npx mcp-registry-validator validate server.json
45 | 
46 |       - name: Install MCP Publisher
47 |         run: |
48 |           curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.3/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
49 | 
50 |       - name: Login to MCP Registry
51 |         run: ./mcp-publisher login github-oidc
52 | 
53 |       - name: Publish to MCP Registry
54 |         run: ./mcp-publisher publish
55 | 
```

--------------------------------------------------------------------------------
/src/lib/utils.ts:
--------------------------------------------------------------------------------

```typescript
 1 | import { SearchResponse, SearchResult } from "./types.js";
 2 | 
 3 | /**
 4 |  * Formats a search result into a human-readable string representation.
 5 |  * Only shows code snippet count and GitHub stars when available (not equal to -1).
 6 |  *
 7 |  * @param result The SearchResult object to format
 8 |  * @returns A formatted string with library information
 9 |  */
10 | export function formatSearchResult(result: SearchResult): string {
11 |   // Always include these basic details
12 |   const formattedResult = [
13 |     `- Title: ${result.title}`,
14 |     `- Context7-compatible library ID: ${result.id}`,
15 |     `- Description: ${result.description}`,
16 |   ];
17 | 
18 |   // Only add code snippets count if it's a valid value
19 |   if (result.totalSnippets !== -1 && result.totalSnippets !== undefined) {
20 |     formattedResult.push(`- Code Snippets: ${result.totalSnippets}`);
21 |   }
22 | 
23 |   // Only add trust score if it's a valid value
24 |   if (result.trustScore !== -1 && result.trustScore !== undefined) {
25 |     formattedResult.push(`- Trust Score: ${result.trustScore}`);
26 |   }
27 | 
28 |   // Only add versions if it's a valid value
29 |   if (result.versions !== undefined && result.versions.length > 0) {
30 |     formattedResult.push(`- Versions: ${result.versions.join(", ")}`);
31 |   }
32 | 
33 |   // Join all parts with newlines
34 |   return formattedResult.join("\n");
35 | }
36 | 
37 | /**
38 |  * Formats a search response into a human-readable string representation.
39 |  * Each result is formatted using formatSearchResult.
40 |  *
41 |  * @param searchResponse The SearchResponse object to format
42 |  * @returns A formatted string with search results
43 |  */
44 | export function formatSearchResults(searchResponse: SearchResponse): string {
45 |   if (!searchResponse.results || searchResponse.results.length === 0) {
46 |     return "No documentation libraries found matching your query.";
47 |   }
48 | 
49 |   const formattedResults = searchResponse.results.map(formatSearchResult);
50 |   return formattedResults.join("\n----------\n");
51 | }
52 | 
```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "@upstash/context7-mcp",
 3 |   "version": "1.0.0",
 4 |   "mcpName": "io.github.upstash/context7",
 5 |   "description": "MCP server for Context7",
 6 |   "scripts": {
 7 |     "test": "echo \"Error: no test specified\" && exit 1",
 8 |     "build": "tsc && chmod 755 dist/index.js",
 9 |     "format": "prettier --write .",
10 |     "lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
11 |     "lint:check": "eslint \"**/*.{js,ts,tsx}\"",
12 |     "start": "node dist/index.js --transport http",
13 |     "pack-mcpb": "bun install && bun run build && rm -rf node_modules && bun install --production && mv mcpb/.mcpbignore .mcpbignore && mv mcpb/manifest.json manifest.json && mv public/icon.png icon.png && mcpb validate manifest.json && mcpb pack . mcpb/context7.mcpb && mv manifest.json mcpb/manifest.json && mv .mcpbignore mcpb/.mcpbignore && mv icon.png public/icon.png && bun install"
14 |   },
15 |   "repository": {
16 |     "type": "git",
17 |     "url": "git+https://github.com/upstash/context7.git"
18 |   },
19 |   "keywords": [
20 |     "modelcontextprotocol",
21 |     "mcp",
22 |     "context7",
23 |     "vibe-coding",
24 |     "developer tools",
25 |     "documentation",
26 |     "context"
27 |   ],
28 |   "author": "abdush",
29 |   "license": "MIT",
30 |   "type": "module",
31 |   "bin": {
32 |     "context7-mcp": "dist/index.js"
33 |   },
34 |   "files": [
35 |     "dist"
36 |   ],
37 |   "bugs": {
38 |     "url": "https://github.com/upstash/context7/issues"
39 |   },
40 |   "homepage": "https://github.com/upstash/context7#readme",
41 |   "dependencies": {
42 |     "@modelcontextprotocol/sdk": "^1.17.5",
43 |     "@types/express": "^5.0.4",
44 |     "commander": "^14.0.0",
45 |     "express": "^5.1.0",
46 |     "undici": "^6.6.3",
47 |     "zod": "^3.24.2"
48 |   },
49 |   "devDependencies": {
50 |     "@types/node": "^22.13.14",
51 |     "@typescript-eslint/eslint-plugin": "^8.28.0",
52 |     "@typescript-eslint/parser": "^8.28.0",
53 |     "eslint": "^9.34.0",
54 |     "eslint-config-prettier": "^10.1.1",
55 |     "eslint-plugin-prettier": "^5.2.5",
56 |     "prettier": "^3.6.2",
57 |     "typescript": "^5.8.2",
58 |     "typescript-eslint": "^8.28.0"
59 |   }
60 | }
61 | 
```

--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Release
 2 | 
 3 | on:
 4 |   release:
 5 |     types:
 6 |       - published
 7 | 
 8 | jobs:
 9 |   release:
10 |     name: Release
11 |     runs-on: ubuntu-latest
12 |     permissions:
13 |       id-token: write # Required for OIDC authentication with MCP Registry
14 |       contents: read
15 |     steps:
16 |       - name: Checkout Repo
17 |         uses: actions/checkout@v3
18 | 
19 |       - name: Set env
20 |         run: |
21 |           VERSION="${GITHUB_REF##refs/*/}"
22 |           # Remove 'v' prefix if it exists
23 |           VERSION="${VERSION#v}"
24 |           echo "VERSION=$VERSION" >> $GITHUB_ENV
25 | 
26 |       - name: Setup Node
27 |         uses: actions/setup-node@v4
28 |         with:
29 |           node-version: lts/*
30 | 
31 |       - name: Setup Bun
32 |         uses: oven-sh/setup-bun@v2
33 |         with:
34 |           bun-version: latest
35 | 
36 |       - name: Set package version
37 |         run: |
38 |           echo $(jq --arg v "${{ env.VERSION }}" '(.version) = $v' package.json) > package.json
39 | 
40 |       - name: Update version in source file
41 |         run: |
42 |           sed -i "s/version: \"[0-9]*\.[0-9]*\.[0-9]*\"/version: \"${{ env.VERSION }}\"/" src/index.ts
43 | 
44 |       - name: Update package version in server.json
45 |         run: |
46 |           echo $(jq --arg v "${{ env.VERSION }}" '(.packages[0].version) = $v' server.json) > server.json
47 | 
48 |       - name: Install Dependencies
49 |         run: bun install
50 | 
51 |       - name: Build
52 |         run: bun run build
53 | 
54 |       - name: Set NPM_TOKEN
55 |         run: npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
56 | 
57 |       - name: Publish
58 |         if: "!github.event.release.prerelease"
59 |         run: |
60 |           npm pkg delete scripts.prepare
61 |           npm publish --access public
62 | 
63 |       - name: Publish release candidate
64 |         if: "github.event.release.prerelease"
65 |         run: |
66 |           npm pkg delete scripts.prepare
67 |           npm publish --access public --tag=canary
68 | 
69 |       - name: Validate server.json
70 |         if: "!github.event.release.prerelease"
71 |         run: npx mcp-registry-validator validate server.json
72 | 
73 |       - name: Install MCP Publisher
74 |         if: "!github.event.release.prerelease"
75 |         run: |
76 |           curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.3/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
77 | 
78 |       - name: Login to MCP Registry
79 |         if: "!github.event.release.prerelease"
80 |         run: ./mcp-publisher login github-oidc
81 | 
82 |       - name: Publish to MCP Registry
83 |         if: "!github.event.release.prerelease"
84 |         run: ./mcp-publisher publish
85 | 
```

--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------

```yaml
  1 | name: Bug Report
  2 | description: Report a bug or issue with Context7 MCP
  3 | title: "[Bug]: "
  4 | labels: ["bug", "needs-triage"]
  5 | body:
  6 |   - type: markdown
  7 |     attributes:
  8 |       value: |
  9 |         Thanks for taking the time to report this issue! Please fill out the form below to help us investigate.
 10 | 
 11 |   - type: dropdown
 12 |     id: client
 13 |     attributes:
 14 |       label: MCP Client
 15 |       description: Which MCP client are you using?
 16 |       options:
 17 |         - Cursor
 18 |         - Claude Desktop
 19 |         - Claude Code
 20 |         - Windsurf
 21 |         - VS Code
 22 |         - Cline
 23 |         - Zed
 24 |         - Other (specify in description)
 25 |     validations:
 26 |       required: true
 27 | 
 28 |   - type: input
 29 |     id: version
 30 |     attributes:
 31 |       label: Context7 MCP Version
 32 |       description: Which version of Context7 MCP are you using? (Check package.json or npm list)
 33 |       placeholder: e.g., 1.0.21
 34 |     validations:
 35 |       required: true
 36 | 
 37 |   - type: textarea
 38 |     id: description
 39 |     attributes:
 40 |       label: Bug Description
 41 |       description: A clear description of what the bug is
 42 |       placeholder: When I try to...
 43 |     validations:
 44 |       required: true
 45 | 
 46 |   - type: textarea
 47 |     id: steps
 48 |     attributes:
 49 |       label: Steps to Reproduce
 50 |       description: Steps to reproduce the behavior
 51 |       placeholder: |
 52 |         1. Install Context7 MCP via...
 53 |         2. Run the command...
 54 |         3. See error...
 55 |     validations:
 56 |       required: true
 57 | 
 58 |   - type: textarea
 59 |     id: expected
 60 |     attributes:
 61 |       label: Expected Behavior
 62 |       description: What you expected to happen
 63 |     validations:
 64 |       required: true
 65 | 
 66 |   - type: textarea
 67 |     id: actual
 68 |     attributes:
 69 |       label: Actual Behavior
 70 |       description: What actually happened
 71 |     validations:
 72 |       required: true
 73 | 
 74 |   - type: textarea
 75 |     id: logs
 76 |     attributes:
 77 |       label: Error Messages / Logs
 78 |       description: Please copy and paste any relevant error messages or logs
 79 |       render: shell
 80 | 
 81 |   - type: dropdown
 82 |     id: transport
 83 |     attributes:
 84 |       label: Transport Method
 85 |       description: Which transport method are you using?
 86 |       options:
 87 |         - stdio (default)
 88 |         - http
 89 |         - SSE (deprecated)
 90 |     validations:
 91 |       required: true
 92 | 
 93 |   - type: input
 94 |     id: node-version
 95 |     attributes:
 96 |       label: Node.js Version
 97 |       description: Output of `node --version`
 98 |       placeholder: e.g., v20.10.0
 99 | 
100 |   - type: input
101 |     id: os
102 |     attributes:
103 |       label: Operating System
104 |       description: Which OS are you running?
105 |       placeholder: e.g., macOS 14.2, Windows 11, Ubuntu 22.04
106 | 
107 |   - type: textarea
108 |     id: config
109 |     attributes:
110 |       label: Configuration
111 |       description: Your Context7 MCP configuration (remove any API keys!)
112 |       render: json
113 |       placeholder: |
114 |         {
115 |           "mcpServers": {
116 |             "context7": {
117 |               "command": "npx",
118 |               "args": ["-y", "@upstash/context7-mcp"]
119 |             }
120 |           }
121 |         }
122 | 
123 |   - type: textarea
124 |     id: additional
125 |     attributes:
126 |       label: Additional Context
127 |       description: Any other context about the problem (proxy settings, firewalls, etc.)
128 | 
```

--------------------------------------------------------------------------------
/public/context7-logo.svg:
--------------------------------------------------------------------------------

```
1 | <svg width="130" height="28" viewBox="0 0 130 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2 | <rect width="28" height="28" rx="4" fill="black" style="fill:black;fill-opacity:1;"/>
3 | <path d="M10.5724 15.2565C10.5724 17.5025 9.6613 19.3778 8.17805 21.1047H11.6319L11.6319 22.7786H6.33459V21.1895C7.95557 19.3566 8.58065 17.8628 8.58065 15.2565L10.5724 15.2565Z" fill="white" style="fill:white;fill-opacity:1;"/>
4 | <path d="M17.4276 15.2565C17.4276 17.5025 18.3387 19.3778 19.822 21.1047H16.3681V22.7786H21.6654V21.1895C20.0444 19.3566 19.4194 17.8628 19.4194 15.2565H17.4276Z" fill="white" style="fill:white;fill-opacity:1;"/>
5 | <path d="M10.5724 12.7435C10.5724 10.4975 9.66131 8.62224 8.17807 6.89532L11.6319 6.89532V5.22137L6.33461 5.22137V6.81056C7.95558 8.64343 8.58066 10.1373 8.58066 12.7435L10.5724 12.7435Z" fill="white" style="fill:white;fill-opacity:1;"/>
6 | <path d="M17.4276 12.7435C17.4276 10.4975 18.3387 8.62224 19.822 6.89532L16.3681 6.89532L16.3681 5.22138L21.6654 5.22138V6.81056C20.0444 8.64343 19.4194 10.1373 19.4194 12.7435H17.4276Z" fill="white" style="fill:white;fill-opacity:1;"/>
7 | <path d="M42.1 21.32C38.6 21.32 36.6 18.5 36.6 13.92C36.6 9.32 38.6 6.48 42.1 6.48C44.94 6.48 46.82 8.44 47.28 11.94L44.02 12.08C43.78 10.28 43.08 9.28 42.1 9.28C40.7 9.28 39.9 10.94 39.9 13.92C39.9 16.88 40.7 18.52 42.1 18.52C43.06 18.52 43.82 17.48 44.06 15.56L47.32 15.7C46.86 19.28 44.98 21.32 42.1 21.32ZM53.5922 21.24C50.5122 21.24 48.4322 19.04 48.4322 15.62C48.4322 12.2 50.5122 10 53.5922 10C56.6722 10 58.7522 12.2 58.7522 15.62C58.7522 19.04 56.6722 21.24 53.5922 21.24ZM53.5922 18.58C54.8722 18.58 55.5922 17.56 55.5922 15.62C55.5922 13.68 54.8722 12.66 53.5922 12.66C52.3122 12.66 51.5922 13.68 51.5922 15.62C51.5922 17.56 52.3122 18.58 53.5922 18.58ZM60.5444 21V10.24H63.3244L63.3844 12.16C63.9444 10.68 65.0844 10 66.5844 10C68.8444 10 69.8244 11.62 69.8244 14.02V21H66.7644V14.68C66.7644 13.2 66.3044 12.56 65.3444 12.56C64.4244 12.56 63.6044 13.32 63.6044 14.84V21H60.5444ZM78.2166 21C75.6766 21 74.5566 19.88 74.5566 17.5V12.62H71.6166V10.24H74.5566V7.72H77.6166V10.24H81.4966V12.62H77.6166V17.16C77.6166 18.14 78.0766 18.62 79.0766 18.62H81.4966V21H78.2166ZM88.4088 21.24C85.3888 21.24 83.2488 19.04 83.2488 15.62C83.2488 12.3 85.3488 10 88.3888 10C91.4088 10 93.5288 12.28 93.5288 15.68V16.42H86.3688C86.5088 17.8 87.3088 18.58 88.4888 18.58C89.3488 18.58 90.0088 18.14 90.2688 17.42L93.2888 17.64C92.5088 20 90.8688 21.24 88.4088 21.24ZM86.4288 14.46H90.2488C90.1288 13.28 89.4288 12.66 88.3488 12.66C87.2688 12.66 86.5688 13.3 86.4288 14.46ZM94.5009 21L98.2809 15.5L94.6609 10.24H97.9409L99.9609 13.4L101.961 10.24H105.241L101.681 15.5L105.421 21H102.161L99.9609 17.56L97.7809 21H94.5009ZM112.993 21C110.453 21 109.333 19.88 109.333 17.5V12.62H106.393V10.24H109.333V7.72H112.393V10.24H116.273V12.62H112.393V17.16C112.393 18.14 112.853 18.62 113.853 18.62H116.273V21H112.993ZM120.305 21C120.305 16.72 122.065 13 124.945 9.66H118.185V6.8H128.105V9.52C124.945 13.1 123.685 16.1 123.685 21H120.305Z" fill="black" style="fill:black;fill-opacity:1;"/>
8 | </svg>
9 | 
```

--------------------------------------------------------------------------------
/schema/context7.json:
--------------------------------------------------------------------------------

```json
  1 | {
  2 |   "$schema": "http://json-schema.org/draft-07/schema#",
  3 |   "$id": "https://context7.com/schema/context7.json",
  4 |   "title": "Context7 Configuration Schema",
  5 |   "description": "Configuration file for Context7 project parsing and documentation generation",
  6 |   "type": "object",
  7 |   "properties": {
  8 |     "projectTitle": {
  9 |       "type": "string",
 10 |       "description": "The display name for your project in Context7. This overrides the default repository name.",
 11 |       "minLength": 1,
 12 |       "maxLength": 100,
 13 |       "examples": ["Upstash Ratelimit", "Next.js", "React Query"]
 14 |     },
 15 |     "description": {
 16 |       "type": "string",
 17 |       "description": "A brief description of what your library does. This helps coding agents understand the purpose of your project.",
 18 |       "minLength": 10,
 19 |       "maxLength": 200,
 20 |       "examples": [
 21 |         "Ratelimiting library based on Upstash Redis",
 22 |         "The React Framework for Production",
 23 |         "Powerful data synchronization for React"
 24 |       ]
 25 |     },
 26 |     "folders": {
 27 |       "type": "array",
 28 |       "description": "Specific folder paths to include when parsing documentation. If empty, Context7 will scan the entire repository. Supports regex patterns and requires full paths.",
 29 |       "items": {
 30 |         "type": "string",
 31 |         "minLength": 1
 32 |       },
 33 |       "uniqueItems": true,
 34 |       "default": [],
 35 |       "examples": [
 36 |         ["docs", "guides", "examples"],
 37 |         ["documentation/**"],
 38 |         ["api-reference", "tutorials/*"]
 39 |       ]
 40 |     },
 41 |     "excludeFolders": {
 42 |       "type": "array",
 43 |       "description": "Folder paths to exclude from documentation parsing. Supports regex patterns and requires full paths.",
 44 |       "items": {
 45 |         "type": "string",
 46 |         "minLength": 1
 47 |       },
 48 |       "uniqueItems": true,
 49 |       "default": [],
 50 |       "examples": [
 51 |         ["src", "build", "node_modules"],
 52 |         ["**/test/**", "**/tests/**"],
 53 |         ["legacy/*", "archive"]
 54 |       ]
 55 |     },
 56 |     "excludeFiles": {
 57 |       "type": "array",
 58 |       "description": "Specific file names to exclude from documentation parsing. Only include the filename (not the path). Regex patterns are not supported.",
 59 |       "items": {
 60 |         "type": "string",
 61 |         "minLength": 1,
 62 |         "pattern": "^[^/\\\\]+$"
 63 |       },
 64 |       "uniqueItems": true,
 65 |       "default": [],
 66 |       "examples": [
 67 |         ["CHANGELOG.md", "LICENSE"],
 68 |         ["README-dev.md", "CONTRIBUTING.md"],
 69 |         ["package.json", "tsconfig.json"]
 70 |       ]
 71 |     },
 72 |     "rules": {
 73 |       "type": "array",
 74 |       "description": "Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context.",
 75 |       "items": {
 76 |         "type": "string",
 77 |         "minLength": 5,
 78 |         "maxLength": 200
 79 |       },
 80 |       "default": [],
 81 |       "examples": [
 82 |         ["Always use TypeScript for better type safety"],
 83 |         ["Use Upstash Redis as a database", "Use single region set up"],
 84 |         ["Import components from the main package", "Follow the naming conventions"]
 85 |       ]
 86 |     },
 87 |     "previousVersions": {
 88 |       "type": "array",
 89 |       "description": "Information about previous versions of your library that should also be available in Context7.",
 90 |       "items": {
 91 |         "type": "object",
 92 |         "properties": {
 93 |           "tag": {
 94 |             "type": "string",
 95 |             "description": "The Git tag or version identifier",
 96 |             "pattern": "^v?\\d+\\.\\d+\\.\\d+",
 97 |             "examples": ["v1.2.1", "2.0.0", "v3.1.0-beta.1"]
 98 |           },
 99 |           "title": {
100 |             "type": "string",
101 |             "description": "Human-readable version name",
102 |             "minLength": 1,
103 |             "maxLength": 50,
104 |             "examples": ["version 1.2.1", "Legacy Version", "Beta Release"]
105 |           }
106 |         },
107 |         "required": ["tag", "title"],
108 |         "additionalProperties": false
109 |       },
110 |       "default": []
111 |     }
112 |   },
113 |   "additionalProperties": false,
114 |   "examples": [
115 |     {
116 |       "projectTitle": "Upstash Ratelimit",
117 |       "description": "Ratelimiting library based on Upstash Redis",
118 |       "folders": [],
119 |       "excludeFolders": ["src"],
120 |       "excludeFiles": [],
121 |       "rules": ["Use Upstash Redis as a database", "Use single region set up"],
122 |       "previousVersions": [
123 |         {
124 |           "tag": "v1.2.1",
125 |           "title": "version 1.2.1"
126 |         }
127 |       ]
128 |     }
129 |   ]
130 | }
131 | 
```

--------------------------------------------------------------------------------
/src/lib/api.ts:
--------------------------------------------------------------------------------

```typescript
  1 | import { SearchResponse } from "./types.js";
  2 | import { generateHeaders } from "./encryption.js";
  3 | import { ProxyAgent, setGlobalDispatcher } from "undici";
  4 | 
  5 | const CONTEXT7_API_BASE_URL = "https://context7.com/api";
  6 | const DEFAULT_TYPE = "txt";
  7 | 
  8 | // Pick up proxy configuration in a variety of common env var names.
  9 | const PROXY_URL: string | null =
 10 |   process.env.HTTPS_PROXY ??
 11 |   process.env.https_proxy ??
 12 |   process.env.HTTP_PROXY ??
 13 |   process.env.http_proxy ??
 14 |   null;
 15 | 
 16 | if (PROXY_URL && !PROXY_URL.startsWith("$") && /^(http|https):\/\//i.test(PROXY_URL)) {
 17 |   try {
 18 |     // Configure a global proxy agent once at startup. Subsequent fetch calls will
 19 |     // automatically use this dispatcher.
 20 |     // Using `any` cast because ProxyAgent implements the Dispatcher interface but
 21 |     // TS may not infer it correctly in some versions.
 22 |     setGlobalDispatcher(new ProxyAgent(PROXY_URL));
 23 |   } catch (error) {
 24 |     // Don't crash the app if proxy initialisation fails – just log a warning.
 25 |     console.error(
 26 |       `[Context7] Failed to configure proxy agent for provided proxy URL: ${PROXY_URL}:`,
 27 |       error
 28 |     );
 29 |   }
 30 | }
 31 | 
 32 | /**
 33 |  * Searches for libraries matching the given query
 34 |  * @param query The search query
 35 |  * @param clientIp Optional client IP address to include in headers
 36 |  * @param apiKey Optional API key for authentication
 37 |  * @returns Search results or null if the request fails
 38 |  */
 39 | export async function searchLibraries(
 40 |   query: string,
 41 |   clientIp?: string,
 42 |   apiKey?: string
 43 | ): Promise<SearchResponse> {
 44 |   try {
 45 |     const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/search`);
 46 |     url.searchParams.set("query", query);
 47 | 
 48 |     const headers = generateHeaders(clientIp, apiKey);
 49 | 
 50 |     const response = await fetch(url, { headers });
 51 |     if (!response.ok) {
 52 |       const errorCode = response.status;
 53 |       if (errorCode === 429) {
 54 |         const errorMessage = apiKey
 55 |           ? "Rate limited due to too many requests. Please try again later."
 56 |           : "Rate limited due to too many requests. You can create a free API key at https://context7.com/dashboard for higher rate limits.";
 57 |         console.error(errorMessage);
 58 |         return {
 59 |           results: [],
 60 |           error: errorMessage,
 61 |         } as SearchResponse;
 62 |       }
 63 |       if (errorCode === 401) {
 64 |         const errorMessage =
 65 |           "Unauthorized. Please check your API key. The API key you provided (possibly incorrect) is: " +
 66 |           apiKey +
 67 |           ". API keys should start with 'ctx7sk'";
 68 |         console.error(errorMessage);
 69 |         return {
 70 |           results: [],
 71 |           error: errorMessage,
 72 |         } as SearchResponse;
 73 |       }
 74 |       const errorMessage = `Failed to search libraries. Please try again later. Error code: ${errorCode}`;
 75 |       console.error(errorMessage);
 76 |       return {
 77 |         results: [],
 78 |         error: errorMessage,
 79 |       } as SearchResponse;
 80 |     }
 81 |     return await response.json();
 82 |   } catch (error) {
 83 |     const errorMessage = `Error searching libraries: ${error}`;
 84 |     console.error(errorMessage);
 85 |     return { results: [], error: errorMessage } as SearchResponse;
 86 |   }
 87 | }
 88 | 
 89 | /**
 90 |  * Fetches documentation context for a specific library
 91 |  * @param libraryId The library ID to fetch documentation for
 92 |  * @param options Options for the request
 93 |  * @param clientIp Optional client IP address to include in headers
 94 |  * @param apiKey Optional API key for authentication
 95 |  * @returns The documentation text or null if the request fails
 96 |  */
 97 | export async function fetchLibraryDocumentation(
 98 |   libraryId: string,
 99 |   options: {
100 |     tokens?: number;
101 |     topic?: string;
102 |   } = {},
103 |   clientIp?: string,
104 |   apiKey?: string
105 | ): Promise<string | null> {
106 |   try {
107 |     if (libraryId.startsWith("/")) {
108 |       libraryId = libraryId.slice(1);
109 |     }
110 |     const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/${libraryId}`);
111 |     if (options.tokens) url.searchParams.set("tokens", options.tokens.toString());
112 |     if (options.topic) url.searchParams.set("topic", options.topic);
113 |     url.searchParams.set("type", DEFAULT_TYPE);
114 | 
115 |     const headers = generateHeaders(clientIp, apiKey, { "X-Context7-Source": "mcp-server" });
116 | 
117 |     const response = await fetch(url, { headers });
118 |     if (!response.ok) {
119 |       const errorCode = response.status;
120 |       if (errorCode === 429) {
121 |         const errorMessage = apiKey
122 |           ? "Rate limited due to too many requests. Please try again later."
123 |           : "Rate limited due to too many requests. You can create a free API key at https://context7.com/dashboard for higher rate limits.";
124 |         console.error(errorMessage);
125 |         return errorMessage;
126 |       }
127 |       if (errorCode === 404) {
128 |         const errorMessage =
129 |           "The library you are trying to access does not exist. Please try with a different library ID.";
130 |         console.error(errorMessage);
131 |         return errorMessage;
132 |       }
133 |       if (errorCode === 401) {
134 |         const errorMessage =
135 |           "Unauthorized. Please check your API key. The API key you provided (possibly incorrect) is: " +
136 |           apiKey +
137 |           ". API keys should start with 'ctx7sk'";
138 |         console.error(errorMessage);
139 |         return errorMessage;
140 |       }
141 |       const errorMessage = `Failed to fetch documentation. Please try again later. Error code: ${errorCode}`;
142 |       console.error(errorMessage);
143 |       return errorMessage;
144 |     }
145 |     const text = await response.text();
146 |     if (!text || text === "No content available" || text === "No context data available") {
147 |       return null;
148 |     }
149 |     return text;
150 |   } catch (error) {
151 |     const errorMessage = `Error fetching library documentation. Please try again later. ${error}`;
152 |     console.error(errorMessage);
153 |     return errorMessage;
154 |   }
155 | }
156 | 
```

--------------------------------------------------------------------------------
/docs/adding-projects.md:
--------------------------------------------------------------------------------

```markdown
  1 | # Adding Projects to Context7
  2 | 
  3 | Context7 allows you to add your favorite libraries and frameworks to help developers get up-to-date documentation directly in their coding environment.
  4 | 
  5 | ## Quick Submission
  6 | 
  7 | The easiest way to add a library is through our web interface:
  8 | 
  9 | **[Submit a Library →](https://context7.com/add-library?tab=github)**
 10 | 
 11 | Simply provide the GitHub repository URL and Context7 will automatically parse and index the project's documentation.
 12 | 
 13 | ## Advanced Configuration with `context7.json`
 14 | 
 15 | For more control over how Context7 parses and presents your library, you can add a `context7.json` file to the root of your repository. This file works similar to `robots.txt` and tells Context7 how to handle your project.
 16 | 
 17 | ### Configuration Fields
 18 | 
 19 | Here's an example `context7.json` file with all available options:
 20 | 
 21 | ```json
 22 | {
 23 |   "$schema": "https://context7.com/schema/context7.json",
 24 |   "projectTitle": "Upstash Ratelimit",
 25 |   "description": "Ratelimiting library based on Upstash Redis",
 26 |   "folders": [],
 27 |   "excludeFolders": ["src"],
 28 |   "excludeFiles": [],
 29 |   "rules": ["Use Upstash Redis as a database", "Use single region set up"],
 30 |   "previousVersions": [
 31 |     {
 32 |       "tag": "v1.2.1"
 33 |     }
 34 |   ]
 35 | }
 36 | ```
 37 | 
 38 | > **💡 Pro Tip**: Including the `$schema` field enables autocomplete, validation, and helpful tooltips in modern code editors like VS Code, making it easier to create and maintain your configuration.
 39 | 
 40 | ## Field Descriptions
 41 | 
 42 | - **`projectTitle`** (string): Suggested display name for your project in Context7. Only used when LLM
 43 |   can not generate a name with high confidence.
 44 | 
 45 | - **`description`** (string): Suggested description for your project in Context7. Only used when LLM can
 46 |   not generate a name with high confidence.
 47 | 
 48 | - **`branch`** (string): The name of the git branch to parse. If not provided, the default branch will
 49 |   be used.
 50 | 
 51 | - **`folders`** (array): Specific folder paths to include when parsing documentation. If empty, Context7
 52 |   will scan the entire repository for relevant documentation files. Note: Root-level markdown files are
 53 |   always included regardless of this setting.
 54 | 
 55 | - **`excludeFolders`** (array): Patterns to exclude folders and paths from documentation parsing.
 56 |   Supports simple names, paths, and glob patterns (see Exclusion Patterns section below).
 57 | 
 58 | - **`excludeFiles`** (array): Specific file names to exclude from documentation parsing. Only include
 59 |   the filename (not the path). Useful for excluding files like `CHANGELOG.md`, license files, or other
 60 |   non-documentation content.
 61 | 
 62 | - **`rules`** (array): Best practices or important guidelines that coding agents should follow when
 63 |   using your library. These appear as recommendations in the documentation context provided to coding
 64 |   agents.
 65 | 
 66 | - **`previousVersions`** (array): Information about previous versions of your library that should also
 67 |   be available in Context7.
 68 |   - **`tag`**: The Git tag or version identifier
 69 | 
 70 | - **`branchVersions`** (array): Information about previous versions (branch based) of your library that should also
 71 |   be available in Context7.
 72 |   - **`branch`**: The Git branch
 73 | 
 74 | ### Exclusion Patterns
 75 | 
 76 | The `excludeFolders` parameter supports various pattern types for flexible exclusion:
 77 | 
 78 | - **Simple folder names**: `"node_modules"` - Excludes any folder named "node_modules" anywhere in the
 79 |   tree
 80 | - **Root-specific patterns**: `"./xyz"` - Excludes folder only at repository root (e.g., excludes `/xyz`
 81 |   but not `/dist/xyz`)
 82 | - **Path patterns**: `"app-sdk/v2.3"` - Excludes specific paths and everything under them
 83 | - **Glob patterns**: `"*.test"`, `"temp*"` - Excludes folders matching the pattern
 84 | - **Globstar patterns**: `"**/dist"`, `"docs/**/internal"` - Advanced path matching
 85 | - **Complex patterns**: `"src/**/*.test.js"` - Exclude test files in src directory
 86 | 
 87 | Examples:
 88 | 
 89 | - `"node_modules"` - Excludes all node_modules folders anywhere
 90 | - `"./build"` - Excludes build folder only at root (not `src/build`)
 91 | - `"app-sdk/v2.3"` - Excludes app-sdk/v2.3 path and all its contents
 92 | - `"*.test"` - Excludes folders ending with .test
 93 | - `"docs/**/internal"` - Excludes any "internal" folder under docs
 94 | - `"**/temp"` - Excludes any folder named "temp" anywhere
 95 | 
 96 | ### Default Exclusions
 97 | 
 98 | If you don't specify `excludeFiles` or `excludeFolders` in your `context7.json`, Context7 uses these default patterns:
 99 | 
100 | #### Default Excluded Files
101 | 
102 | ```
103 | CHANGELOG.md, changelog.md, CHANGELOG.mdx, changelog.mdx
104 | LICENSE.md, license.md
105 | CODE_OF_CONDUCT.md, code_of_conduct.md
106 | ```
107 | 
108 | #### Default Excluded Folders
109 | 
110 | ```
111 | *archive*, *archived*, old, docs/old, *deprecated*, *legacy*
112 | *previous*, *outdated*, *superseded*
113 | i18n/zh*, i18n/es*, i18n/fr*, i18n/de*, i18n/ja*, i18n/ko*
114 | i18n/ru*, i18n/pt*, i18n/it*, i18n/ar*, i18n/hi*, i18n/tr*
115 | i18n/nl*, i18n/pl*, i18n/sv*, i18n/vi*, i18n/th*
116 | zh-cn, zh-tw, zh-hk, zh-mo, zh-sg
117 | ```
118 | 
119 | These defaults help ensure that coding agents receive relevant, current documentation without outdated or non-technical content.
120 | 
121 | ## Who Can Add Configuration?
122 | 
123 | - **Library authors**: Add `context7.json` directly to your repository
124 | - **Contributors**: Submit pull requests to add or update the configuration
125 | - **Community members**: Propose improvements to how popular libraries are parsed
126 | 
127 | ## Best Practices
128 | 
129 | 1. **Keep descriptions concise**: Aim for one clear sentence that explains your library's purpose to coding agents
130 | 2. **Exclude irrelevant folders**: Use `excludeFolders` to avoid indexing source code, tests, or build artifacts
131 | 3. **Add helpful rules**: Include common gotchas or best practices that coding agents should know when generating code
132 | 4. **Maintain version history**: Keep important previous versions accessible for projects that need older APIs
133 | 
134 | ## Adding a Version
135 | 
136 | To add a new version to your existing library:
137 | 
138 | 1. **Add version to the `context7.json` file**: Update the `previousVersions` array with your new version:
139 | 
140 |    ```json
141 |    "previousVersions": [
142 |      {
143 |        "tag": "v2.0.0",
144 |        "title": "version 2.0.0"
145 |      }
146 |    ]
147 |    ```
148 | 
149 |    > **Note**: The `tag` value must exactly match an existing Git tag in your GitHub repository.
150 | 
151 | 2. **Refresh your library**: Go to your library page on Context7 and trigger a refresh to index the new version.
152 | 
153 | ## Need Help?
154 | 
155 | If you encounter issues or need assistance adding your project, please [report an issue](https://context7.com/add-library?tab=github) or reach out to our community.
156 | 
```
Page 2/3FirstPrevNextLast