Compare commits

...

126 Commits

Author SHA1 Message Date
Enes Gules
13b7e107b4
Merge pull request #365 from komoechan/add-trae-instructions 2025-07-03 08:31:52 +03:00
Enes Akar
7c8267f7ba
Update README.md 2025-07-02 14:55:04 +03:00
Enes Akar
68b75c77ef
Merge pull request #366 from Elifnurdeniz/master
chore: Update README.md
2025-07-02 14:44:33 +03:00
Elif Nur Deniz
e6bf5b80c2
Update README.md 2025-07-02 14:41:12 +03:00
Kanako
0385f9b0db add-trae-instructions 2025-07-02 19:15:22 +08:00
Kanako
526e6040a3 add-trae-instructions 2025-07-02 19:05:05 +08:00
enesgules
2c5d40aa96 fix: Update release workflow to remove 'v' prefix from version variable 2025-06-30 11:16:25 +03:00
Enes Gules
f18bbe4614
Merge pull request #336 from zadazorg/patch-1 2025-06-26 10:36:04 +03:00
Enes Gules
98cd24504d
Merge pull request #337 from Ifan24/add-gemini-cli-instructions 2025-06-26 10:34:50 +03:00
Ruiqi
6dd432d5e0 docs: add Gemini CLI installation instructions 2025-06-26 01:32:52 +10:00
Zada Zorg
d38be6d974
Update README.md with Warp integration instructions 2025-06-25 18:04:01 +03:00
Enes Gules
6b921c273e
Merge pull request #334 from w2xi/w2xi-patch-1 2025-06-25 16:45:24 +03:00
Enes Gules
dc215a85b2
Merge pull request #325 from philfung/master 2025-06-25 16:36:57 +03:00
Philip Fung
5446003880 README: added Cline to installation list 2025-06-25 06:30:54 -07:00
Philip Fung
eeb654584d
Merge branch 'upstash:master' into master 2025-06-25 06:28:59 -07:00
Philip Fung
fb0d7875d1 Revert "README: sorting the installation instructions by coding tool in alphabetical order"
This reverts commit 61b07d96d9c5103df8a399f6c3fec6f7e6b78acb.
2025-06-25 06:26:56 -07:00
Philip Fung
e85d3d8a34 Revert "added installation instructions for cline"
This reverts commit 835f674696576bc3e9a0f2a025ef22ad2dda9a10.
2025-06-25 06:26:38 -07:00
Philip Fung
ed30ceaad3 Revert "added cline link to readme"
This reverts commit 786693f7885eddb95649e2d29883afdff4e408db.
2025-06-25 06:26:10 -07:00
w2xi
f9d2b056b4
docs: fix typo 2025-06-25 17:31:17 +08:00
Enes Gules
9adaee2a17
Merge pull request #330 from niklas-wortmann/add-jetbrains 2025-06-24 23:55:04 +03:00
Jan-Niklas Wortmann
955188ecb2 README: add JetBrains AI Assistant installation instructions 2025-06-24 11:50:38 -05:00
enesgules
bcc3b97f3d docs: Update README with additional Claude Code remote server connection instructions 2025-06-24 09:38:49 +03:00
Philip Fung
786693f788 added cline link to readme 2025-06-23 08:14:29 -07:00
Philip Fung
835f674696 added installation instructions for cline 2025-06-23 08:11:35 -07:00
Philip Fung
61b07d96d9 README: sorting the installation instructions by coding tool in alphabetical order 2025-06-22 20:48:55 -07:00
Enes Gules
cef57953c4
Merge pull request #318 from InTheCloudDan/dob/qodoGen 2025-06-21 12:22:42 +03:00
Dan OBrien
a175d48a1d link to agentic docs 2025-06-20 17:19:42 -04:00
Dan OBrien
8bc69debdc Add Qodo Gen MCP instructions 2025-06-20 16:04:00 -04:00
Enes Gules
b5735ebc50
Merge pull request #305 from jnst/feature/japanese-readme 2025-06-18 18:54:14 +03:00
jnst
a47a3026f3 docs: Add Japanese translation 2025-06-18 16:59:39 +09:00
Enes Gules
e057538e9b
Merge pull request #294 from techcow2/my-documentation-update 2025-06-16 10:06:01 +03:00
techcow2
59fc2b4efd Add instructions for AugmentCode 2025-06-14 03:47:39 -04:00
Enes Gules
069044e99e
Merge pull request #291 from ryanleecode/chore/deno-read-me 2025-06-13 20:20:54 +03:00
Ryan Lee
e58addd388
chore: update deno readme
There's no reason to allow broad based access to all environment variables. As of right now, there is only the downstream dependency depd (https://github.com/dougwilson/nodejs-depd) which require the NO_DEPRECATION, TRACE_DEPRECATION. Lets limit the env variables to just this alone.

Also it advisible to setup some sort of CI to ensure these always work.
2025-06-13 10:03:36 -04:00
Enes Gules
d2083b92a7
Merge pull request #283 from nielthiart/fix-initialize-result 2025-06-13 09:40:22 +03:00
Enes Gules
7005d7d123
Merge pull request #287 from jongalloway/add-visual-studio 2025-06-13 09:28:21 +03:00
Jon Galloway
a0a94eefe2 docs: add installation instructions for Visual Studio 2022 2025-06-12 21:07:45 +00:00
Niel Thiart
fd2a2d6299
fix: Fix InitializeResult schema mismatch in Context7 server response
The response from the server was not matching the expected `InitializeResult` schema [^1].

1. The `serverInfo` field contained a `description` that was not part of the schema.
2. The `capabilities` field was incorrectly nested in `serverInfo`.
3. The `capabilities` field in the response included `resources`, even though this server does not support resources.

This change also adds an `instructions` field to the response, which provides guidance on how to use the server.

The SDK takes care of registering capabilities [^2], so we don't need to add this when instantiating the `server` object.

Response does not match `InitializeResult` schema:

```json
{
  "capabilities": {
    "tools": {
      "listChanged": true
    }
  },
  "serverInfo": {
    "name": "Context7",
    "version": "1.0.13",
    "description": "Retrieves up-to-date documentation and code examples for any library.",
    "capabilities": {
      "resources": {},
      "tools": {}
    }
  }
}
```

Response matches `InitializeResult` schema:

```json
{
  "capabilities": {
    "tools": {
      "listChanged": true
    }
  },
  "serverInfo": {
    "name": "Context7",
    "version": "1.0.13"
  },
  "instructions": "Use this server to retrieve up-to-date documentation and code examples for any library."
}
```

[^1]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-03-26/schema.ts#L179-L193

[^2]: 2cf4f0ca86/src/server/mcp.ts (L101)

Fixes https://github.com/upstash/context7/issues/282
2025-06-12 12:06:35 +02:00
Enes Akar
0bf9466a14
Merge pull request #278 from upstash/feat/replace-env-vars-with-cli-args
Feat/replace env vars with cli args
2025-06-11 22:17:47 +03:00
Enes Gules
6a3c48a89f
Merge branch 'master' into feat/replace-env-vars-with-cli-args 2025-06-11 15:14:22 +03:00
Enes Gules
f109390e00
Merge pull request #273 from ryof/master 2025-06-11 15:13:45 +03:00
Enes Gules
80e4aea67e
Merge branch 'master' into feat/replace-env-vars-with-cli-args 2025-06-11 15:01:13 +03:00
Abdusshh
4f04e02851 refactor: replace url.parse with URL API for session ID extraction and validate transports 2025-06-11 14:58:26 +03:00
Abdusshh
2e6c9a6c6b feat: replace env vars with CLI arguments, remove dotenv and add commander 2025-06-11 14:49:50 +03:00
ryof
2a3101dc43
docs: add installation instructions for Amazon Q Developer CLI 2025-06-11 10:11:12 +09:00
Enes Gules
00937fafef
Merge pull request #271 from viborc/patch-1 2025-06-10 09:19:37 +03:00
Vibor Cipan
62ee37d861
Adds instructions for Zencoder.ai 2025-06-09 14:45:00 +02:00
Enes Akar
1042650638
Merge pull request #265 from upstash/feat/improve-error-messages
feat: improve error handling
2025-06-07 05:24:23 +03:00
Abdusshh
e66cdafe3c chore(format): run prettier 2025-06-07 00:24:20 +03:00
Abdusshh
a7b11bbee7 feat: improve error handling and response types for library search and documentation fetch 2025-06-07 00:20:52 +03:00
Enes Gules
f2f367d891
Merge pull request #262 from unbyte/docs/cursor-deeplink 2025-06-06 14:18:20 +03:00
Enes Gules
8a8cfa1c82
Merge pull request #248 from vaporif/update-lockfile 2025-06-05 22:15:48 +03:00
Enes Gules
6629783835
Merge pull request #249 from appleboy/docs 2025-06-05 22:06:12 +03:00
Enes Gules
be254b0f02
Merge pull request #255 from likweitan/master 2025-06-05 22:05:25 +03:00
unbyte
51ca970eeb docs: add deeplink for cursor 2025-06-06 01:01:03 +08:00
likweitan
71fb2eaeca docs: add installation instructions for Roo Code MCP integration 2025-06-03 21:43:13 +08:00
Bo-Yi Wu
8a275cb6da
chore: refactor codebase for improved maintainability and clarity
- No changes detected in the provided diff.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-06-02 11:40:15 +08:00
Bo-Yi Wu
f112d360c6
docs: refine documentation badges for Chinese language variants
- Add separate badges for Traditional Chinese and Simplified Chinese documentation in the main README
- Remove the multi-language badges line from the Traditional Chinese documentation file

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-06-02 11:39:15 +08:00
Bo-Yi Wu
b1445c2a40
docs: add Traditional Chinese documentation and setup guides
- Add Traditional Chinese (zh-TW) documentation for Context7 MCP, including installation, configuration, usage, troubleshooting, and platform-specific setup instructions.
- Provide detailed setup guides for multiple editors and environments, such as Cursor, Windsurf, VS Code, Zed, Claude, BoltAI, Docker, Windows, and Augment Code.
- Include environment variable configuration and troubleshooting tips for common issues.
- Add disclaimers regarding community contributions and project accuracy.
- List media coverage and community links for further information.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-06-02 11:37:11 +08:00
Abdusshh
2f74fa3893 docs: add installation instructions for Augment Code editor integration 2025-06-01 22:27:59 +03:00
Enes Gules
10c0a0dd33
Merge pull request #245 from Turtle-Hwan/patch-1 2025-06-01 21:56:57 +03:00
Dmytro Onypko
ae6618cd15
upd 2025-06-01 16:54:41 +01:00
Dmytro Onypko
beb04d3267
set branches 2025-06-01 16:46:00 +01:00
Dmytro Onypko
043bbd5fcc
concurrency cancel 2025-06-01 16:44:55 +01:00
Dmytro Onypko
5ac6fa1401
upd 2025-06-01 16:42:50 +01:00
Dmytro Onypko
e0775b3fa2
add simple ci 2025-06-01 16:41:55 +01:00
Dmytro Onypko
fcd166d95f
update lockfile 2025-06-01 16:22:37 +01:00
enesakar
c78b9bc54d organize readme 2025-06-01 09:56:18 +03:00
enesakar
49e05298a4 update readme, make installation steps collapbile 2025-06-01 09:45:10 +03:00
enesakar
b425c6d2ea update docs 2025-05-30 21:08:56 -07:00
enesakar
fce7023012 Merge branch 'get-library-id-from-user' 2025-05-30 14:00:55 -07:00
enesakar
93b06e17e3 json md 2025-05-30 13:58:16 -07:00
김지환 Jihwan Kim
7675df0999
docs: change VS Code usage snippet for context7 mcp server 2025-05-30 18:55:23 +09:00
Enes Gules
0a6273f6ac
Merge pull request #238 from arjunkmrm/master 2025-05-30 00:17:45 +03:00
arjunkmrm
1de2b52a55 Revert "update port to follow project defaults"
This reverts commit c55bfebb3fc9100cb93ffc73073916c0e34d35db.
2025-05-28 11:26:30 -07:00
arjunkmrm
c55bfebb3f update port to follow project defaults 2025-05-28 11:22:38 -07:00
arjunkmrm
6490a81afb feat: support http on smithery 2025-05-28 09:53:26 -07:00
Abdusshh
1755da4d49 docs: add remote server connection instructions for VS Code and Claude Code 2025-05-28 16:43:37 +03:00
Enes Gules
70b7b49d5f
Merge pull request #208 from upstash/sse-http-support 2025-05-28 14:42:06 +03:00
Abdusshh
d513d1a59f feat: add port fallback mechanism when initial port is in use 2025-05-28 14:37:30 +03:00
Abdusshh
f8472ff1ec docs: update and format README 2025-05-28 12:32:10 +03:00
Abdusshh
16d64493f3 chore: bump version to 1.0.13 and run formatter 2025-05-28 12:31:03 +03:00
buggyhunter
8222f21183 added sse http support 2025-05-28 00:48:25 +03:00
buggyhunter
e2952e9a39 added sse http support 2025-05-28 00:38:00 +03:00
buggyhunter
b9749394fb added sse http support 2025-05-28 00:37:30 +03:00
buggyhunter
c2f695d377 added sse http support 2025-05-28 00:34:49 +03:00
Enes Akar
2628a868c2
Merge pull request #228 from upstash/refactor/remove-user-query-logs
refactor: remove userQuery parameter
2025-05-26 09:03:56 -07:00
Abdusshh
e7047b4f16 refactor: remove userQuery parameter and header from library documentation fetch 2025-05-26 18:55:16 +03:00
Enes Akar
decae95458
Merge pull request #222 from upstash/feat/log-user-query
feat: add user query parameter to documentation fetch requests
2025-05-24 16:16:02 -07:00
Abdusshh
da11fccf75 feat: add user query parameter to documentation fetch requests 2025-05-24 19:33:15 +03:00
Enes Akar
b0352b17e7
Merge pull request #221 from upstash/pr-207
feat: version support
2025-05-24 08:15:07 -07:00
Abdusshh
e50ee0dfd3 refactor: remove folders parameter support from library documentation fetching 2025-05-24 17:59:10 +03:00
Abdusshh
ce2a63a37a feat: add version support in search results and update descriptions 2025-05-24 17:57:46 +03:00
Enes Gules
886a65562a
Merge pull request #219 from ladmol/master 2025-05-24 14:54:58 +03:00
Dmitriy Lapin
197bf1c27e docs: remove @latest tag from context7 MCP installation commands 2025-05-24 00:58:39 +03:00
Dmitriy Lapin
44dbfba424 docs: add section on TLS/certificate issues 2025-05-24 00:43:06 +03:00
Dmitriy Lapin
d15109d326 docs: add contact information 2025-05-23 20:15:17 +03:00
Dmitriy Lapin
52786950a5 docs: update section title 2025-05-23 20:09:08 +03:00
enesakar
d29a9457f3 version support in mcp 2025-05-22 11:41:03 -07:00
Enes Gules
9d869a6927
Update README.md 2025-05-19 23:24:26 +03:00
Enes Gules
ec1aaff477
Update README.md 2025-05-19 23:22:30 +03:00
enesakar
5fc52df93c fix: allow user to set libraryid in prompt 2025-05-19 11:18:42 -07:00
Enes Akar
35d4a10270
Update README.md 2025-05-17 16:06:42 -07:00
Enes Akar
a847b57140
Update README.md 2025-05-17 16:04:01 -07:00
Enes Akar
8610ec8814
Merge pull request #198 from upstash/feat/trust-scores
refactor: replace GitHub stars with trust score in search results
2025-05-17 16:01:48 -07:00
Abdusshh
5326cc3890 refactor: replace GitHub stars with trust score in search results and API types 2025-05-17 02:49:46 +03:00
Enes Gules
2da555d310
Merge pull request #183 from ahmedriad1/master 2025-05-12 16:26:43 +03:00
ahmedriad1
ae8bb764d2 docs: add arabic docs link to README.md 2025-05-12 13:20:12 +03:00
ahmedriad1
523fc5fdde docs: add arabic docs 2025-05-12 13:19:48 +03:00
Enes Gules
eafcf592bb
Merge pull request #173 from mmurdockk/master 2025-05-11 21:24:26 +03:00
Enes Gules
f38c39f3a8
Merge pull request #177 from ladmol/master 2025-05-10 12:02:48 +03:00
Dmitriy Lapin
dd2a68c019 docs: improve formatting 2025-05-10 00:37:39 +03:00
Dmitriy Lapin
942a9e16a8 docs: add installation instructions for BoltAI integration 2025-05-10 00:37:39 +03:00
Dmitriy Lapin
cd0dce5926 docs: update Windows installation and modify command arguments 2025-05-10 00:37:38 +03:00
Dmitriy Lapin
ebc1dbc79e docs: update minimum tokens requirement and add new video references 2025-05-10 00:21:45 +03:00
Adrien Gooris
6435f1b27f
docs: Update README.fr.md with installation instructions for BoltAI and Windows, and improve formatting 2025-05-09 10:46:12 +02:00
Enes Gules
e9d951ca8c
Merge pull request #170 from thaikolja/master 2025-05-09 03:40:09 +03:00
Enes Gules
fcd7310c34
Merge pull request #166 from citizenll/fix_windows_npx 2025-05-09 01:42:05 +03:00
Kolja Nolte
9a571f2132
README.md installation documentation for BoltAI 2025-05-09 05:07:44 +07:00
citizenl
1755903edf docs: Adding Notes on Using MCP in Windows Systems 2025-05-08 10:13:53 +08:00
Enes Akar
cb01c51100
Merge pull request #168 from upstash/feat/improve-formatting 2025-05-07 16:48:37 -07:00
Abdusshh
459e63d771 feat: improve search result formatting to handle missing data gracefully 2025-05-08 02:47:30 +03:00
Enes Gules
171b298f7a
Update README.md 2025-05-06 13:45:05 +03:00
Enes Gules
de773c1dfd
Merge pull request #154 from ErdemCanK/translation-turkish-readme 2025-05-05 00:12:09 +03:00
ErdemCanK
22e34fa4bf Turkish button also added on tr readme 2025-05-04 19:06:10 +03:00
ErdemCanK
15f30c7bae [Translation] Turkish README added 2025-05-04 18:55:14 +03:00
25 changed files with 3435 additions and 418 deletions

44
.github/workflows/check.yaml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Build Check
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run linter
run: bun run lint:check
- name: Check formatting
run: bun run format --check
- name: Build project
run: bun run build

View File

@ -14,7 +14,11 @@ jobs:
uses: actions/checkout@v3
- name: Set env
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
run: |
VERSION="${GITHUB_REF##refs/*/}"
# Remove 'v' prefix if it exists
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v3

1
.gitignore vendored
View File

@ -173,3 +173,4 @@ dist
# Finder (MacOS) folder config
.DS_Store
package-lock.json

View File

@ -25,7 +25,8 @@ COPY package.json ./
# Install only production dependencies
RUN npm install --production --ignore-scripts
# Expose no ports (stdio only)
# Expose HTTP port
EXPOSE 8080
# Default command
CMD ["node", "dist/index.js"]
# Default command using CLI flags
CMD ["node", "dist/index.js", "--transport", "http", "--port", "8080"]

637
README.md
View File

@ -2,7 +2,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) [<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)
[![中文文档](https://img.shields.io/badge/docs-中文版-yellow)](./docs/README.zh-CN.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-繁體中文-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) [![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)
## ❌ Without Context7
@ -19,11 +19,11 @@ Context7 MCP pulls up-to-date, version-specific documentation and code examples
Add `use context7` to your prompt in Cursor:
```txt
Create a basic Next.js project with app router. use context7
Create a Next.js middleware that checks for a valid JWT in cookies and redirects unauthenticated users to `/login`. use context7
```
```txt
Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7
Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7
```
Context7 fetches up-to-date code examples and documentation right into your LLM's context.
@ -34,33 +34,63 @@ Context7 fetches up-to-date code examples and documentation right into your LLM'
No tab-switching, no hallucinated APIs that don't exist, no outdated code generations.
## 🛠️ Getting Started
## 📚 Adding Projects
Check out our [project addition guide](./docs/adding-projects.md) to learn how to add (or update) your favorite libraries to Context7.
## 🛠️ Installation
### Requirements
- Node.js >= v18.0.0
- Cursor, Windsurf, Claude Desktop or another MCP Client
### Installing via Smithery
<details>
<summary><b>Installing via Smithery</b></summary>
To install Context7 MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
To install Context7 MCP Server for any client automatically via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
```bash
npx -y @smithery/cli install @upstash/context7-mcp --client claude
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
```
### Install in Cursor
You can find your Smithery key in the [Smithery.ai webpage](https://smithery.ai/server/@upstash/context7-mcp).
</details>
<details>
<summary><b>Install in Cursor</b></summary>
Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
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.
> Since Cursor 1.0, you can click the install button below for instant one-click installation.
#### Cursor Remote Server Connection
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
```json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### Cursor Local Server Connection
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -69,12 +99,14 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
<details>
<summary>Alternative: Use Bun</summary>
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D)
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -85,12 +117,14 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
<details>
<summary>Alternative: Use Deno</summary>
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
```json
{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
"args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}
@ -98,41 +132,154 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
</details>
### Install in Windsurf
</details>
<details>
<summary><b>Install in Windsurf</b></summary>
Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.windsurf.com/windsurf/mcp) for more info.
#### Windsurf Remote Server Connection
```json
{
"mcpServers": {
"context7": {
"serverUrl": "https://mcp.context7.com/sse"
}
}
}
```
#### Windsurf Local Server Connection
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
### Install in VS Code
</details>
<details>
<summary><b>Install in Trae</b></summary>
Use the Add manually feature and fill in the JSON configuration information for that MCP server.
For more details, visit the [Trae documentation](https://docs.trae.ai/ide/model-context-protocol?_lang=en).
#### Trae Remote Server Connection
```json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### Trae Local Server Connection
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
]
}
}
}
```
</details>
<details>
<summary><b>Install in VS Code</b></summary>
[<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)
[<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)
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.
#### VS Code Remote Server Connection
```json
{
"mcp": {
"servers": {
"Context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}
```
### Install in Zed
#### VS Code Local Server Connection
```json
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>Install in Visual Studio 2022</b></summary>
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).
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):
```json
{
"mcp": {
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}
}
```
Or, for a local server:
```json
{
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
}
```
For more information and troubleshooting, refer to the [Visual Studio MCP Servers documentation](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
</details>
<details>
<summary><b>Install in Zed</b></summary>
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.
@ -142,7 +289,7 @@ It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Contex
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
},
"settings": {}
}
@ -150,15 +297,58 @@ It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Contex
}
```
### Install in Claude Code
</details>
<details>
<summary><b>Install in Gemini CLI</b></summary>
See [Gemini CLI Configuration](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md) for details.
1. Open the Gemini CLI settings file. The location is `~/.gemini/settings.json` (where `~` is your home directory).
2. Add the following to the `mcpServers` object in your `settings.json` file:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
If the `mcpServers` object does not exist, create it.
</details>
<details>
<summary><b>Install in Claude Code</b></summary>
Run this command. See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) for more info.
#### Claude Code Remote Server Connection
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
claude mcp add --transport http context7 https://mcp.context7.com/mcp
```
### Install in Claude Desktop
Or using SSE transport:
```sh
claude mcp add --transport sse context7 https://mcp.context7.com/sse
```
#### Claude Code Local Server Connection
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp
```
</details>
<details>
<summary><b>Install in Claude Desktop</b></summary>
Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user) for more info.
@ -167,13 +357,50 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
### Using Docker
</details>
<details>
<summary>
<b>Install in Cline</b>
</summary>
You can easily install Context7 through the [Cline MCP Server Marketplace](https://cline.bot/mcp-marketplace) by following these instructions:
1. Open **Cline**.
1. Click the hamburger menu icon (☰) to enter the **MCP Servers** section.
2. Use the search bar within the **Marketplace** tab to find *Context7*.
3. Click the **Install** button.
</details>
<details>
<summary><b>Install in BoltAI</b></summary>
Open the "Settings" page of the app, navigate to "Plugins," and enter the following JSON:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
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).
</details>
<details>
<summary><b>Using Docker</b></summary>
If you prefer to run the MCP server in a Docker container:
@ -190,7 +417,7 @@ If you prefer to run the MCP server in a Docker container:
WORKDIR /app
# Install the latest version globally
RUN npm install -g @upstash/context7-mcp@latest
RUN npm install -g @upstash/context7-mcp
# Expose default port if needed (optional, depends on MCP client interaction)
# EXPOSE 3000
@ -211,7 +438,7 @@ If you prefer to run the MCP server in a Docker container:
Update your MCP client's configuration to use the Docker command.
*Example for a cline_mcp_settings.json:*
_Example for a cline_mcp_settings.json:_
```json
{
@ -228,38 +455,257 @@ If you prefer to run the MCP server in a Docker container:
}
```
*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.*
_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._
### Environment Variables
</details>
- `DEFAULT_MINIMUM_TOKENS`: Set the minimum token count for documentation retrieval (default: 10000).
<details>
<summary><b>Install in Windows</b></summary>
Examples:
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`.
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
</details>
<details>
<summary><b>Install in Augment Code</b></summary>
To configure Context7 MCP in Augment Code, you can use either the graphical interface or manual configuration.
### **A. Using the Augment Code UI**
1. Click the hamburger menu.
2. Select **Settings**.
3. Navigate to the **Tools** section.
4. Click the **+ Add MCP** button.
5. Enter the following command:
```
npx -y @upstash/context7-mcp@latest
```
6. Name the MCP: **Context7**.
7. Click the **Add** button.
Once the MCP server is added, you can start using Context7's up-to-date code documentation features directly within Augment Code.
---
### **B. Manual Configuration**
1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
2. Select Edit Settings
3. Under Advanced, click Edit in settings.json
4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object
"augment.advanced": {
"mcpServers": [
{
"name": "context7",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
]
}
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.
</details>
<details>
<summary><b>Install in Roo Code</b></summary>
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.
#### Roo Code Remote Server Connection
```json
{
"mcpServers": {
"context7": {
"type": "streamable-http",
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### Roo Code Local Server Connection
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "10000"
}
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
### Available Tools
</details>
<details>
<summary><b>Install in Zencoder</b></summary>
To configure Context7 MCP in Zencoder, follow these steps:
1. Go to the Zencoder menu (...)
2. From the dropdown menu, select Agent tools
3. Click on the Add custom MCP
4. Add the name and server configuration from below, and make sure to hit the Install button
```json
{
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp@latest"
]
}
```
Once the MCP server is added, you can easily continue using it.
</details>
<details>
<summary><b>Install in Amazon Q Developer CLI</b></summary>
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.
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
</details>
<details>
<summary><b>Install in Qodo Gen</b></summary>
See [Qodo Gen docs](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps) for more details.
1. Open Qodo Gen chat panel in VSCode or IntelliJ.
2. Click Connect more tools.
3. Click + Add new MCP.
4. Add the following configuration:
```json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
```
</details>
<details>
<summary><b>Install in JetBrains AI Assistant</b></summary>
See [JetBrains AI Assistant Documentation](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html) for more details.
1. In JetBrains IDEs go to `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`
2. Click `+ Add`.
3. Click on `Command` in the top-left corner of the dialog and select the As JSON option from the list
4. Add this configuration and click `OK`
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
5. Click `Apply` to save changes.
</details>
<details>
<summary><b>Install in Warp</b></summary>
See [Warp Model Context Protocol Documentation](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server) for details.
1. Navigate `Settings` > `AI` > `Manage MCP servers`.
2. Add a new MCP server by clicking the `+ Add` button.
3. Paste the configuration given below:
```json
{
"Context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
],
"env": {},
"working_directory": null,
"start_on_launch": true
}
}
```
4. Click `Save` to apply the changes.
</details>
## 🔨 Available Tools
Context7 MCP provides the following tools that LLMs can use:
- `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
- `libraryName` (required)
- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
- `context7CompatibleLibraryID` (required)
- `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")
- `tokens` (optional, default 10000): Max number of tokens to return. Values less than the configured `DEFAULT_MINIMUM_TOKENS` value or the default value of 10000 are automatically increased to that value.
## Development
- `libraryName` (required): The name of the library to search for
- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
- `context7CompatibleLibraryID` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
- `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")
- `tokens` (optional, default 10000): Max number of tokens to return. Values less than the default value of 10000 are automatically increased to 10000.
## 🛟 Tips
### Add a Rule
> If you dont want to add `use context7` to every prompt, you can define a simple rule in your `.windsurfrules` file in Windsurf or from `Cursor Settings > Rules` section in Cursor (or the equivalent in your MCP client) to auto-invoke Context7 on any code question:
> ```toml
> [[calls]]
> match = "when the user requests code examples, setup or configuration steps, or library/API documentation"
> tool = "context7"
> ```
> From then on youll get Context7s docs in any related conversation without typing anything extra. You can add your use cases to the match part.
### Use Library Id
> 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.
> ```txt
> implement basic authentication with supabase. use library /supabase/supabase for api and docs
> ```
> The slash syntax tells the MCP tool exactly which library to load docs for.
## 💻 Development
Clone the project and install dependencies:
@ -273,7 +719,27 @@ Build:
bun run build
```
### Local Configuration Example
Run the server:
```bash
bun run dist/index.js
```
### CLI Arguments
`context7-mcp` accepts the following CLI flags:
- `--transport <stdio|http|sse>` Transport to use (`stdio` by default).
- `--port <number>` Port to listen on when using `http` or `sse` transport (default `3000`).
Example with http transport and port 8080:
```bash
bun run dist/index.js --transport http --port 8080
```
<details>
<summary><b>Local Configuration Example</b></summary>
```json
{
@ -286,79 +752,112 @@ bun run build
}
```
### Testing with MCP Inspector
</details>
<details>
<summary><b>Testing with MCP Inspector</b></summary>
```bash
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
```
## Troubleshooting
</details>
### ERR_MODULE_NOT_FOUND
## 🚨 Troubleshooting
If you see this error, try using `bunx` instead of `npx`.
<details>
<summary><b>Module Not Found Errors</b></summary>
If you encounter `ERR_MODULE_NOT_FOUND`, try using `bunx` instead of `npx`:
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
This often resolves module resolution issues, especially in environments where `npx` does not properly install or resolve packages.
This often resolves module resolution issues in environments where `npx` doesn't properly install or resolve packages.
### ESM Resolution Issues
</details>
If you encounter an error like: `Error: Cannot find module 'uriTemplate.js'` try running with the `--experimental-vm-modules` flag:
<details>
<summary><b>ESM Resolution Issues</b></summary>
For errors like `Error: Cannot find module 'uriTemplate.js'`, try the `--experimental-vm-modules` flag:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp@1.0.6"
]
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
```
### MCP Client Errors
</details>
1. Try removing `@latest` from the package name.
<details>
<summary><b>TLS/Certificate Issues</b></summary>
2. Try using `bunx` as an alternative.
Use the `--experimental-fetch` flag to bypass TLS-related problems:
3. Try using `deno` as an alternative.
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
}
}
}
```
4. Make sure you are using Node v18 or higher to have native fetch support with `npx`.
</details>
## Disclaimer
<details>
<summary><b>General MCP Client Errors</b></summary>
1. Try adding `@latest` to the package name
2. Use `bunx` as an alternative to `npx`
3. Consider using `deno` as another alternative
4. Ensure you're using Node.js v18 or higher for native fetch support
</details>
## ⚠️ Disclaimer
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.
## Context7 In Media
## 🤝 Connect with Us
Stay updated and join our community:
- 📢 Follow us on [X](https://x.com/contextai) for the latest news and updates
- 🌐 Visit our [Website](https://context7.com)
- 💬 Join our [Discord Community](https://upstash.com/discord)
## 📺 Context7 In Media
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
- [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
## Star History
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
## License
## 📄 License
MIT

View File

@ -4,7 +4,8 @@
"": {
"name": "context7-mcp",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.8.0",
"@modelcontextprotocol/sdk": "^1.12.0",
"commander": "^14.0.0",
"zod": "^3.24.2",
},
"devDependencies": {
@ -47,7 +48,7 @@
"@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.2", "", {}, "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ=="],
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.8.0", "", { "dependencies": { "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.3", "eventsource": "^3.0.2", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^4.1.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-e06W7SwrontJDHwCawNO5SGxG+nU9AAx+jpHHZqGl/WrDBdWOpvirC+s58VpJTB5QemI4jTRcjWT4Pt3Q1NPQQ=="],
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.12.1", "", { "dependencies": { "ajv": "^6.12.6", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-KG1CZhZfWg+u8pxeM/mByJDScJSrjjxLc8fwQqbsS8xCjBmQfMNEBTotYdNanKekepnfRI85GtgQlctLFpcYPw=="],
"@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],
@ -113,6 +114,8 @@
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
"commander": ["commander@14.0.0", "", {}, "sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA=="],
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
"content-disposition": ["content-disposition@1.0.0", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg=="],
@ -317,7 +320,7 @@
"picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
"pkce-challenge": ["pkce-challenge@4.1.0", "", {}, "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ=="],
"pkce-challenge": ["pkce-challenge@5.0.0", "", {}, "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ=="],
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
@ -417,28 +420,16 @@
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
"@eslint/config-array/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
"@eslint/eslintrc/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
"@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="],
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
"body-parser/qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
"espree/eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
"express/debug": ["debug@4.3.6", "", { "dependencies": { "ms": "2.1.2" } }, "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg=="],
"fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
"@eslint/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
"@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
"express/debug/ms": ["ms@2.1.2", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],

321
docs/README.ar.md Normal file
View File

@ -0,0 +1,321 @@
# Context7 MCP - توثيق أكواد محدث لأي أمر برمجي
[![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) [<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)
## ❌ بدون Context7
تعتمد النماذج اللغوية الكبيرة على معلومات قديمة أو عامة حول المكتبات التي تستخدمها. مما يؤدي إلى:
- ❌ أمثلة أكواد قديمة مبنية على بيانات تدريب مضى عليها وقت طويل
- ❌ واجهات برمجة تطبيقات وهمية غير موجودة
- ❌ إجابات عامة لنسخ قديمة من الحزم
## ✅ مع Context7
يستخرج Context7 MCP التوثيق والأمثلة البرمجية المحدثة مباشرة من المصدر — ويضعها في طلبك للنموذج.
أضف `use context7` إلى طلبك في Cursor:
```txt
أنشئ مشروع Next.js بسيط باستخدام app router. use context7
```
```txt
أنشئ سكربت لحذف الصفوف التي تكون فيها المدينة فارغة "" باستخدام بيانات اعتماد PostgreSQL. use context7
```
يقوم Context7 بجلب الأمثلة المحدثة والتوثيق المناسب مباشرة إلى السياق.
- 1⃣ اكتب طلبك بشكل طبيعي
- 2⃣ أخبر النموذج بـ `use context7`
- 3⃣ احصل على أكواد تعمل مباشرة
لا حاجة للتنقل بين التبويبات، لا واجهات برمجة تطبيقات وهمية، لا أكواد قديمة.
## 🛠️ البدء
### المتطلبات
- Node.js إصدار 18.0.0 أو أعلى
- Cursor، Windsurf، Claude Desktop أو أي عميل MCP آخر
### التثبيت عبر Smithery
لتثبيت Context7 MCP Server تلقائيًا لـ Claude Desktop:
```bash
npx -y @smithery/cli install @upstash/context7-mcp --client claude
```
### التثبيت في Cursor
اذهب إلى: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
أو أضف هذا إلى ملف `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### التثبيت باستخدام Bun
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### التثبيت باستخدام Deno
```json
{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}
```
### التثبيت في Windsurf
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### التثبيت في VS Code
```json
{
"servers": {
"Context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### التثبيت في Zed
```json
{
"context_servers": {
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
},
"settings": {}
}
}
}
```
### التثبيت في Claude Code
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
```
### التثبيت في Claude Desktop
```json
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### التثبيت في BoltAI
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### باستخدام Docker
**Dockerfile:**
```Dockerfile
FROM node:18-alpine
WORKDIR /app
RUN npm install -g @upstash/context7-mcp@latest
CMD ["context7-mcp"]
```
**بناء الصورة:**
```bash
docker build -t context7-mcp .
```
**التهيئة داخل العميل:**
```json
{
"mcpServers": {
"Context7": {
"command": "docker",
"args": ["run", "-i", "--rm", "context7-mcp"],
"transportType": "stdio"
}
}
}
```
### التثبيت في Windows
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
### المتغيرات البيئية
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "10000"
}
}
}
}
```
### الأدوات المتوفرة
- `resolve-library-id`: يحول اسم مكتبة عام إلى معرف متوافق مع Context7.
- `get-library-docs`: يستخرج التوثيق حسب المعرف.
- `context7CompatibleLibraryID`: مطلوب
- `topic`: موضوع معين مثل "routing"
- `tokens`: الحد الأعلى لعدد الرموز
## التطوير
```bash
bun i
bun run build
```
**التهيئة المحلية:**
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
}
}
}
```
**الاختبار باستخدام MCP Inspector:**
```bash
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
```
## استكشاف الأخطاء
### ERR_MODULE_NOT_FOUND
استخدم `bunx` بدلاً من `npx`.
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### مشاكل في ESM
جرّب إضافة:
```json
{
"command": "npx",
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
```
### أخطاء عميل MCP
1. أزل `@latest`
2. جرّب `bunx`
3. جرّب `deno`
4. تأكد أنك تستخدم Node v18 أو أحدث
## إخلاء مسؤولية
المشاريع المدرجة في Context7 مساهم بها من المجتمع، ولا يمكن ضمان دقتها أو أمانها بشكل كامل. الرجاء الإبلاغ عن أي محتوى مريب باستخدام زر "الإبلاغ".
## Context7 في الإعلام
- [Better Stack: "أداة مجانية تجعل Cursor أذكى 10x"](https://youtu.be/52FC3qObp9E)
- [Cole Medin: "أفضل MCP Server لمساعدين الذكاء الاصطناعي البرمجيين"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
- [Context7 + SequentialThinking: هل هذا AGI؟](https://www.youtube.com/watch?v=-ggvzyLpK6o)
- [تحديث جديد من Context7 MCP](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [إعداد Context7 في VS Code](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Context7: MCP جديد سيغير البرمجة](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [Cline & RooCode + Context7: قوة مضاعفة](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [أفضل 5 MCP Servers لتجربة برمجة ساحرة](https://www.youtube.com/watch?v=LqTQi8qexJM)
## سجل النجوم
[![Star History Chart](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
## الترخيص
MIT

View File

@ -209,7 +209,7 @@ Wenn du den MCP-Server lieber in einem Docker-Container ausführen möchtest:
Aktualisiere die Konfiguration deines MCP-Clients, um den Docker-Befehl zu verwenden.
*Beispiel für eine cline_mcp_settings.json:*
_Beispiel für eine cline_mcp_settings.json:_
```json
{
@ -225,7 +225,8 @@ Wenn du den MCP-Server lieber in einem Docker-Container ausführen möchtest:
}
}
```
*Hinweis: Dies ist eine Beispielkonfiguration. Bitte beziehe dich auf die spezifischen Beispiele für deinen MCP-Client (wie Cursor, VS Code usw.), die weiter oben in dieser README beschrieben sind, um die Struktur anzupassen (z.B. `mcpServers` vs `servers`). Stelle außerdem sicher, dass der Bildname in `args` mit dem beim `docker build`-Befehl verwendeten Tag übereinstimmt.*
_Hinweis: Dies ist eine Beispielkonfiguration. Bitte beziehe dich auf die spezifischen Beispiele für deinen MCP-Client (wie Cursor, VS Code usw.), die weiter oben in dieser README beschrieben sind, um die Struktur anzupassen (z.B. `mcpServers` vs `servers`). Stelle außerdem sicher, dass der Bildname in `args` mit dem beim `docker build`-Befehl verwendeten Tag übereinstimmt._
### Verfügbare Tools
@ -297,11 +298,7 @@ Wenn du einen Fehler wie `Error: Cannot find module 'uriTemplate.js'` bekommst,
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp@1.0.6"
]
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
@ -318,6 +315,7 @@ Wenn du einen Fehler wie `Error: Cannot find module 'uriTemplate.js'` bekommst,
4. Stelle sicher, dass du Node v18 oder höher verwendest, um native Fetch-Unterstützung mit `npx` zu haben.
## Haftungsausschluss
Context7-Projekte werden von der Community beigetragen, und obwohl wir uns bemühen, eine hohe Qualität aufrechtzuerhalten, können wir die Genauigkeit, Vollständigkeit oder Sicherheit aller Bibliotheksdokumentationen nicht garantieren. Die in Context7 aufgeführten Projekte werden von ihren jeweiligen Eigentümern entwickelt und gepflegt, nicht von Context7. Wenn du auf verdächtige, unangemessene oder potenziell schädliche Inhalte stößt, verwende bitte die Schaltfläche "Melden" auf der Projektseite, um uns sofort zu benachrichtigen. Wir nehmen alle Berichte ernst und werden gemeldete Inhalte umgehend überprüfen, um die Integrität und Sicherheit unserer Plattform zu gewährleisten. Durch die Nutzung von Context7 erkennst du an, dass du dies nach eigenem Ermessen und auf eigenes Risiko tust.
## Context7 in den Medien

View File

@ -1,6 +1,6 @@
# Context7 MCP - Documentation à jour pour vos prompts
[![Site Web](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![badge smithery](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp)[<img alt="Installer dans VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
[![Site Web](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![badge smithery](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="Installer dans VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%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)
## ❌ Sans Context7
@ -113,10 +113,10 @@ Ajoutez ceci à votre fichier de configuration MCP Windsurf. Voir la [documentat
### Installation dans VS Code
[<img alt="Installation dans VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
[<img alt="Installation dans VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Installer%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
[<img alt="Installer dans VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%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)
[<img alt="Installer dans VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Installer%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)
Ajoutez ceci à votre fichier de configuration MCP VS Code. Voir la [documentation VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) pour plus dinformations.
Ajoutez ceci à votre fichier de configuration MCP VS Code. Voir la [documentation VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) pour plus d'informations.
```json
{
@ -171,6 +171,23 @@ Ajoutez ceci à votre fichier `claude_desktop_config.json`. Voir la [documentati
}
```
### Installation dans BoltAI
Ouvrez la page "Settings" de l'application, naviguez jusqu'à "Plugins", et entrez le JSON suivant :
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
Une fois enregistré, saisissez dans le chat `get-library-docs` suivi de votre ID de documentation Context7 (par exemple, `get-library-docs /nuxt/ui`). Plus d'informations sont disponibles sur le [site de documentation BoltAI](https://docs.boltai.com/docs/plugins/mcp-servers). Pour BoltAI sur iOS, [consultez ce guide](https://docs.boltai.com/docs/boltai-mobile/mcp-servers).
### Utilisation avec Docker
Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
@ -209,7 +226,7 @@ Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
Mettez à jour la configuration de votre client MCP pour utiliser la commande Docker.
*Exemple pour un fichier cline_mcp_settings.json :*
_Exemple pour un fichier cline_mcp_settings.json :_
```json
{
@ -225,7 +242,45 @@ Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
}
}
```
*Note : Ceci est un exemple. Adaptez la structure selon votre client MCP (voir plus haut dans ce README). Assurez-vous que le nom de limage dans `args` correspond au tag utilisé lors du build.*
_Note : Ceci est un exemple. Adaptez la structure selon votre client MCP (voir plus haut dans ce README). Assurez-vous que le nom de limage dans `args` correspond au tag utilisé lors du build._
### Installation sous Windows
La configuration sous Windows est légèrement différente par rapport à Linux ou macOS (_`Cline` est utilisé dans l'exemple_). Le même principe s'applique à d'autres éditeurs; référez-vous à la configuration de `command` et `args`.
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
### Variables d'environnement
- `DEFAULT_MINIMUM_TOKENS`: Définissez le nombre minimum de tokens pour la récupération de documentation (par défaut: 10000).
Exemples:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "10000"
}
}
}
}
```
### Outils disponibles
@ -288,11 +343,31 @@ Si vous voyez cette erreur, essayez dutiliser `bunx` à la place de `npx`.
Cela résout souvent les problèmes de résolution de modules, surtout si `npx` ninstalle ou ne résout pas correctement les packages.
### Problèmes de résolution ESM
Si vous rencontrez une erreur comme : `Error: Cannot find module 'uriTemplate.js'` essayez d'exécuter avec le drapeau `--experimental-vm-modules` :
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
```
### Erreurs client MCP
1. Essayez de retirer `@latest` du nom du package.
2. Essayez dutiliser `bunx` comme alternative.
3. Essayez dutiliser `deno` comme alternative.
2. Essayez d'utiliser `bunx` comme alternative.
3. Essayez d'utiliser `deno` comme alternative.
4. Assurez-vous d'utiliser Node v18 ou supérieur pour avoir le support natif de fetch avec `npx`.
## Clause de non-responsabilité
Les projets Context7 sont des contributions de la communauté, et bien que nous nous efforcions de maintenir une haute qualité, nous ne pouvons garantir l'exactitude, l'exhaustivité ou la sécurité de toute la documentation des bibliothèques. Les projets listés dans Context7 sont développés et maintenus par leurs propriétaires respectifs, et non par Context7. Si vous rencontrez un contenu suspect, inapproprié ou potentiellement nuisible, veuillez utiliser le bouton "Signaler" sur la page du projet pour nous le faire savoir immédiatement. Nous prenons tous les signalements au sérieux et examinerons rapidement les contenus signalés pour maintenir l'intégrité et la sécurité de notre plateforme. En utilisant Context7, vous reconnaissez que vous le faites à votre propre discrétion et à vos risques et périls.
## Context7 dans les médias
@ -302,6 +377,8 @@ Cela résout souvent les problèmes de résolution de modules, surtout si `npx`
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
## Historique des stars

View File

@ -1,15 +1,15 @@
# Context7 MCP - Dokumentasi Ter-Update Untuk Setiap Prompt
[![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) [<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)
[![中文文档](https://img.shields.io/badge/docs-中文版-yellow)](./README.zh-CN.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) [![Documentação em Português (Brasil)](https://img.shields.io/badge/docs-Português%20(Brasil)-purple)](./README.pt-BR.md) [![Dokumentasi Bahasa Indonesia](https://img.shields.io/badge/docs-Bahasa%20Indonesia-red)](./README.id-ID.md)
[![中文文档](https://img.shields.io/badge/docs-中文版-yellow)](./README.zh-CN.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) [![Documentação em Português (Brasil)](<https://img.shields.io/badge/docs-Português%20(Brasil)-purple>)](./README.pt-BR.md) [![Dokumentasi Bahasa Indonesia](https://img.shields.io/badge/docs-Bahasa%20Indonesia-red)](./README.id-ID.md)
## ❌ Tanpa Context7
LLM mengandalkan informasi yang sudah lama atau umum tentang library yang Anda gunakan, bukan yang terbaru.
Hasilnya anda akan mendapatkan:
- ❌ Contoh kode sudah usang dan berdasarkan data pelatihan yang sudah lama
- ❌ API yang dikarang yang sebetulnya tidak ada sama sekali
- ❌ Jawaban umum untuk versi paket lama
@ -213,7 +213,7 @@ Jika Anda lebih suka menjalankan server MCP dalam kontainer Docker:
Perbarui konfigurasi MCP client Anda untuk menggunakan perintah Docker.
*Contoh untuk cline_mcp_settings.json:*
_Contoh untuk cline_mcp_settings.json:_
```json
{
@ -229,7 +229,8 @@ Jika Anda lebih suka menjalankan server MCP dalam kontainer Docker:
}
}
```
*Catatan: Ini adalah contoh konfigurasi. Silakan merujuk ke contoh spesifik untuk MCP client Anda (seperti Cursor, VS Code, dll.) sebelumnya dalam README ini untuk menyesuaikan struktur (misalnya, `mcpServers` vs `servers`). Juga, pastikan nama image di `args` cocok dengan tag yang digunakan selama perintah `docker build`.*
_Catatan: Ini adalah contoh konfigurasi. Silakan merujuk ke contoh spesifik untuk MCP client Anda (seperti Cursor, VS Code, dll.) sebelumnya dalam README ini untuk menyesuaikan struktur (misalnya, `mcpServers` vs `servers`). Juga, pastikan nama image di `args` cocok dengan tag yang digunakan selama perintah `docker build`._
### Alat yang Tersedia
@ -301,11 +302,7 @@ Jika Anda mengalami kesalahan seperti: `Error: Cannot find module 'uriTemplate.j
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp@1.0.6"
]
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
@ -322,6 +319,7 @@ Jika Anda mengalami kesalahan seperti: `Error: Cannot find module 'uriTemplate.j
4. Pastikan Anda menggunakan Node v18 atau lebih tinggi untuk memiliki dukungan fetch native dengan `npx`.
## Disclaimer
Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mempertahankan kualitas tinggi, kami tidak dapat menjamin keakuratan, kelengkapan, atau keamanan semua dokumentasi library. Proyek yang terdaftar di Context7 dikembangkan dan dikelola oleh pemiliknya masing-masing, bukan oleh Context7. Jika Anda menemukan konten yang mencurigakan, tidak pantas, atau berpotensi berbahaya, silakan gunakan tombol "Report" di halaman proyek untuk memberi tahu kami segera. Kami menganggap semua laporan dengan serius dan akan meninjau konten yang ditandai segera untuk menjaga integritas dan keamanan platform kami. Dengan menggunakan Context7, Anda mengakui bahwa Anda melakukannya atas kebijaksanaan dan risiko Anda sendiri.
## Context7 Di Media
@ -340,4 +338,3 @@ Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mem
## Lisensi
MIT

View File

@ -2,8 +2,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) [<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installa%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)
[![中文文档](https://img.shields.io/badge/docs-中文版-yellow)](./docs/README.zh-CN.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)
[![中文文档](https://img.shields.io/badge/docs-中文版-yellow)](./docs/README.zh-CN.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)
## ❌ Senza Context7
@ -212,7 +211,7 @@ Se preferisci eseguire il server MCP in un contenitore Docker:
Aggiorna la configurazione del tuo client MCP per utilizzare il comando Docker.
*Esempio per un file cline_mcp_settings.json:*
_Esempio per un file cline_mcp_settings.json:_
```json
{
@ -228,7 +227,8 @@ Se preferisci eseguire il server MCP in un contenitore Docker:
}
}
```
*Nota: Questa è una configurazione di esempio. Consulta gli esempi specifici per il tuo client MCP (come Cursor, VS Code, ecc.) precedentemente in questo README per adattare la struttura (ad es., `mcpServers` vs `servers`). Inoltre, assicurati che il nome dell'immagine in `args` corrisponda al tag utilizzato durante il comando `docker build`.*
_Nota: Questa è una configurazione di esempio. Consulta gli esempi specifici per il tuo client MCP (come Cursor, VS Code, ecc.) precedentemente in questo README per adattare la struttura (ad es., `mcpServers` vs `servers`). Inoltre, assicurati che il nome dell'immagine in `args` corrisponda al tag utilizzato durante il comando `docker build`._
### Strumenti Disponibili
@ -252,6 +252,7 @@ Compila:
```bash
bun run build
```
### Esempio di Configurazione Locale
```json
@ -299,11 +300,7 @@ Se riscontri un errore come: `Error: Cannot find module 'uriTemplate.js'` prova
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp@1.0.6"
]
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
@ -320,6 +317,7 @@ Se riscontri un errore come: `Error: Cannot find module 'uriTemplate.js'` prova
4. Assicurati di utilizzare Node v18 o superiore per avere il supporto nativo di fetch con `npx`.
## Dichiarazione di non responsabilità
I progetti Context7 sono contributi della comunità e, sebbene ci impegniamo a mantenere un'alta qualità, non possiamo garantire l'accuratezza, la completezza o la sicurezza di tutta la documentazione delle librerie. I progetti elencati in Context7 sono sviluppati e gestiti dai rispettivi proprietari, non da Context7. Se riscontri contenuti sospetti, inappropriati o potenzialmente dannosi, utilizza il pulsante "Segnala" sulla pagina del progetto per informarci immediatamente. Prendiamo sul serio tutte le segnalazioni e esamineremo prontamente i contenuti segnalati per mantenere l'integrità e la sicurezza della nostra piattaforma. Utilizzando Context7, riconosci di farlo a tua discrezione e a tuo rischio.
## Context7 nei Media

690
docs/README.ja.md Normal file
View File

@ -0,0 +1,690 @@
# Context7 MCP - どんなプロンプトにも最新のコードドキュメントで応える
[![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) [<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)
[![繁體中文](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) [![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)
## ❌ Context7 を使わないと
LLM は使用しているライブラリに関する古い情報や一般的な情報に依存しています。その結果:
- ❌ コード例が古く、1 年前のトレーニングデータに基づいている
- ❌ 存在しない API をハルシネーションして生成する
- ❌ 古いパッケージバージョンに対する一般的な回答しか得られない
## ✅ Context7 を使うと
Context7 MCP は最新のバージョン固有のドキュメントとコード例をソースから直接取得し、プロンプトに直接配置します。
Cursor のプロンプトに `use context7` を追加するだけ:
```txt
Create a basic Next.js project with app router. use context7
```
```txt
Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7
```
Context7 は最新のコード例とドキュメントを直接 LLM のコンテキストに取得します。
- 1⃣ 普段通りにプロンプトを書く
- 2⃣ LLM に `use context7` と指示する
- 3⃣ 動作するコードの回答を得る
タブの切り替えも、存在しない API のハルシネーションも、古いコード生成もありません。
## 📚 プロジェクトの追加
[プロジェクト追加ガイド](./docs/adding-projects.md) をチェックして、お気に入りのライブラリを Context7 に追加(または更新)する方法を学びましょう。
## 🛠️ インストール
### 必須要件
- Node.js >= v18.0.0
- Cursor、Windsurf、Claude Desktop またはその他の MCP クライアント
<details>
<summary><b>Smithery 経由でのインストール</b></summary>
[Smithery](https://smithery.ai/server/@upstash/context7-mcp) 経由で任意のクライアントに Context7 MCP サーバーを自動的にインストールするには:
```bash
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
```
Smithery キーは [Smithery.ai Web ページ](https://smithery.ai/server/@upstash/context7-mcp) で確認できます。
</details>
<details>
<summary><b>Cursor へのインストール</b></summary>
`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` に移動します
以下の設定を Cursor の `~/.cursor/mcp.json` ファイルに貼り付けることが推奨されます。プロジェクトフォルダに `.cursor/mcp.json` を作成することで、特定のプロジェクトにインストールすることもできます。詳細は [Cursor MCP ドキュメント](https://docs.cursor.com/context/model-context-protocol) を参照してください。
> Cursor 1.0 以降、下のインストールボタンをクリックすることで、ワンクリックで即座にインストールできます。
#### Cursor リモートサーバー接続
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
```json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### Cursor ローカルサーバー接続
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
<details>
<summary>代替方法Bun を使用</summary>
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D)
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary>代替方法Deno を使用</summary>
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
```json
{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}
```
</details>
</details>
<details>
<summary><b>Windsurf へのインストール</b></summary>
これを Windsurf MCP 設定ファイルに追加します。詳細は [Windsurf MCP ドキュメント](https://docs.windsurf.com/windsurf/mcp) を参照してください。
#### Windsurf リモートサーバー接続
```json
{
"mcpServers": {
"context7": {
"serverUrl": "https://mcp.context7.com/sse"
}
}
}
```
#### Windsurf ローカルサーバー接続
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>VS Code へのインストール</b></summary>
[<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)
[<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)
これを VS Code MCP 設定ファイルに追加します。詳細は [VS Code MCP ドキュメント](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) を参照してください。
#### VS Code リモートサーバー接続
```json
"mcp": {
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### VS Code ローカルサーバー接続
```json
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>Visual Studio 2022 へのインストール</b></summary>
[Visual Studio MCP サーバードキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) に従って、Visual Studio 2022 で Context7 MCP を設定できます。
これを Visual Studio MCP 設定ファイルに追加します(詳細は [Visual Studio ドキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) を参照):
```json
{
"mcp": {
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}
}
```
または、ローカルサーバーの場合:
```json
{
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
}
```
詳細情報とトラブルシューティングについては、[Visual Studio MCP サーバードキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) を参照してください。
</details>
<details>
<summary><b>Zed へのインストール</b></summary>
[Zed Extensions](https://zed.dev/extensions?query=Context7) 経由でインストールできるか、Zed の `settings.json` にこれを追加できます。詳細は [Zed Context Server ドキュメント](https://zed.dev/docs/assistant/context-servers) を参照してください。
```json
{
"context_servers": {
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"settings": {}
}
}
}
```
</details>
<details>
<summary><b>Claude Code へのインストール</b></summary>
このコマンドを実行します。詳細は [Claude Code MCP ドキュメント](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) を参照してください。
#### Claude Code リモートサーバー接続
```sh
claude mcp add --transport sse context7 https://mcp.context7.com/sse
```
#### Claude Code ローカルサーバー接続
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp
```
</details>
<details>
<summary><b>Claude Desktop へのインストール</b></summary>
これを Claude Desktop の `claude_desktop_config.json` ファイルに追加します。詳細は [Claude Desktop MCP ドキュメント](https://modelcontextprotocol.io/quickstart/user) を参照してください。
```json
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>BoltAI へのインストール</b></summary>
アプリの "Settings" ページを開き、"Plugins" に移動し、以下の JSON を入力します:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
保存後、チャットで `get-library-docs` の後に Context7 ドキュメント ID を入力します(例:`get-library-docs /nuxt/ui`)。詳細情報は [BoltAI ドキュメンテーションサイト](https://docs.boltai.com/docs/plugins/mcp-servers) で利用可能です。iOS 版 BoltAI については、[このガイドを参照してください](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)。
</details>
<details>
<summary><b>Docker を使用</b></summary>
MCP サーバーを Docker コンテナで実行したい場合:
1. **Docker イメージのビルド:**
まず、プロジェクトルート(または希望の場所)に `Dockerfile` を作成します:
<details>
<summary>Dockerfile の内容を表示</summary>
```Dockerfile
FROM node:18-alpine
WORKDIR /app
# 最新バージョンをグローバルにインストール
RUN npm install -g @upstash/context7-mcp
# 必要に応じてデフォルトポートを公開任意、MCP クライアントの相互作用に依存)
# EXPOSE 3000
# サーバーを実行するデフォルトコマンド
CMD ["context7-mcp"]
```
</details>
次に、タグ(例:`context7-mcp`)を使用してイメージをビルドします。**Docker Desktopまたは Docker デーモン)が実行中であることを確認してください。** `Dockerfile` を保存した同じディレクトリで次のコマンドを実行します:
```bash
docker build -t context7-mcp .
```
2. **MCP クライアントの設定:**
MCP クライアントの設定を更新して Docker コマンドを使用するようにします。
_cline_mcp_settings.json の例_
```json
{
"mcpServers": {
"Сontext7": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "docker",
"args": ["run", "-i", "--rm", "context7-mcp"],
"transportType": "stdio"
}
}
}
```
_注これは設定例です。この README の前半で MCP クライアントCursor、VS Code など)の具体的な例を参照して、構造(例:`mcpServers``servers`)を適応させてください。また、`args` 内のイメージ名が `docker build` コマンドで使用したタグと一致していることを確認してください。_
</details>
<details>
<summary><b>Windows へのインストール</b></summary>
Windows での設定は Linux や macOS と比べて少し異なります_例では `Cline` を使用_。同じ原則が他のエディタにも適用されます。`command``args` の設定を参照してください。
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
</details>
<details>
<summary><b>Augment Code へのインストール</b></summary>
Augment Code で Context7 MCP を設定するには、グラフィカルインターフェースまたは手動設定のいずれかを使用できます。
### **A. Augment Code UI を使用する場合**
1. ハンバーガーメニューをクリックします。
2. **Settings** を選択します。
3. **Tools** セクションに移動します。
4. **+ Add MCP** ボタンをクリックします。
5. 以下のコマンドを入力します:
```
npx -y @upstash/context7-mcp@latest
```
6. MCP に **Context7** と名前を付けます。
7. **Add** ボタンをクリックします。
MCP サーバーが追加されたら、Augment Code 内で Context7 の最新コードドキュメンテーション機能を直接使用できます。
---
### **B. 手動設定**
1. Cmd/Ctrl Shift P を押すか、Augment パネルのハンバーガーメニューに移動します
2. Edit Settings を選択します
3. Advanced の下で、Edit in settings.json をクリックします
4. `augment.advanced` オブジェクト内の `mcpServers` 配列にサーバー設定を追加します
"augment.advanced": {
"mcpServers": [
{
"name": "context7",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
]
}
MCP サーバーが追加されたら、エディタを再起動します。エラーが発生した場合は、構文をチェックして、閉じ括弧やカンマが欠けていないことを確認してください。
</details>
<details>
<summary><b>Roo Code へのインストール</b></summary>
これを Roo Code MCP 設定ファイルに追加します。詳細は [Roo Code MCP ドキュメント](https://docs.roocode.com/features/mcp/using-mcp-in-roo) を参照してください。
#### Roo Code リモートサーバー接続
```json
{
"mcpServers": {
"context7": {
"type": "streamable-http",
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### Roo Code ローカルサーバー接続
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>Zencoder へのインストール</b></summary>
Zencoder で Context7 MCP を設定するには、以下の手順に従います:
1. Zencoder メニュー (...) に移動します
2. ドロップダウンメニューから Agent tools を選択します
3. Add custom MCP をクリックします
4. 以下から名前とサーバー設定を追加し、Install ボタンを必ず押してください
```json
{
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp@latest"
]
}
```
MCP サーバーが追加されたら、簡単に使用を続けることができます。
</details>
<details>
<summary><b>Amazon Q Developer CLI へのインストール</b></summary>
これを Amazon Q Developer CLI 設定ファイルに追加します。詳細は [Amazon Q Developer CLI ドキュメント](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) を参照してください。
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
</details>
## 🔨 利用可能なツール
Context7 MCP は LLM が使用できる以下のツールを提供します:
- `resolve-library-id`:一般的なライブラリ名を Context7 互換のライブラリ ID に変換します。
- `libraryName`(必須):検索するライブラリの名前
- `get-library-docs`Context7 互換のライブラリ ID を使用してライブラリのドキュメントを取得します。
- `context7CompatibleLibraryID`(必須):正確な Context7 互換のライブラリ ID`/mongodb/docs``/vercel/next.js`
- `topic`(任意):ドキュメントの特定のトピックに焦点を当てます(例:"routing"、"hooks"
- `tokens`(任意、デフォルト 10000返すトークンの最大数。デフォルト値 10000 未満の値は自動的に 10000 に増加されます。
## 💻 開発
プロジェクトをクローンして依存関係をインストールします:
```bash
bun i
```
ビルド:
```bash
bun run build
```
サーバーを実行:
```bash
bun run dist/index.js
```
### CLI 引数
`context7-mcp` は以下の CLI フラグを受け付けます:
- `--transport <stdio|http|sse>` 使用するトランスポート(デフォルトは `stdio`)。
- `--port <number>` `http` または `sse` トランスポート使用時にリッスンするポート(デフォルト `3000`)。
http トランスポートとポート 8080 の例:
```bash
bun run dist/index.js --transport http --port 8080
```
<details>
<summary><b>ローカル設定例</b></summary>
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
}
}
}
```
</details>
<details>
<summary><b>MCP Inspector でのテスト</b></summary>
```bash
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
```
</details>
## 🚨 トラブルシューティング
<details>
<summary><b>モジュールが見つからないエラー</b></summary>
`ERR_MODULE_NOT_FOUND` が発生した場合は、`npx` の代わりに `bunx` を使用してみてください:
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
これにより、`npx` がパッケージを正しくインストールまたは解決できない環境でのモジュール解決の問題が解決されることがあります。
</details>
<details>
<summary><b>ESM 解決の問題</b></summary>
`Error: Cannot find module 'uriTemplate.js'` のようなエラーの場合は、`--experimental-vm-modules` フラグを試してください:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
```
</details>
<details>
<summary><b>TLS/証明書の問題</b></summary>
TLS 関連の問題を回避するには、`--experimental-fetch` フラグを使用します:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>一般的な MCP クライアントエラー</b></summary>
1. パッケージ名に `@latest` を追加してみる
2. `npx` の代替として `bunx` を使用する
3. 別の代替方法として `deno` の使用を検討する
4. ネイティブ fetch サポートのために Node.js v18 以上を使用していることを確認する
</details>
## ⚠️ 免責事項
Context7 プロジェクトはコミュニティが貢献しているもので、高品質を維持するよう努めていますが、すべてのライブラリドキュメントの正確性、完全性、セキュリティを保証することはできません。Context7 にリストされているプロジェクトは、Context7 ではなく、それぞれの所有者によって開発および保守されています。疑わしい、不適切な、または潜在的に有害なコンテンツを発見した場合は、プロジェクトページの「報告」ボタンを使用して、すぐにお知らせください。私たちはすべての報告を真剣に受け止め、プラットフォームの整合性と安全性を維持するために、フラグが付けられたコンテンツを迅速にレビューします。Context7 を使用することにより、あなたは自己の裁量とリスクで使用することを認めます。
## 🤝 私たちとつながる
最新情報を入手し、コミュニティに参加しましょう:
- 📢 最新ニュースとアップデートのために [X](https://x.com/contextai) でフォローしてください
- 🌐 [Web サイト](https://context7.com) を訪問してください
- 💬 [Discord コミュニティ](https://upstash.com/discord) に参加してください
## 📺 メディアでの Context7
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
## ⭐ スター履歴
[![Star History Chart](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
## 📄 ライセンス
MIT

View File

@ -151,6 +151,7 @@ Claude Desktop의 `claude_desktop_config.json` 파일에 다음을 추가하세
### 사용 가능한 도구
- `resolve-library-id`: 일반적인 라이브러리 이름을 Context7이 인식할 수 있는 라이브러리 ID로 변환합니다.
- `libraryName` (필수): 검색하고자 하는 라이브러리 이름
- `get-library-docs`: Context7이 인식하는 라이브러리 ID를 사용하여 해당 라이브러리의 문서를 가져옵니다.

View File

@ -58,7 +58,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -72,7 +72,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -88,7 +88,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}
@ -105,7 +105,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -124,7 +124,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
"Context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -140,7 +140,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
},
"settings": {}
}
@ -153,7 +153,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
Запустите следующую команду для установки. Смотрите [документацию Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) для получения дополнительной информации.
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
claude mcp add context7 -- npx -y @upstash/context7-mcp
```
### Установка в Claude Desktop
@ -165,7 +165,22 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
### Установка в BoltAI
Откройте страницу "Settings", перейдите в "Plugins" и добавьте следующие JSON-строки:
```json
{
"mcpServers": {
"context7": {
"args": ["-y", "@upstash/context7-mcp"],
"command": "npx"
}
}
}
@ -188,7 +203,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
WORKDIR /app
# Установите последнюю версию пакета глобально
RUN npm install -g @upstash/context7-mcp@latest
RUN npm install -g @upstash/context7-mcp
# Откройте стандартный порт, если это необходимо (необязательно, это зависит от взаимодействия с MCP клиентом)
# EXPOSE 3000
@ -209,7 +224,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
Обновите вашу конфигурацию MCP клиента, чтобы использовать Docker команду.
*Пример для cline_mcp_settings.json:*
ример для cline_mcp_settings.json:_
```json
{
@ -225,19 +240,38 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
}
}
```
*Примечение: это пример конфигурации. Обратитесь к конкретным примерам для вашего MCP-клиента (например, Cursor, VS Code и т.д.), в предыдущих разделах этого README, чтобы адаптировать структуру (например, `mcpServers` вместо `servers`). Также убедитесь, что имя образа в `args` соответствует тегу, использованному при выполнении команды `docker build`.*
римечение: это пример конфигурации. Обратитесь к конкретным примерам для вашего MCP-клиента (например, Cursor, VS Code и т.д.), в предыдущих разделах этого README, чтобы адаптировать структуру (например, `mcpServers` вместо `servers`). Также убедитесь, что имя образа в `args` соответствует тегу, использованному при выполнении команды `docker build`._
### Установка в Windows
Конфигурация в Windows немного отличается от Linux или macOS (_в качестве примера используется `Cline`_). Однако, эти же же принципы применимы и к другим редакторам. В случае необходимости обратитесь к настройкам `command` и `args`.
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp"],
"disabled": false,
"autoApprove": []
}
}
}
```
### Переменные окружения
- `DEFAULT_MINIMUM_TOKENS`: минимальное количество токенов, необходимое для получения документации (по умолчанию: 5000).
- `DEFAULT_MINIMUM_TOKENS`: минимальное количество токенов, необходимое для получения документации (по умолчанию: 10000).
Examples:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"],
"args": ["-y", "@upstash/context7-mcp"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "10000"
}
@ -253,7 +287,7 @@ Examples:
- `get-library-docs`: получает документацию по библиотеке по совместимому с Context7 идентификатору.
- `context7CompatibleLibraryID` (обязательно)
- `topic` (необязательно): фокусирует документацию на определённой теме (например, "routing", "hooks")
- `tokens` (необязательно, по умолчанию 5000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него.
- `tokens` (необязательно, по умолчанию 10000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него.
## Разработка
@ -285,7 +319,7 @@ bun run build
### Тестирование с помощью инспектора MCP
```bash
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
```
## Решение проблем
@ -299,7 +333,7 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
@ -316,11 +350,22 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp@1.0.6"
]
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp"]
}
}
}
```
### Проблемы с TLS/сертификатами
Используйте флаг `--experimental-fetch` c `npx`, чтобы избежать ошибки, связанные с TLS:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
}
}
}
@ -328,7 +373,7 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
### Ошибки MCP клиента
1. Попробуйте убрать тег `@latest` из имени пакета.
1. Попробуйте добавить тег `@latest` в имя пакета.
2. Попробуйте использовать `bunx` как альтернативу `npx`.
@ -337,13 +382,22 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
4. Убедитесь, что используете версию Node v18 или выше, чтобы `npx` поддерживал встроенный `fetch`.
## Отказ от ответственности
Проекты Context7 создаются сообществом. Мы стремимся поддерживать высокое качество, однако не можем гарантировать точность, полноту или безопасность всей документации по библиотекам. Проекты, представленные в Context7, разрабатываются и поддерживаются их авторами, а не командой Context7.
Если вы столкнётесь с подозрительным, неуместным или потенциально вредоносным контентом, пожалуйста, воспользуйтесь кнопкой "Report" на странице проекта, чтобы немедленно сообщить нам. Мы внимательно относимся ко всем обращениям и оперативно проверяем помеченные материалы, чтобы обеспечить надёжность и безопасность платформы.
Используя Context7, вы признаёте, что делаете это по собственному усмотрению и на свой страх и риск.
## Context7 In Media
## Оставайтесь с нами на связи
Будьте в курсе последних новостей на наших платформах:
- 📢 Следите за нашими новостями на [X](https://x.com/contextai), чтобы быть в курсе последних новостей
- 🌐 Загляните на наш [сайт](https://context7.com)
- 💬 При желании присоединяйтесь к нашему [сообществу в Discord](https://upstash.com/discord)
## Context7 в СМИ
- [Better Stack: "Бесплатный инструмент делает Cursor в 10 раз умнее"](https://youtu.be/52FC3qObp9E)
- [Cole Medin: "Это, без сомнения, ЛУЧШИЙ MCP-сервер для AI-помощников в коде"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
@ -351,6 +405,8 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
- [Julian Goldie SEO: "Context7: обновление MCP-агента"](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [JeredBlu: "Context 7 MCP: мгновенный доступ к документации + настройка для VS Code"](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Income stream surfers: "Context7: новый MCP-сервер, который изменит кодинг с ИИ"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [AICodeKing: "Context7 + Cline & RooCode: Этот MCP сервер делает CLINE в 100 раз ЭФФЕКТИВНЕЕ!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [Sean Kochel: "5 MCP серверов для стремительного вайб-программирования (Подключи и Работай)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
## История звёзд на GitHub

360
docs/README.tr.md Normal file
View File

@ -0,0 +1,360 @@
# Context7 MCP - Herhangi Bir Prompt İçin Güncel Kod Belgeleri
[![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) [<img alt="VS Code'da Yükle (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Context7%20MCP%20Y%C3%BCkle&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)
[![中文文档](https://img.shields.io/badge/docs-中文版-yellow)](./docs/README.zh-CN.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) [![Türkçe Doküman](https://img.shields.io/badge/docs-Türkçe-blue)](./docs/README.tr.md)
## ❌ Context7 Olmadan
LLM'ler, kullandığınız kütüphaneler hakkında güncel olmayan veya genel bilgilere güvenir. Karşılaştığınız sorunlar:
- ❌ Kod örnekleri eskidir ve bir yıllık eğitim verilerine dayanır
- ❌ Halüsinasyon yapılan API'ler gerçekte mevcut değildir
- ❌ Eski paket sürümleri için genel cevaplar alırsınız
## ✅ Context7 İle
Context7 MCP, güncel ve sürüme özel belgeleri ve kod örneklerini doğrudan kaynağından çeker ve doğrudan prompt'unuza yerleştirir.
Cursor'da prompt'unuza `use context7` ekleyin:
```txt
Next.js ile app router kullanan basit bir proje oluştur. use context7
```
```txt
PostgreSQL kimlik bilgileriyle şehir değeri "" olan satırları silmek için bir betik oluştur. use context7
```
Context7, güncel kod örneklerini ve belgelerini doğrudan LLM'inizin içeriğine getirir.
- 1⃣ Prompt'unuzu doğal bir şekilde yazın
- 2⃣ LLM'e `use context7` kullanmasını söyleyin
- 3⃣ Çalışan kod cevapları alın
Sekme değiştirme, var olmayan halüsinasyon API'ler, güncel olmayan kod üretimleri yok.
## 🛠️ Başlangıç
### Gereksinimler
- Node.js >= v18.0.0
- Cursor, Windsurf, Claude Desktop veya başka bir MCP İstemcisi
### Smithery aracılığıyla kurulum
Context7 MCP Server'ı Claude Desktop için [Smithery](https://smithery.ai/server/@upstash/context7-mcp) aracılığıyla otomatik olarak kurmak için:
```bash
npx -y @smithery/cli install @upstash/context7-mcp --client claude
```
### Cursor'da Kurulum
Şu yolu izleyin: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
Aşağıdaki yapılandırmayı Cursor `~/.cursor/mcp.json` dosyanıza yapıştırmanız önerilen yaklaşımdır. Ayrıca, proje klasörünüzde `.cursor/mcp.json` oluşturarak belirli bir projeye de kurabilirsiniz. Daha fazla bilgi için [Cursor MCP belgelerine](https://docs.cursor.com/context/model-context-protocol) bakabilirsiniz.
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
<details>
<summary>Alternatif: Bun Kullanın</summary>
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
</details>
<details>
<summary>Alternatif: Deno Kullanın</summary>
```json
{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}
```
</details>
### Windsurf'te Kurulum
Bunu Windsurf MCP yapılandırma dosyanıza ekleyin. Daha fazla bilgi için [Windsurf MCP belgelerine](https://docs.windsurf.com/windsurf/mcp) bakabilirsiniz.
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### VS Code'da Kurulum
[<img alt="VS Code'da Yükle (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Context7%20MCP%20Y%C3%BCkle&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)
[<img alt="VS Code Insiders'da Yükle (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Context7%20MCP%20Y%C3%BCkle&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)
Bunu VS Code MCP yapılandırma dosyanıza ekleyin. Daha fazla bilgi için [VS Code MCP belgelerine](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) bakabilirsiniz.
```json
{
"servers": {
"Context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### Zed'de Kurulum
[Zed Uzantıları](https://zed.dev/extensions?query=Context7) aracılığıyla kurulabilir veya Zed `settings.json` dosyanıza ekleyebilirsiniz. Daha fazla bilgi için [Zed Context Server belgelerine](https://zed.dev/docs/assistant/context-servers) bakabilirsiniz.
```json
{
"context_servers": {
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
},
"settings": {}
}
}
}
```
### Claude Code'da Kurulum
Bu komutu çalıştırın. Daha fazla bilgi için [Claude Code MCP belgelerine](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) bakabilirsiniz.
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
```
### Claude Desktop'ta Kurulum
Bunu Claude Desktop `claude_desktop_config.json` dosyanıza ekleyin. Daha fazla bilgi için [Claude Desktop MCP belgelerine](https://modelcontextprotocol.io/quickstart/user) bakabilirsiniz.
```json
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
### Docker Kullanımı
MCP sunucusunu bir Docker konteynerinde çalıştırmayı tercih ederseniz:
1. **Docker Görüntüsü Oluşturun:**
Önce, proje kökünde (veya tercih ettiğiniz herhangi bir yerde) bir `Dockerfile` oluşturun:
<details>
<summary>Dockerfile içeriğini görmek için tıklayın</summary>
```Dockerfile
FROM node:18-alpine
WORKDIR /app
# En son sürümü global olarak yükleyin
RUN npm install -g @upstash/context7-mcp@latest
# Gerekirse varsayılan portu açın (isteğe bağlı, MCP istemci etkileşimine bağlıdır)
# EXPOSE 3000
# Sunucuyu çalıştırmak için varsayılan komut
CMD ["context7-mcp"]
```
</details>
Ardından, bir etiket (örneğin, `context7-mcp`) kullanarak görüntüyü oluşturun. **Docker Desktop'un (veya Docker daemon'un) çalıştığından emin olun.** `Dockerfile`'ı kaydettiğiniz dizinde aşağıdaki komutu çalıştırın:
```bash
docker build -t context7-mcp .
```
2. **MCP İstemcinizi Yapılandırın:**
MCP istemcinizin yapılandırmasını Docker komutunu kullanacak şekilde güncelleyin.
_cline_mcp_settings.json için örnek:_
```json
{
"mcpServers": {
"Сontext7": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "docker",
"args": ["run", "-i", "--rm", "context7-mcp"],
"transportType": "stdio"
}
}
}
```
_Not: Bu bir örnek yapılandırmadır. Yapıyı uyarlamak için MCP istemcinize (Cursor, VS Code vb.) özel örneklere bakın (örneğin, `mcpServers` ve `servers` farkı). Ayrıca, `args` içindeki görüntü adının `docker build` komutu sırasında kullanılan etiketle eşleştiğinden emin olun._
### Çevre Değişkenleri
- `DEFAULT_MINIMUM_TOKENS`: Belge alımı için minimum token sayısını ayarlayın (varsayılan: 10000).
Örnekler:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "10000"
}
}
}
}
```
### Kullanılabilir Araçlar
- `resolve-library-id`: Genel bir kütüphane adını Context7 uyumlu bir kütüphane ID'sine dönüştürür.
- `libraryName` (gerekli)
- `get-library-docs`: Context7 uyumlu bir kütüphane ID'si kullanarak bir kütüphane için belgeleri getirir.
- `context7CompatibleLibraryID` (gerekli)
- `topic` (isteğe bağlı): Belgeleri belirli bir konuya odaklayın (örn. "routing", "hooks")
- `tokens` (isteğe bağlı, varsayılan 10000): Döndürülecek maksimum token sayısı. Yapılandırılmış `DEFAULT_MINIMUM_TOKENS` değerinden veya varsayılan 10000 değerinden düşük değerler otomatik olarak o değere yükseltilir.
## Geliştirme
Projeyi klonlayın ve bağımlılıkları yükleyin:
```bash
bun i
```
Derleyin:
```bash
bun run build
```
### Yerel Yapılandırma Örneği
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
}
}
}
```
### MCP Inspector ile Test Etme
```bash
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
```
## Sorun Giderme
### ERR_MODULE_NOT_FOUND
Bu hatayı görürseniz, `npx` yerine `bunx` kullanmayı deneyin.
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
Bu, özellikle `npx`'in paketleri düzgün şekilde yüklemediği veya çözemediği ortamlarda modül çözümleme sorunlarını genellikle çözer.
### ESM Çözümleme Sorunları
`Error: Cannot find module 'uriTemplate.js'` gibi bir hatayla karşılaşırsanız, `--experimental-vm-modules` bayrağıyla çalıştırmayı deneyin:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
```
### MCP İstemci Hataları
1. Paket adından `@latest` ifadesini kaldırmayı deneyin.
2. Alternatif olarak `bunx` kullanmayı deneyin.
3. Alternatif olarak `deno` kullanmayı deneyin.
4. `npx` ile yerel fetch desteğine sahip olmak için Node v18 veya daha yüksek bir sürüm kullandığınızdan emin olun.
## Sorumluluk Reddi
Context7 projeleri topluluk katkılıdır ve yüksek kaliteyi korumaya çalışsak da, tüm kütüphane belgelerinin doğruluğunu, eksiksizliğini veya güvenliğini garanti edemeyiz. Context7'de listelenen projeler, Context7 tarafından değil, ilgili sahipleri tarafından geliştirilmekte ve sürdürülmektedir. Şüpheli, uygunsuz veya potansiyel olarak zararlı içerikle karşılaşırsanız, lütfen bizi hemen bilgilendirmek için proje sayfasındaki "Bildir" düğmesini kullanın. Tüm bildirimleri ciddiye alıyoruz ve platformumuzun bütünlüğünü ve güvenliğini korumak için işaretlenen içeriği hızla inceleyeceğiz. Context7'yi kullanarak, bunu kendi takdirinizle ve riskinizle yaptığınızı kabul etmiş olursunuz.
## Context7 Medyada
- [Better Stack: "Ücretsiz Araç Cursor'u 10 Kat Daha Akıllı Yapıyor"](https://youtu.be/52FC3qObp9E)
- [Cole Medin: "Bu, Tartışmasız AI Kodlama Asistanları İçin EN İYİ MCP Sunucusudur"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
- [Income stream surfers: "Context7 + SequentialThinking MCP'leri: Bu AGI mi?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
- [Julian Goldie SEO: "Context7: Yeni MCP AI Aracı Güncellemesi"](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [JeredBlu: "Context 7 MCP: Belgeleri Anında Alın + VS Code Kurulumu"](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Income stream surfers: "Context7: AI Kodlamayı DEĞİŞTİRECEK Yeni MCP Sunucusu"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [AICodeKing: "Context7 + Cline & RooCode: Bu MCP Sunucusu CLINE'ı 100 KAT DAHA ETKİLİ YAPIYOR!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [Sean Kochel: "Vibe Kodlama İhtişamı İçin 5 MCP Sunucusu (Tak ve Çalıştır)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
## Yıldız Geçmişi
[![Yıldız Geçmişi Grafiği](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
## Lisans
MIT

View File

@ -187,7 +187,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
更新MCP客户端配置以使用Docker命令。
*cline_mcp_settings.json配置示例*
_cline_mcp_settings.json配置示例_
```json
{
@ -203,12 +203,31 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
}
}
```
*注意事项:*
_注意事项_
<em>
- 此为示例配置。请参考前面README中针对具体MCP客户端如Cursor、VS Code等的示例来调整结构`mcpServers``servers`)。同时确保`args`中的镜像名称与`docker build`命令使用的标签一致。
- 当前Cursor版本(0.49.5), 请不要使用本方式启动MCP server详情[Cursor官方说明](https://docs.cursor.com/context/model-context-protocol#remote-development)
</em>
### 在Windows上安装
在windows上的配置相对于linux或macos来说有些许不同(_示例使用的`Cline`_), 其它编辑器同理, 参考`command``args`的配置即可
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
### 可用工具
- `resolve-library-id`: 将通用库名称解析为Context7兼容的库ID。
@ -251,7 +270,6 @@ bun run build
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
```
## 故障排除
### ERR_MODULE_NOT_FOUND

549
docs/README.zh-TW.md Normal file
View File

@ -0,0 +1,549 @@
# Context7 MCP - 即時更新的程式碼文件,適用於任何提示
[![網站](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![smithery 徽章](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="在 VS Code 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=安裝%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)
## ❌ 沒有 Context7
大型語言模型LLM依賴過時或通用的函式庫資訊。你會遇到
- ❌ 程式碼範例過時,僅根據一年前的訓練資料
- ❌ 產生不存在的 API
- ❌ 舊版套件的通用答案
## ✅ 有了 Context7
Context7 MCP 直接從來源拉取即時、特定版本的文件與程式碼範例,並直接放入你的提示中。
在 Cursor 的提示中加入 `use context7`
```txt
建立一個使用 app router 的基本 Next.js 專案。use context7
```
```txt
根據 PostgreSQL 資訊,建立一個刪除 city 為 "" 的資料列的腳本。use context7
```
Context7 會將即時的程式碼範例與文件直接帶入你的 LLM 上下文。
- 1⃣ 自然地撰寫你的提示
- 2⃣ 告訴 LLM `use context7`
- 3⃣ 取得可執行的程式碼解答
不需切換分頁、不會產生不存在的 API、不會有過時的程式碼。
## 📚 新增專案
請參考我們的[專案新增指南](./docs/adding-projects.md),學習如何將你喜愛的函式庫加入 Context7 或更新其內容。
## 🛠️ 安裝
### 系統需求
- Node.js >= v18.0.0
- Cursor、Windsurf、Claude Desktop 或其他 MCP 客戶端
<details>
<summary><b>透過 Smithery 安裝</b></summary>
要透過 [Smithery](https://smithery.ai/server/@upstash/context7-mcp) 自動安裝 Context7 MCP Server
```bash
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
```
你的 Smithery 金鑰可在 [Smithery.ai 網頁](https://smithery.ai/server/@upstash/context7-mcp) 取得。
</details>
<details>
<summary><b>在 Cursor 安裝</b></summary>
前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
建議將下列設定貼到你的 Cursor `~/.cursor/mcp.json` 檔案。你也可以在專案資料夾建立 `.cursor/mcp.json` 進行專案安裝。詳見 [Cursor MCP 文件](https://docs.cursor.com/context/model-context-protocol)。
#### Cursor 遠端伺服器連線
```json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### Cursor 本地伺服器連線
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
<details>
<summary>替代方案:使用 Bun</summary>
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary>替代方案:使用 Deno</summary>
```json
{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}
```
</details>
</details>
<details>
<summary><b>在 Windsurf 安裝</b></summary>
將下列內容加入 Windsurf MCP 設定檔。詳見 [Windsurf MCP 文件](https://docs.windsurf.com/windsurf/mcp)。
#### Windsurf 遠端伺服器連線
```json
{
"mcpServers": {
"context7": {
"serverUrl": "https://mcp.context7.com/sse"
}
}
}
```
#### Windsurf 本地伺服器連線
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>在 VS Code 安裝</b></summary>
[<img alt="在 VS Code 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=安裝Context7%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)
[<img alt="在 VS Code Insiders 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=安裝Context7%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)
將下列內容加入 VS Code MCP 設定檔。詳見 [VS Code MCP 文件](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。
#### VS Code 遠端伺服器連線
```json
"mcp": {
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}
```
#### VS Code 本地伺服器連線
```json
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>在 Zed 安裝</b></summary>
可透過 [Zed 擴充套件](https://zed.dev/extensions?query=Context7) 安裝,或將下列內容加入 Zed `settings.json`。詳見 [Zed Context Server 文件](https://zed.dev/docs/assistant/context-servers)。
```json
{
"context_servers": {
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"settings": {}
}
}
}
```
</details>
<details>
<summary><b>在 Claude Code 安裝</b></summary>
執行下列指令。詳見 [Claude Code MCP 文件](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)。
#### Claude Code 遠端伺服器連線
```sh
claude mcp add --transport sse context7 https://mcp.context7.com/sse
```
#### Claude Code 本地伺服器連線
```sh
claude mcp add context7 -- npx -y @upstash/context7-mcp
```
</details>
<details>
<summary><b>在 Claude Desktop 安裝</b></summary>
將下列內容加入 Claude Desktop `claude_desktop_config.json`。詳見 [Claude Desktop MCP 文件](https://modelcontextprotocol.io/quickstart/user)。
```json
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>在 BoltAI 安裝</b></summary>
打開應用程式的「Settings」頁面前往「Plugins」並輸入下列 JSON
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
儲存後,在聊天中輸入 `get-library-docs` 並接上你的 Context7 文件 ID例如 `get-library-docs /nuxt/ui`)。更多資訊請參考 [BoltAI 文件網站](https://docs.boltai.com/docs/plugins/mcp-servers)。如在 iOS 上使用 BoltAI請參考[此指南](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)。
</details>
<details>
<summary><b>使用 Docker</b></summary>
若你偏好在 Docker 容器中執行 MCP 伺服器:
1. **建立 Docker 映像檔:**
先在專案根目錄(或任意位置)建立 `Dockerfile`
<details>
<summary>點擊查看 Dockerfile 內容</summary>
```Dockerfile
FROM node:18-alpine
WORKDIR /app
# 全域安裝最新版
RUN npm install -g @upstash/context7-mcp
# 如有需要可開放預設埠(視 MCP 客戶端互動而定)
# EXPOSE 3000
# 預設啟動指令
CMD ["context7-mcp"]
```
</details>
然後使用標籤(如 `context7-mcp`)建構映像檔。**請確保 Docker Desktop或 Docker daemon已啟動。**在存有 `Dockerfile` 的目錄執行:
```bash
docker build -t context7-mcp .
```
2. **設定 MCP 客戶端:**
更新 MCP 客戶端設定以使用 Docker 指令。
_cline_mcp_settings.json 範例_
```json
{
"mcpServers": {
"Сontext7": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "docker",
"args": ["run", "-i", "--rm", "context7-mcp"],
"transportType": "stdio"
}
}
}
```
_注意這是範例設定。請參考前述各 MCP 客戶端(如 Cursor、VS Code 等)的範例調整結構(如 `mcpServers``servers`)。同時確保 `args` 中的映像名稱與 `docker build` 使用的標籤一致。_
</details>
<details>
<summary><b>在 Windows 安裝</b></summary>
Windows 的設定與 Linux 或 macOS 略有不同(*範例以 Cline 為例*)。其他編輯器同理,請參考 `command``args` 設定。
```json
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
</details>
<details>
<summary><b>在 Augment Code 安裝</b></summary>
在 Augment Code 設定 Context7 MCP請依下列步驟
1. 按 Cmd/Ctrl Shift P 或於 Augment 面板的漢堡選單中選擇
2. 選擇 Edit Settings
3. 於 Advanced 下點選 Edit in settings.json
4. 將伺服器設定加入 `augment.advanced` 物件的 `mcpServers` 陣列
```json
"augment.advanced": {
"mcpServers": [
{
"name": "context7",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
]
}
```
加入 MCP 伺服器後,請重啟編輯器。如遇錯誤,請檢查語法是否有遺漏括號或逗號。
</details>
## 🔧 環境變數
Context7 MCP 伺服器支援下列環境變數:
- `DEFAULT_MINIMUM_TOKENS`:設定文件擷取的最小 token 數預設10000
範例設定:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "6000"
}
}
}
}
```
## 🔨 可用工具
Context7 MCP 提供下列工具供 LLM 使用:
- `resolve-library-id`:將一般函式庫名稱解析為 Context7 相容的函式庫 ID。
- `libraryName`(必填):要查詢的函式庫名稱
- `get-library-docs`:根據 Context7 相容的函式庫 ID 取得文件。
- `context7CompatibleLibraryID`必填Context7 相容的函式庫 ID`/mongodb/docs`, `/vercel/next.js`
- `topic`(選填):聚焦於特定主題(如 "routing", "hooks"
- `tokens`(選填,預設 10000最大回傳 token 數。小於預設或 `DEFAULT_MINIMUM_TOKENS` 的值會自動提升。
## 💻 開發
複製專案並安裝依賴:
```bash
bun i
```
建置:
```bash
bun run build
```
<details>
<summary><b>本地設定範例</b></summary>
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
}
}
}
```
</details>
<details>
<summary><b>使用 MCP Inspector 測試</b></summary>
```bash
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
```
</details>
## 🚨 疑難排解
<details>
<summary><b>找不到模組錯誤</b></summary>
若遇到 `ERR_MODULE_NOT_FOUND`,請嘗試用 `bunx` 取代 `npx`
```json
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
```
這通常能解決 `npx` 無法正確安裝或解析套件的問題。
</details>
<details>
<summary><b>ESM 解析問題</b></summary>
若出現 `Error: Cannot find module 'uriTemplate.js'`,請嘗試加上 `--experimental-vm-modules` 參數:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
}
}
}
```
</details>
<details>
<summary><b>TLS/憑證問題</b></summary>
可加上 `--experimental-fetch` 參數繞過 TLS 問題:
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
}
}
}
```
</details>
<details>
<summary><b>一般 MCP 客戶端錯誤</b></summary>
1. 嘗試加上 `@latest` 於套件名稱
2. 改用 `bunx` 取代 `npx`
3. 或改用 `deno`
4. 請確認 Node.js 版本為 v18 或以上,以支援原生 fetch
</details>
## ⚠️ 免責聲明
Context7 專案由社群貢獻雖然我們致力於維持高品質但無法保證所有函式庫文件的正確性、完整性或安全性。Context7 上的專案由各自擁有者開發與維護,非 Context7 官方。若發現可疑、不當或潛在有害內容,請於專案頁面點選「檢舉」按鈕通知我們。我們會嚴肅處理所有檢舉,並盡快審查標記內容,以維護平台的完整性與安全。使用 Context7 即表示你同意自行承擔風險。
## 🤝 與我們聯繫
歡迎追蹤與加入社群:
- 📢 追蹤我們的 [X](https://x.com/contextai) 以獲取最新消息
- 🌐 造訪我們的 [官方網站](https://context7.com)
- 💬 加入我們的 [Discord 社群](https://upstash.com/discord)
## 📺 Context7 媒體報導
- [Better Stack「免費工具讓 Cursor 智慧提升 10 倍」](https://youtu.be/52FC3qObp9E)
- [Cole Medin「這絕對是 AI 程式助理最強 MCP 伺服器」](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
- [Income Stream Surfers「Context7 + SequentialThinking MCPs這是 AGI 嗎?」](https://www.youtube.com/watch?v=-ggvzyLpK6o)
- [Julian Goldie SEO「Context7全新 MCP AI 代理更新」](https://www.youtube.com/watch?v=CTZm6fBYisc)
- [JeredBlu「Context 7 MCP即時獲取文件 + VS Code 設定」](https://www.youtube.com/watch?v=-ls0D-rtET4)
- [Income Stream Surfers「Context7將改變 AI 程式開發的新 MCP 伺服器」](https://www.youtube.com/watch?v=PS-2Azb-C3M)
- [AICodeKing「Context7 + Cline & RooCode這個 MCP 伺服器讓 CLINE 效率提升 100 倍!」](https://www.youtube.com/watch?v=qZfENAPMnyo)
- [Sean Kochel「5 個 MCP 伺服器讓你程式開發如虎添翼(即插即用)」](https://www.youtube.com/watch?v=LqTQi8qexJM)
## ⭐ 星標歷史
[![Star History Chart](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date)
## 📄 授權
MIT

118
docs/adding-projects.md Normal file
View File

@ -0,0 +1,118 @@
# Adding Projects to Context7
Context7 allows you to add your favorite libraries and frameworks to help developers get up-to-date documentation directly in their coding environment.
## Quick Submission
The easiest way to add a library is through our web interface:
**[Submit a Library →](https://context7.com/add-library?tab=github)**
Simply provide the GitHub repository URL and Context7 will automatically parse and index the project's documentation.
## Advanced Configuration with `context7.json`
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.
### Configuration Fields
Here's an example `context7.json` file with all available options:
```json
{
"$schema": "https://context7.com/schema/context7.json",
"projectTitle": "Upstash Ratelimit",
"description": "Ratelimiting library based on Upstash Redis",
"folders": [],
"excludeFolders": ["src"],
"excludeFiles": [],
"rules": ["Use Upstash Redis as a database", "Use single region set up"],
"previousVersions": [
{
"tag": "v1.2.1",
"title": "version 1.2.1"
}
]
}
```
> **💡 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.
#### Field Descriptions
- **`projectTitle`** (string): The display name for your project in Context7. This overrides the default repository name.
- **`description`** (string): A brief description of what your library does. This helps coding agents understand the purpose of your project.
- **`folders`** (array): Specific folder paths to include when parsing documentation. If empty, Context7 will scan the entire repository for relevant documentation files. Supports regex patterns and requires full paths.
- **`excludeFolders`** (array): Folder paths to exclude from documentation parsing. Useful for excluding source code directories, build folders, or other non-documentation content. Supports regex patterns and requires full paths.
- **`excludeFiles`** (array): Specific file names to exclude from documentation parsing. Only include the filename (not the path). Useful for excluding files like `CHANGELOG.md`, license files, or other non-documentation content that might not be relevant for coding agents. Regex patterns are not supported.
- **`rules`** (array): Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context provided to coding agents.
- **`previousVersions`** (array): Information about previous versions of your library that should also be available in Context7.
- **`tag`**: The Git tag or version identifier
- **`title`**: Human-readable version name
### Default Exclusions
If you don't specify `excludeFiles` or `excludeFolders` in your `context7.json`, Context7 uses these default patterns:
#### Default Excluded Files
```
CHANGELOG.md, changelog.md, CHANGELOG.mdx, changelog.mdx
LICENSE.md, license.md
CODE_OF_CONDUCT.md, code_of_conduct.md
```
#### Default Excluded Folders
```
*archive*, *archived*, old, docs/old, *deprecated*, *legacy*
*previous*, *outdated*, *superseded*
i18n/zh*, i18n/es*, i18n/fr*, i18n/de*, i18n/ja*, i18n/ko*
i18n/ru*, i18n/pt*, i18n/it*, i18n/ar*, i18n/hi*, i18n/tr*
i18n/nl*, i18n/pl*, i18n/sv*, i18n/vi*, i18n/th*
zh-cn, zh-tw, zh-hk, zh-mo, zh-sg
```
These defaults help ensure that coding agents receive relevant, current documentation without outdated or non-technical content.
## Who Can Add Configuration?
- **Library authors**: Add `context7.json` directly to your repository
- **Contributors**: Submit pull requests to add or update the configuration
- **Community members**: Propose improvements to how popular libraries are parsed
## Best Practices
1. **Keep descriptions concise**: Aim for one clear sentence that explains your library's purpose to coding agents
2. **Exclude irrelevant folders**: Use `excludeFolders` to avoid indexing source code, tests, or build artifacts
3. **Add helpful rules**: Include common gotchas or best practices that coding agents should know when generating code
4. **Maintain version history**: Keep important previous versions accessible for projects that need older APIs
## Adding a Version
To add a new version to your existing library:
1. **Add version to the `context7.json` file**: Update the `previousVersions` array with your new version:
```json
"previousVersions": [
{
"tag": "v2.0.0",
"title": "version 2.0.0"
}
]
```
> **Note**: The `tag` value must exactly match an existing Git tag in your GitHub repository.
2. **Refresh your library**: Go to your library page on Context7 and trigger a refresh to index the new version.
## Need Help?
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.

View File

@ -1,12 +1,14 @@
{
"name": "@upstash/context7-mcp",
"version": "1.0.6",
"version": "1.0.0",
"description": "MCP server for Context7",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc && chmod 755 dist/index.js",
"format": "prettier --write .",
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix"
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
"lint:check": "eslint \"**/*.{js,ts,tsx}\"",
"start": "node dist/index.js --transport http"
},
"repository": {
"type": "git",
@ -31,8 +33,8 @@
},
"homepage": "https://github.com/upstash/context7#readme",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.8.0",
"dotenv": "^16.5.0",
"@modelcontextprotocol/sdk": "^1.12.0",
"commander": "^14.0.0",
"zod": "^3.24.2"
},
"devDependencies": {

130
schema/context7.json Normal file
View File

@ -0,0 +1,130 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://context7.com/schema/context7.json",
"title": "Context7 Configuration Schema",
"description": "Configuration file for Context7 project parsing and documentation generation",
"type": "object",
"properties": {
"projectTitle": {
"type": "string",
"description": "The display name for your project in Context7. This overrides the default repository name.",
"minLength": 1,
"maxLength": 100,
"examples": ["Upstash Ratelimit", "Next.js", "React Query"]
},
"description": {
"type": "string",
"description": "A brief description of what your library does. This helps coding agents understand the purpose of your project.",
"minLength": 10,
"maxLength": 200,
"examples": [
"Ratelimiting library based on Upstash Redis",
"The React Framework for Production",
"Powerful data synchronization for React"
]
},
"folders": {
"type": "array",
"description": "Specific folder paths to include when parsing documentation. If empty, Context7 will scan the entire repository. Supports regex patterns and requires full paths.",
"items": {
"type": "string",
"minLength": 1
},
"uniqueItems": true,
"default": [],
"examples": [
["docs", "guides", "examples"],
["documentation/**"],
["api-reference", "tutorials/*"]
]
},
"excludeFolders": {
"type": "array",
"description": "Folder paths to exclude from documentation parsing. Supports regex patterns and requires full paths.",
"items": {
"type": "string",
"minLength": 1
},
"uniqueItems": true,
"default": [],
"examples": [
["src", "build", "node_modules"],
["**/test/**", "**/tests/**"],
["legacy/*", "archive"]
]
},
"excludeFiles": {
"type": "array",
"description": "Specific file names to exclude from documentation parsing. Only include the filename (not the path). Regex patterns are not supported.",
"items": {
"type": "string",
"minLength": 1,
"pattern": "^[^/\\\\]+$"
},
"uniqueItems": true,
"default": [],
"examples": [
["CHANGELOG.md", "LICENSE"],
["README-dev.md", "CONTRIBUTING.md"],
["package.json", "tsconfig.json"]
]
},
"rules": {
"type": "array",
"description": "Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context.",
"items": {
"type": "string",
"minLength": 5,
"maxLength": 200
},
"default": [],
"examples": [
["Always use TypeScript for better type safety"],
["Use Upstash Redis as a database", "Use single region set up"],
["Import components from the main package", "Follow the naming conventions"]
]
},
"previousVersions": {
"type": "array",
"description": "Information about previous versions of your library that should also be available in Context7.",
"items": {
"type": "object",
"properties": {
"tag": {
"type": "string",
"description": "The Git tag or version identifier",
"pattern": "^v?\\d+\\.\\d+\\.\\d+",
"examples": ["v1.2.1", "2.0.0", "v3.1.0-beta.1"]
},
"title": {
"type": "string",
"description": "Human-readable version name",
"minLength": 1,
"maxLength": 50,
"examples": ["version 1.2.1", "Legacy Version", "Beta Release"]
}
},
"required": ["tag", "title"],
"additionalProperties": false
},
"default": []
}
},
"additionalProperties": false,
"examples": [
{
"projectTitle": "Upstash Ratelimit",
"description": "Ratelimiting library based on Upstash Redis",
"folders": [],
"excludeFolders": ["src"],
"excludeFiles": [],
"rules": ["Use Upstash Redis as a database", "Use single region set up"],
"previousVersions": [
{
"tag": "v1.2.1",
"title": "version 1.2.1"
}
]
}
]
}

View File

@ -1,13 +1,9 @@
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
startCommand:
type: stdio
type: http
configSchema:
# JSON Schema defining the configuration options for the MCP.
type: object
description: Empty configuration
commandFunction:
# A JS function that produces the CLI command based on the given config to start the MCP on stdio.
|-
(config) => ({ command: 'node', args: ['dist/index.js'] })
description: No configuration required
exampleConfig: {}

View File

@ -5,74 +5,98 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { z } from "zod";
import { searchLibraries, fetchLibraryDocumentation } from "./lib/api.js";
import { formatSearchResults } from "./lib/utils.js";
import dotenv from "dotenv";
import { SearchResponse } from "./lib/types.js";
import { createServer } from "http";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
import { Command } from "commander";
// Load environment variables from .env file if present
dotenv.config();
const DEFAULT_MINIMUM_TOKENS = 10000;
// Get DEFAULT_MINIMUM_TOKENS from environment variable or use default
let DEFAULT_MINIMUM_TOKENS = 10000;
if (process.env.DEFAULT_MINIMUM_TOKENS) {
const parsedValue = parseInt(process.env.DEFAULT_MINIMUM_TOKENS, 10);
if (!isNaN(parsedValue) && parsedValue > 0) {
DEFAULT_MINIMUM_TOKENS = parsedValue;
} else {
console.warn(
`Warning: Invalid DEFAULT_MINIMUM_TOKENS value provided in environment variable. Using default value of 10000`
// Parse CLI arguments using commander
const program = new Command()
.option("--transport <stdio|http|sse>", "transport type", "stdio")
.option("--port <number>", "port for HTTP/SSE transport", "3000")
.allowUnknownOption() // let MCP Inspector / other wrappers pass through extra flags
.parse(process.argv);
const cliOptions = program.opts<{
transport: string;
port: string;
}>();
// Validate transport option
const allowedTransports = ["stdio", "http", "sse"];
if (!allowedTransports.includes(cliOptions.transport)) {
console.error(
`Invalid --transport value: '${cliOptions.transport}'. Must be one of: stdio, http, sse.`
);
}
process.exit(1);
}
// Create server instance
const server = new McpServer({
// Transport configuration
const TRANSPORT_TYPE = (cliOptions.transport || "stdio") as "stdio" | "http" | "sse";
// HTTP/SSE port configuration
const CLI_PORT = (() => {
const parsed = parseInt(cliOptions.port, 10);
return isNaN(parsed) ? undefined : parsed;
})();
// Store SSE transports by session ID
const sseTransports: Record<string, SSEServerTransport> = {};
// Function to create a new server instance with all tools registered
function createServerInstance() {
const server = new McpServer(
{
name: "Context7",
description: "Retrieves up-to-date documentation and code examples for any library.",
version: "1.0.6",
capabilities: {
resources: {},
tools: {},
version: "1.0.13",
},
});
{
instructions:
"Use this server to retrieve up-to-date documentation and code examples for any library.",
}
);
// Register Context7 tools
server.tool(
"resolve-library-id",
`Resolves a package name to a Context7-compatible library ID and returns a list of matching libraries.
`Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID.
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
When selecting the best match, consider:
- Name similarity to the query
- Description relevance
- Code Snippet count (documentation coverage)
- GitHub Stars (popularity)
Selection Process:
1. Analyze the query to understand what library/package the user is looking for
2. Return the most relevant match based on:
- Name similarity to the query (exact matches prioritized)
- Description relevance to the query's intent
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
- Trust score (consider libraries with scores of 7-10 more authoritative)
Return the selected library ID and explain your choice. If there are multiple good matches, mention this but proceed with the most relevant one.`,
Response Format:
- Return the selected library ID in a clearly marked section
- Provide a brief explanation for why this library was chosen
- If multiple good matches exist, acknowledge this but proceed with the most relevant one
- If no good matches exist, clearly state this and suggest query refinements
For ambiguous queries, request clarification before proceeding with a best-guess match.`,
{
libraryName: z
.string()
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
},
async ({ libraryName }) => {
const searchResponse = await searchLibraries(libraryName);
const searchResponse: SearchResponse = await searchLibraries(libraryName);
if (!searchResponse || !searchResponse.results) {
if (!searchResponse.results || searchResponse.results.length === 0) {
return {
content: [
{
type: "text",
text: "Failed to retrieve library documentation data from Context7",
},
],
};
}
if (searchResponse.results.length === 0) {
return {
content: [
{
type: "text",
text: "No documentation libraries available",
text: searchResponse.error
? searchResponse.error
: "Failed to retrieve library documentation data from Context7",
},
],
};
@ -87,15 +111,16 @@ Return the selected library ID and explain your choice. If there are multiple go
text: `Available Libraries (top matches):
Each result includes:
- Library ID: Context7-compatible identifier (format: /org/repo)
- Library ID: Context7-compatible identifier (format: /org/project)
- Name: Library or package name
- Description: Short summary
- Code Snippets: Number of available code examples
- GitHub Stars: Popularity indicator
- Trust Score: Authority indicator
- Versions: List of versions if available. Use one of those versions if and only if the user explicitly provides a version in their query.
For best results, select libraries based on name match, popularity (stars), snippet coverage, and relevance to your use case.
For best results, select libraries based on name match, trust score, snippet coverage, and relevance to your use case.
---
----------
${resultsText}`,
},
@ -106,12 +131,12 @@ ${resultsText}`,
server.tool(
"get-library-docs",
"Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool.",
"Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.",
{
context7CompatibleLibraryID: z
.string()
.describe(
"Exact Context7-compatible library ID (e.g., 'mongodb/docs', 'vercel/nextjs') retrieved from 'resolve-library-id'."
"Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'."
),
topic: z
.string()
@ -126,23 +151,12 @@ server.tool(
),
},
async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
// Extract folders parameter if present in the ID
let folders = "";
let libraryId = context7CompatibleLibraryID;
if (context7CompatibleLibraryID.includes("?folders=")) {
const [id, foldersParam] = context7CompatibleLibraryID.split("?folders=");
libraryId = id;
folders = foldersParam;
}
const documentationText = await fetchLibraryDocumentation(libraryId, {
const fetchDocsResponse = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
tokens,
topic,
folders,
});
if (!documentationText) {
if (!fetchDocsResponse) {
return {
content: [
{
@ -157,18 +171,127 @@ server.tool(
content: [
{
type: "text",
text: documentationText,
text: fetchDocsResponse,
},
],
};
}
);
return server;
}
async function main() {
const transportType = TRANSPORT_TYPE;
if (transportType === "http" || transportType === "sse") {
// Get initial port from environment or use default
const initialPort = CLI_PORT ?? 3000;
// Keep track of which port we end up using
let actualPort = initialPort;
const httpServer = createServer(async (req, res) => {
const url = new URL(req.url || "", `http://${req.headers.host}`).pathname;
// Set CORS headers for all responses
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,DELETE");
res.setHeader("Access-Control-Allow-Headers", "Content-Type, MCP-Session-Id, mcp-session-id");
// Handle preflight OPTIONS requests
if (req.method === "OPTIONS") {
res.writeHead(200);
res.end();
return;
}
try {
// Create new server instance for each request
const requestServer = createServerInstance();
if (url === "/mcp") {
const transport = new StreamableHTTPServerTransport({
sessionIdGenerator: undefined,
});
await requestServer.connect(transport);
await transport.handleRequest(req, res);
} else if (url === "/sse" && req.method === "GET") {
// Create new SSE transport for GET request
const sseTransport = new SSEServerTransport("/messages", res);
// Store the transport by session ID
sseTransports[sseTransport.sessionId] = sseTransport;
// Clean up transport when connection closes
res.on("close", () => {
delete sseTransports[sseTransport.sessionId];
});
await requestServer.connect(sseTransport);
} else if (url === "/messages" && req.method === "POST") {
// Get session ID from query parameters
const sessionId =
new URL(req.url || "", `http://${req.headers.host}`).searchParams.get("sessionId") ??
"";
if (!sessionId) {
res.writeHead(400);
res.end("Missing sessionId parameter");
return;
}
// Get existing transport for this session
const sseTransport = sseTransports[sessionId];
if (!sseTransport) {
res.writeHead(400);
res.end(`No transport found for sessionId: ${sessionId}`);
return;
}
// Handle the POST message with the existing transport
await sseTransport.handlePostMessage(req, res);
} else if (url === "/ping") {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("pong");
} else {
res.writeHead(404);
res.end("Not found");
}
} catch (error) {
console.error("Error handling request:", error);
if (!res.headersSent) {
res.writeHead(500);
res.end("Internal Server Error");
}
}
});
// Function to attempt server listen with port fallback
const startServer = (port: number, maxAttempts = 10) => {
httpServer.once("error", (err: NodeJS.ErrnoException) => {
if (err.code === "EADDRINUSE" && port < initialPort + maxAttempts) {
console.warn(`Port ${port} is in use, trying port ${port + 1}...`);
startServer(port + 1, maxAttempts);
} else {
console.error(`Failed to start server: ${err.message}`);
process.exit(1);
}
});
httpServer.listen(port, () => {
actualPort = port;
console.error(
`Context7 Documentation MCP Server running on ${transportType.toUpperCase()} at http://localhost:${actualPort}/mcp and legacy SSE at /sse`
);
});
};
// Start the server with initial port
startServer(initialPort);
} else {
// Stdio transport - this is already stateless by nature
const server = createServerInstance();
const transport = new StdioServerTransport();
await server.connect(transport);
console.error("Context7 Documentation MCP Server running on stdio");
}
}
main().catch((error) => {
console.error("Fatal error in main():", error);

View File

@ -8,19 +8,30 @@ const DEFAULT_TYPE = "txt";
* @param query The search query
* @returns Search results or null if the request fails
*/
export async function searchLibraries(query: string): Promise<SearchResponse | null> {
export async function searchLibraries(query: string): Promise<SearchResponse> {
try {
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/search`);
url.searchParams.set("query", query);
const response = await fetch(url);
if (!response.ok) {
console.error(`Failed to search libraries: ${response.status}`);
return null;
const errorCode = response.status;
if (errorCode === 429) {
console.error(`Rate limited due to too many requests. Please try again later.`);
return {
results: [],
error: `Rate limited due to too many requests. Please try again later.`,
} as SearchResponse;
}
console.error(`Failed to search libraries. Please try again later. Error code: ${errorCode}`);
return {
results: [],
error: `Failed to search libraries. Please try again later. Error code: ${errorCode}`,
} as SearchResponse;
}
return await response.json();
} catch (error) {
console.error("Error searching libraries:", error);
return null;
return { results: [], error: `Error searching libraries: ${error}` } as SearchResponse;
}
}
@ -35,7 +46,6 @@ export async function fetchLibraryDocumentation(
options: {
tokens?: number;
topic?: string;
folders?: string;
} = {}
): Promise<string | null> {
try {
@ -45,7 +55,6 @@ export async function fetchLibraryDocumentation(
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/${libraryId}`);
if (options.tokens) url.searchParams.set("tokens", options.tokens.toString());
if (options.topic) url.searchParams.set("topic", options.topic);
if (options.folders) url.searchParams.set("folders", options.folders);
url.searchParams.set("type", DEFAULT_TYPE);
const response = await fetch(url, {
headers: {
@ -53,8 +62,15 @@ export async function fetchLibraryDocumentation(
},
});
if (!response.ok) {
console.error(`Failed to fetch documentation: ${response.status}`);
return null;
const errorCode = response.status;
if (errorCode === 429) {
const errorMessage = `Rate limited due to too many requests. Please try again later.`;
console.error(errorMessage);
return errorMessage;
}
const errorMessage = `Failed to fetch documentation. Please try again later. Error code: ${errorCode}`;
console.error(errorMessage);
return errorMessage;
}
const text = await response.text();
if (!text || text === "No content available" || text === "No context data available") {
@ -62,7 +78,8 @@ export async function fetchLibraryDocumentation(
}
return text;
} catch (error) {
console.error("Error fetching library documentation:", error);
return null;
const errorMessage = `Error fetching library documentation. Please try again later. ${error}`;
console.error(errorMessage);
return errorMessage;
}
}

View File

@ -1,17 +1,20 @@
export interface SearchResult {
id: string;
title: string;
description?: string;
description: string;
branch: string;
lastUpdate: string;
lastUpdateDate: string;
state: DocumentState;
totalTokens: number;
totalSnippets: number;
totalPages: number;
stars: number;
stars?: number;
trustScore?: number;
versions?: string[];
}
export interface SearchResponse {
error?: string;
results: SearchResult[];
}

View File

@ -1,22 +1,45 @@
import { SearchResponse, SearchResult } from "./types.js";
/**
* Format a search result into a string representation
* @param result SearchResult to format
* @returns Formatted search result string
* Formats a search result into a human-readable string representation.
* Only shows code snippet count and GitHub stars when available (not equal to -1).
*
* @param result The SearchResult object to format
* @returns A formatted string with library information
*/
export function formatSearchResult(result: SearchResult): string {
return `- Title: ${result.title}
- Context7-compatible library ID: ${result.id}
- Description: ${result.description}
- Code Snippets: ${result.totalSnippets}
- GitHub Stars: ${result.stars}`;
// Always include these basic details
const formattedResult = [
`- Title: ${result.title}`,
`- Context7-compatible library ID: ${result.id}`,
`- Description: ${result.description}`,
];
// Only add code snippets count if it's a valid value
if (result.totalSnippets !== -1 && result.totalSnippets !== undefined) {
formattedResult.push(`- Code Snippets: ${result.totalSnippets}`);
}
// Only add trust score if it's a valid value
if (result.trustScore !== -1 && result.trustScore !== undefined) {
formattedResult.push(`- Trust Score: ${result.trustScore}`);
}
// Only add versions if it's a valid value
if (result.versions !== undefined && result.versions.length > 0) {
formattedResult.push(`- Versions: ${result.versions.join(", ")}`);
}
// Join all parts with newlines
return formattedResult.join("\n");
}
/**
* Format search results into a string representation
* @param searchResponse The search response to format
* @returns Formatted search results string
* Formats a search response into a human-readable string representation.
* Each result is formatted using formatSearchResult.
*
* @param searchResponse The SearchResponse object to format
* @returns A formatted string with search results
*/
export function formatSearchResults(searchResponse: SearchResponse): string {
if (!searchResponse.results || searchResponse.results.length === 0) {
@ -24,5 +47,5 @@ export function formatSearchResults(searchResponse: SearchResponse): string {
}
const formattedResults = searchResponse.results.map(formatSearchResult);
return formattedResults.join("\n---\n");
return formattedResults.join("\n----------\n");
}