├── .github └── workflows │ ├── check.yaml │ └── release.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── bun.lock ├── docs ├── README.ar.md ├── README.de.md ├── README.es.md ├── README.fr.md ├── README.id-ID.md ├── README.it.md ├── README.ja.md ├── README.ko.md ├── README.pt-BR.md ├── README.ru.md ├── README.tr.md ├── README.uk.md ├── README.zh-CN.md ├── README.zh-TW.md └── adding-projects.md ├── eslint.config.js ├── package.json ├── prettier.config.mjs ├── schema └── context7.json ├── smithery.yaml ├── src ├── index.ts └── lib │ ├── api.ts │ ├── types.ts │ └── utils.ts └── tsconfig.json /.github/workflows/check.yaml: -------------------------------------------------------------------------------- 1 | name: Build Check 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build: 15 | name: Build 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v4 20 | 21 | - name: Setup Bun 22 | uses: oven-sh/setup-bun@v2 23 | with: 24 | bun-version: latest 25 | 26 | - name: Cache dependencies 27 | uses: actions/cache@v4 28 | with: 29 | path: ~/.bun/install/cache 30 | key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} 31 | restore-keys: | 32 | ${{ runner.os }}-bun- 33 | 34 | - name: Install dependencies 35 | run: bun install --frozen-lockfile 36 | 37 | - name: Run linter 38 | run: bun run lint:check 39 | 40 | - name: Check formatting 41 | run: bun run format --check 42 | 43 | - name: Build project 44 | run: bun run build 45 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | release: 5 | types: 6 | - published 7 | 8 | jobs: 9 | release: 10 | name: Release 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout Repo 14 | uses: actions/checkout@v3 15 | 16 | - name: Set env 17 | run: | 18 | VERSION="${GITHUB_REF##refs/*/}" 19 | # Remove 'v' prefix if it exists 20 | VERSION="${VERSION#v}" 21 | echo "VERSION=$VERSION" >> $GITHUB_ENV 22 | 23 | - name: Setup Node 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version: lts/* 27 | 28 | - name: Setup Bun 29 | uses: oven-sh/setup-bun@v1 30 | with: 31 | bun-version: latest 32 | 33 | - name: Set package version 34 | run: | 35 | echo $(jq --arg v "${{ env.VERSION }}" '(.version) = $v' package.json) > package.json 36 | 37 | - name: Update version in source file 38 | run: | 39 | sed -i "s/version: \"[0-9]*\.[0-9]*\.[0-9]*\"/version: \"${{ env.VERSION }}\"/" src/index.ts 40 | 41 | - name: Install Dependencies 42 | run: bun install 43 | 44 | - name: Build 45 | run: bun run build 46 | 47 | - name: Set NPM_TOKEN 48 | run: npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}} 49 | 50 | - name: Publish 51 | if: "!github.event.release.prerelease" 52 | run: | 53 | npm pkg delete scripts.prepare 54 | npm publish --access public 55 | 56 | - name: Publish release candidate 57 | if: "github.event.release.prerelease" 58 | run: | 59 | npm pkg delete scripts.prepare 60 | npm publish --access public --tag=canary 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore 2 | 3 | # Logs 4 | 5 | logs 6 | _.log 7 | npm-debug.log_ 8 | yarn-debug.log* 9 | yarn-error.log* 10 | lerna-debug.log* 11 | .pnpm-debug.log* 12 | 13 | # Caches 14 | 15 | .cache 16 | 17 | # Diagnostic reports (https://nodejs.org/api/report.html) 18 | 19 | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 20 | 21 | # Runtime data 22 | 23 | pids 24 | _.pid 25 | _.seed 26 | *.pid.lock 27 | 28 | # Directory for instrumented libs generated by jscoverage/JSCover 29 | 30 | lib-cov 31 | 32 | # Coverage directory used by tools like istanbul 33 | 34 | coverage 35 | *.lcov 36 | 37 | # nyc test coverage 38 | 39 | .nyc_output 40 | 41 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 42 | 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | 47 | bower_components 48 | 49 | # node-waf configuration 50 | 51 | .lock-wscript 52 | 53 | # Compiled binary addons (https://nodejs.org/api/addons.html) 54 | 55 | build/Release 56 | 57 | # Dependency directories 58 | 59 | node_modules/ 60 | jspm_packages/ 61 | 62 | # Snowpack dependency directory (https://snowpack.dev/) 63 | 64 | web_modules/ 65 | 66 | # TypeScript cache 67 | 68 | *.tsbuildinfo 69 | 70 | # Optional npm cache directory 71 | 72 | .npm 73 | 74 | # Optional eslint cache 75 | 76 | .eslintcache 77 | 78 | # Optional stylelint cache 79 | 80 | .stylelintcache 81 | 82 | # Microbundle cache 83 | 84 | .rpt2_cache/ 85 | .rts2_cache_cjs/ 86 | .rts2_cache_es/ 87 | .rts2_cache_umd/ 88 | 89 | # Optional REPL history 90 | 91 | .node_repl_history 92 | 93 | # Output of 'npm pack' 94 | 95 | *.tgz 96 | 97 | # Yarn Integrity file 98 | 99 | .yarn-integrity 100 | 101 | # dotenv environment variable files 102 | 103 | .env 104 | .env.development.local 105 | .env.test.local 106 | .env.production.local 107 | .env.local 108 | 109 | # parcel-bundler cache (https://parceljs.org/) 110 | 111 | .parcel-cache 112 | 113 | # Next.js build output 114 | 115 | .next 116 | out 117 | 118 | # Nuxt.js build / generate output 119 | 120 | .nuxt 121 | dist 122 | 123 | # Gatsby files 124 | 125 | # Comment in the public line in if your project uses Gatsby and not Next.js 126 | 127 | # https://nextjs.org/blog/next-9-1#public-directory-support 128 | 129 | # public 130 | 131 | # vuepress build output 132 | 133 | .vuepress/dist 134 | 135 | # vuepress v2.x temp and cache directory 136 | 137 | .temp 138 | 139 | # Docusaurus cache and generated files 140 | 141 | .docusaurus 142 | 143 | # Serverless directories 144 | 145 | .serverless/ 146 | 147 | # FuseBox cache 148 | 149 | .fusebox/ 150 | 151 | # DynamoDB Local files 152 | 153 | .dynamodb/ 154 | 155 | # TernJS port file 156 | 157 | .tern-port 158 | 159 | # Stores VSCode versions used for testing VSCode extensions 160 | 161 | .vscode-test 162 | 163 | # yarn v2 164 | 165 | .yarn/cache 166 | .yarn/unplugged 167 | .yarn/build-state.yml 168 | .yarn/install-state.gz 169 | .pnp.* 170 | 171 | # IntelliJ based IDEs 172 | .idea 173 | 174 | # Finder (MacOS) folder config 175 | .DS_Store 176 | package-lock.json 177 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile 2 | # ----- Build Stage ----- 3 | FROM node:lts-alpine AS builder 4 | WORKDIR /app 5 | 6 | # Copy package and configuration 7 | COPY package.json bun.lock tsconfig.json ./ 8 | 9 | # Copy source code 10 | COPY src ./src 11 | 12 | # Install dependencies and build 13 | RUN npm install && npm run build 14 | 15 | # ----- Production Stage ----- 16 | FROM node:lts-alpine 17 | WORKDIR /app 18 | 19 | # Copy built artifacts 20 | COPY --from=builder /app/dist ./dist 21 | 22 | # Copy package.json for production install 23 | COPY package.json ./ 24 | 25 | # Install only production dependencies 26 | RUN npm install --production --ignore-scripts 27 | 28 | # Expose HTTP port 29 | EXPOSE 8080 30 | 31 | # Default command using CLI flags 32 | CMD ["node", "dist/index.js", "--transport", "http", "--port", "8080"] 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 Upstash, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /docs/README.ar.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - توثيق أكواد محدث لأي أمر برمجي 2 | 3 | [](https://context7.com) [](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) 4 | 5 | ## ❌ بدون Context7 6 | 7 | تعتمد النماذج اللغوية الكبيرة على معلومات قديمة أو عامة حول المكتبات التي تستخدمها. مما يؤدي إلى: 8 | 9 | - ❌ أمثلة أكواد قديمة مبنية على بيانات تدريب مضى عليها وقت طويل 10 | - ❌ واجهات برمجة تطبيقات وهمية غير موجودة 11 | - ❌ إجابات عامة لنسخ قديمة من الحزم 12 | 13 | ## ✅ مع Context7 14 | 15 | يستخرج Context7 MCP التوثيق والأمثلة البرمجية المحدثة مباشرة من المصدر — ويضعها في طلبك للنموذج. 16 | 17 | أضف `use context7` إلى طلبك في Cursor: 18 | 19 | ```txt 20 | أنشئ مشروع Next.js بسيط باستخدام app router. use context7 21 | ``` 22 | 23 | ```txt 24 | أنشئ سكربت لحذف الصفوف التي تكون فيها المدينة فارغة "" باستخدام بيانات اعتماد PostgreSQL. use context7 25 | ``` 26 | 27 | يقوم Context7 بجلب الأمثلة المحدثة والتوثيق المناسب مباشرة إلى السياق. 28 | 29 | - 1️⃣ اكتب طلبك بشكل طبيعي 30 | - 2️⃣ أخبر النموذج بـ `use context7` 31 | - 3️⃣ احصل على أكواد تعمل مباشرة 32 | 33 | لا حاجة للتنقل بين التبويبات، لا واجهات برمجة تطبيقات وهمية، لا أكواد قديمة. 34 | 35 | ## 🛠️ البدء 36 | 37 | ### المتطلبات 38 | 39 | - Node.js إصدار 18.0.0 أو أعلى 40 | - Cursor، Windsurf، Claude Desktop أو أي عميل MCP آخر 41 | 42 | ### التثبيت عبر Smithery 43 | 44 | لتثبيت Context7 MCP Server تلقائيًا لـ Claude Desktop: 45 | 46 | ```bash 47 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 48 | ``` 49 | 50 | ### التثبيت في Cursor 51 | 52 | اذهب إلى: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 53 | 54 | أو أضف هذا إلى ملف `~/.cursor/mcp.json`: 55 | 56 | ```json 57 | { 58 | "mcpServers": { 59 | "context7": { 60 | "command": "npx", 61 | "args": ["-y", "@upstash/context7-mcp@latest"] 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | ### التثبيت باستخدام Bun 68 | 69 | ```json 70 | { 71 | "mcpServers": { 72 | "context7": { 73 | "command": "bunx", 74 | "args": ["-y", "@upstash/context7-mcp@latest"] 75 | } 76 | } 77 | } 78 | ``` 79 | 80 | ### التثبيت باستخدام Deno 81 | 82 | ```json 83 | { 84 | "mcpServers": { 85 | "context7": { 86 | "command": "deno", 87 | "args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"] 88 | } 89 | } 90 | } 91 | ``` 92 | 93 | ### التثبيت في Windsurf 94 | 95 | ```json 96 | { 97 | "mcpServers": { 98 | "context7": { 99 | "command": "npx", 100 | "args": ["-y", "@upstash/context7-mcp@latest"] 101 | } 102 | } 103 | } 104 | ``` 105 | 106 | ### التثبيت في VS Code 107 | 108 | ```json 109 | { 110 | "servers": { 111 | "Context7": { 112 | "type": "stdio", 113 | "command": "npx", 114 | "args": ["-y", "@upstash/context7-mcp@latest"] 115 | } 116 | } 117 | } 118 | ``` 119 | 120 | ### التثبيت في Zed 121 | 122 | ```json 123 | { 124 | "context_servers": { 125 | "Context7": { 126 | "command": { 127 | "path": "npx", 128 | "args": ["-y", "@upstash/context7-mcp@latest"] 129 | }, 130 | "settings": {} 131 | } 132 | } 133 | } 134 | ``` 135 | 136 | ### التثبيت في Claude Code 137 | 138 | ```sh 139 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 140 | ``` 141 | 142 | ### التثبيت في Claude Desktop 143 | 144 | ```json 145 | { 146 | "mcpServers": { 147 | "Context7": { 148 | "command": "npx", 149 | "args": ["-y", "@upstash/context7-mcp@latest"] 150 | } 151 | } 152 | } 153 | ``` 154 | 155 | ### التثبيت في BoltAI 156 | 157 | ```json 158 | { 159 | "mcpServers": { 160 | "context7": { 161 | "command": "npx", 162 | "args": ["-y", "@upstash/context7-mcp@latest"] 163 | } 164 | } 165 | } 166 | ``` 167 | 168 | ### التثبيت في Copilot Coding Agent 169 | 170 | أضف التكوين التالي إلى قسم `mcp` في ملف إعدادات Copilot Coding Agent الخاص بك Repository->Settings->Copilot->Coding agent->MCP configuration: 171 | 172 | ```json 173 | { 174 | "mcpServers": { 175 | "context7": { 176 | "type": "http", 177 | "url": "https://mcp.context7.com/mcp", 178 | "tools": [ 179 | "get-library-docs", 180 | "resolve-library-id" 181 | ] 182 | } 183 | } 184 | } 185 | ``` 186 | 187 | لمزيد من المعلومات، راجع [التوثيق الرسمي على GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 188 | 189 | ### باستخدام Docker 190 | 191 | **Dockerfile:** 192 | 193 | ```Dockerfile 194 | FROM node:18-alpine 195 | WORKDIR /app 196 | RUN npm install -g @upstash/context7-mcp@latest 197 | CMD ["context7-mcp"] 198 | ``` 199 | 200 | **بناء الصورة:** 201 | 202 | ```bash 203 | docker build -t context7-mcp . 204 | ``` 205 | 206 | **التهيئة داخل العميل:** 207 | 208 | ```json 209 | { 210 | "mcpServers": { 211 | "Context7": { 212 | "command": "docker", 213 | "args": ["run", "-i", "--rm", "context7-mcp"], 214 | "transportType": "stdio" 215 | } 216 | } 217 | } 218 | ``` 219 | 220 | ### التثبيت في Windows 221 | 222 | ```json 223 | { 224 | "mcpServers": { 225 | "github.com/upstash/context7-mcp": { 226 | "command": "cmd", 227 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], 228 | "disabled": false, 229 | "autoApprove": [] 230 | } 231 | } 232 | } 233 | ``` 234 | 235 | ### المتغيرات البيئية 236 | 237 | ```json 238 | { 239 | "mcpServers": { 240 | "context7": { 241 | "command": "npx", 242 | "args": ["-y", "@upstash/context7-mcp@latest"], 243 | "env": { 244 | "DEFAULT_MINIMUM_TOKENS": "10000" 245 | } 246 | } 247 | } 248 | } 249 | ``` 250 | 251 | ### الأدوات المتوفرة 252 | 253 | - `resolve-library-id`: يحول اسم مكتبة عام إلى معرف متوافق مع Context7. 254 | - `get-library-docs`: يستخرج التوثيق حسب المعرف. 255 | 256 | - `context7CompatibleLibraryID`: مطلوب 257 | - `topic`: موضوع معين مثل "routing" 258 | - `tokens`: الحد الأعلى لعدد الرموز 259 | 260 | ## التطوير 261 | 262 | ```bash 263 | bun i 264 | bun run build 265 | ``` 266 | 267 | **التهيئة المحلية:** 268 | 269 | ```json 270 | { 271 | "mcpServers": { 272 | "context7": { 273 | "command": "npx", 274 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 275 | } 276 | } 277 | } 278 | ``` 279 | 280 | **الاختبار باستخدام MCP Inspector:** 281 | 282 | ```bash 283 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 284 | ``` 285 | 286 | ## استكشاف الأخطاء 287 | 288 | ### ERR_MODULE_NOT_FOUND 289 | 290 | استخدم `bunx` بدلاً من `npx`. 291 | 292 | ```json 293 | { 294 | "mcpServers": { 295 | "context7": { 296 | "command": "bunx", 297 | "args": ["-y", "@upstash/context7-mcp@latest"] 298 | } 299 | } 300 | } 301 | ``` 302 | 303 | ### مشاكل في ESM 304 | 305 | جرّب إضافة: 306 | 307 | ```json 308 | { 309 | "command": "npx", 310 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 311 | } 312 | ``` 313 | 314 | ### أخطاء عميل MCP 315 | 316 | 1. أزل `@latest` 317 | 2. جرّب `bunx` 318 | 3. جرّب `deno` 319 | 4. تأكد أنك تستخدم Node v18 أو أحدث 320 | 321 | ## إخلاء مسؤولية 322 | 323 | المشاريع المدرجة في Context7 مساهم بها من المجتمع، ولا يمكن ضمان دقتها أو أمانها بشكل كامل. الرجاء الإبلاغ عن أي محتوى مريب باستخدام زر "الإبلاغ". 324 | 325 | ## Context7 في الإعلام 326 | 327 | - [Better Stack: "أداة مجانية تجعل Cursor أذكى 10x"](https://youtu.be/52FC3qObp9E) 328 | - [Cole Medin: "أفضل MCP Server لمساعدين الذكاء الاصطناعي البرمجيين"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 329 | - [Context7 + SequentialThinking: هل هذا AGI؟](https://www.youtube.com/watch?v=-ggvzyLpK6o) 330 | - [تحديث جديد من Context7 MCP](https://www.youtube.com/watch?v=CTZm6fBYisc) 331 | - [إعداد Context7 في VS Code](https://www.youtube.com/watch?v=-ls0D-rtET4) 332 | - [Context7: MCP جديد سيغير البرمجة](https://www.youtube.com/watch?v=PS-2Azb-C3M) 333 | - [Cline & RooCode + Context7: قوة مضاعفة](https://www.youtube.com/watch?v=qZfENAPMnyo) 334 | - [أفضل 5 MCP Servers لتجربة برمجة ساحرة](https://www.youtube.com/watch?v=LqTQi8qexJM) 335 | 336 | ## سجل النجوم 337 | 338 | [](https://www.star-history.com/#upstash/context7&Date) 339 | 340 | ## الترخيص 341 | 342 | MIT 343 | -------------------------------------------------------------------------------- /docs/README.de.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Aktuelle Dokumentation für jeden Prompt 2 | 3 | [](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="In VS Code installieren (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) 4 | 5 | ## ❌ Ohne Context7 6 | 7 | KI-Sprachmodelle (LLMs) greifen auf veraltete oder allgemeine Informationen über die von dir verwendeten Bibliotheken zurück. Das Ergebnis: 8 | 9 | - ❌ Codebeispiele sind veraltet und basieren auf Trainingsdaten, die Jahre alt sind 10 | - ❌ Halluzinierte APIs, die gar nicht existieren 11 | - ❌ Generische Antworten für alte Paketversionen 12 | 13 | ## ✅ Mit Context7 14 | 15 | Context7 MCP holt aktuelle, versionsspezifische Dokumentationen und Codebeispiele direkt aus der Quelle und fügt sie in deinen Prompt ein. 16 | 17 | Füge `use context7` zu deinem Prompt in Cursor hinzu: 18 | 19 | ```txt 20 | Erstelle ein einfaches Next.js-Projekt mit dem App Router. use context7 21 | ``` 22 | 23 | ```txt 24 | Erstelle ein Skript zum Löschen der Zeilen, in denen die Stadt "" ist, mit PostgreSQL-Anmeldedaten. use context7 25 | ``` 26 | 27 | Context7 holt aktuelle Codebeispiele und Dokumentationen direkt in den Kontext deines LLMs. 28 | 29 | - 1️⃣ Schreibe deinen Prompt auf natürliche Weise 30 | - 2️⃣ Weise das LLM an, context7 zu verwenden, mit `use context7` 31 | - 3️⃣ Erhalte funktionierende Codeantworten 32 | 33 | Kein Tab-Switching, keine halluzinierten APIs, die nicht existieren, keine veralteten Code-Generierungen. 34 | 35 | ## 🛠️ Erste Schritte 36 | 37 | ### Anforderungen 38 | 39 | - Node.js >= v18.0.0 40 | - Cursor, Windsurf, Claude Desktop oder ein anderer MCP-Client 41 | 42 | ### Installation über Smithery 43 | 44 | Um den Context7 MCP Server für Claude Desktop automatisch über [Smithery](https://smithery.ai/server/@upstash/context7-mcp) zu installieren: 45 | 46 | ```bash 47 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 48 | ``` 49 | 50 | ### Installation in Cursor 51 | 52 | Gehe zu: `Einstellungen` -> `Cursor-Einstellungen` -> `MCP` -> `Neuen globalen MCP-Server hinzufügen` 53 | 54 | Der empfohlene Ansatz ist die folgende Konfiguration in deine Cursor-Datei `~/.cursor/mcp.json` einzufügen. Siehe die [Cursor MCP Dokumentation](https://docs.cursor.com/context/model-context-protocol) für mehr Informationen. 55 | 56 | ```json 57 | { 58 | "mcpServers": { 59 | "context7": { 60 | "command": "npx", 61 | "args": ["-y", "@upstash/context7-mcp@latest"] 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | <details> 68 | <summary>Alternative: Bun verwenden</summary> 69 | 70 | ```json 71 | { 72 | "mcpServers": { 73 | "context7": { 74 | "command": "bunx", 75 | "args": ["-y", "@upstash/context7-mcp@latest"] 76 | } 77 | } 78 | } 79 | ``` 80 | 81 | </details> 82 | 83 | <details> 84 | <summary>Alternative: Deno verwenden</summary> 85 | 86 | ```json 87 | { 88 | "mcpServers": { 89 | "context7": { 90 | "command": "deno", 91 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 92 | } 93 | } 94 | } 95 | ``` 96 | 97 | </details> 98 | 99 | ### Installation in Windsurf 100 | 101 | Füge dies zu deiner Windsurf MCP-Konfigurationsdatei hinzu. Siehe die [Windsurf MCP Dokumentation](https://docs.windsurf.com/windsurf/mcp) für mehr Informationen. 102 | 103 | ```json 104 | { 105 | "mcpServers": { 106 | "context7": { 107 | "command": "npx", 108 | "args": ["-y", "@upstash/context7-mcp@latest"] 109 | } 110 | } 111 | } 112 | ``` 113 | 114 | ### Installation in VS Code 115 | 116 | [<img alt="In VS Code installieren (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) 117 | [<img alt="In VS Code Insiders installieren (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) 118 | 119 | Füge dies zu deiner VS Code MCP-Konfigurationsdatei hinzu. Siehe die [VS Code MCP Dokumentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) für mehr Informationen. 120 | 121 | ```json 122 | { 123 | "servers": { 124 | "Context7": { 125 | "type": "stdio", 126 | "command": "npx", 127 | "args": ["-y", "@upstash/context7-mcp@latest"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | ### Installation in Zed 134 | 135 | Es kann über [Zed Extensions](https://zed.dev/extensions?query=Context7) installiert werden oder du kannst dies zu deiner Zed `settings.json` hinzufügen. Siehe die [Zed Context Server Dokumentation](https://zed.dev/docs/assistant/context-servers) für mehr Informationen. 136 | 137 | ```json 138 | { 139 | "context_servers": { 140 | "Context7": { 141 | "command": { 142 | "path": "npx", 143 | "args": ["-y", "@upstash/context7-mcp@latest"] 144 | }, 145 | "settings": {} 146 | } 147 | } 148 | } 149 | ``` 150 | 151 | ### Installation in Claude Code 152 | 153 | Führe diesen Befehl aus. Siehe die [Claude Code MCP Dokumentation](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) für mehr Informationen. 154 | 155 | ```sh 156 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 157 | ``` 158 | 159 | ### Installation in Claude Desktop 160 | 161 | Füge dies zu deiner Claude Desktop `claude_desktop_config.json` Datei hinzu. Siehe die [Claude Desktop MCP Dokumentation](https://modelcontextprotocol.io/quickstart/user) für mehr Informationen. 162 | 163 | ```json 164 | { 165 | "mcpServers": { 166 | "Context7": { 167 | "command": "npx", 168 | "args": ["-y", "@upstash/context7-mcp@latest"] 169 | } 170 | } 171 | } 172 | ``` 173 | 174 | 175 | ### Installation im Copilot Coding Agent 176 | 177 | Füge die folgende Konfiguration zum Abschnitt `mcp` deiner Copilot Coding Agent-Konfigurationsdatei hinzu (Repository->Settings->Copilot->Coding agent->MCP configuration): 178 | 179 | ```json 180 | { 181 | "mcpServers": { 182 | "context7": { 183 | "type": "http", 184 | "url": "https://mcp.context7.com/mcp", 185 | "tools": [ 186 | "get-library-docs", 187 | "resolve-library-id" 188 | ] 189 | } 190 | } 191 | } 192 | ``` 193 | 194 | Weitere Informationen findest du in der [offiziellen GitHub-Dokumentation](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 195 | 196 | ### Docker verwenden 197 | 198 | Wenn du den MCP-Server lieber in einem Docker-Container ausführen möchtest: 199 | 200 | 1. **Docker-Image erstellen:** 201 | 202 | Erstelle zunächst ein `Dockerfile` im Projekt-Root (oder an einem Ort deiner Wahl): 203 | 204 | <details> 205 | <summary>Klicke, um den Dockerfile-Inhalt zu sehen</summary> 206 | 207 | ```Dockerfile 208 | FROM node:18-alpine 209 | 210 | WORKDIR /app 211 | 212 | # Installiere die neueste Version global 213 | RUN npm install -g @upstash/context7-mcp@latest 214 | 215 | # Port freigeben, falls nötig (optional, abhängig von der MCP-Client-Interaktion) 216 | # EXPOSE 3000 217 | 218 | # Standardbefehl zum Ausführen des Servers 219 | CMD ["context7-mcp"] 220 | ``` 221 | 222 | </details> 223 | 224 | Baue dann das Image mit einem Tag (z.B. `context7-mcp`). **Stelle sicher, dass Docker Desktop (oder der Docker-Daemon) läuft.** Führe den folgenden Befehl in dem Verzeichnis aus, in dem du das `Dockerfile` gespeichert hast: 225 | 226 | ```bash 227 | docker build -t context7-mcp . 228 | ``` 229 | 230 | 2. **Konfiguriere deinen MCP-Client:** 231 | 232 | Aktualisiere die Konfiguration deines MCP-Clients, um den Docker-Befehl zu verwenden. 233 | 234 | _Beispiel für eine cline_mcp_settings.json:_ 235 | 236 | ```json 237 | { 238 | "mcpServers": { 239 | "Сontext7": { 240 | "autoApprove": [], 241 | "disabled": false, 242 | "timeout": 60, 243 | "command": "docker", 244 | "args": ["run", "-i", "--rm", "context7-mcp"], 245 | "transportType": "stdio" 246 | } 247 | } 248 | } 249 | ``` 250 | 251 | _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._ 252 | 253 | ### Verfügbare Tools 254 | 255 | - `resolve-library-id`: Löst einen allgemeinen Bibliotheksnamen in eine Context7-kompatible Bibliotheks-ID auf. 256 | - `libraryName` (erforderlich) 257 | - `get-library-docs`: Ruft die Dokumentation für eine Bibliothek mit einer Context7-kompatiblen Bibliotheks-ID ab. 258 | - `context7CompatibleLibraryID` (erforderlich) 259 | - `topic` (optional): Fokussiert die Dokumentation auf ein bestimmtes Thema (z.B. "routing", "hooks") 260 | - `tokens` (optional, Standard 10000): Maximale Anzahl von zurückzugebenden Tokens. Werte unter 10000 werden automatisch auf 10000 erhöht. 261 | 262 | ## Entwicklung 263 | 264 | Klone das Projekt und installiere die Abhängigkeiten: 265 | 266 | ```bash 267 | bun i 268 | ``` 269 | 270 | Bauen: 271 | 272 | ```bash 273 | bun run build 274 | ``` 275 | 276 | ### Lokales Konfigurationsbeispiel 277 | 278 | ```json 279 | { 280 | "mcpServers": { 281 | "context7": { 282 | "command": "npx", 283 | "args": ["tsx", "/pfad/zum/ordner/context7-mcp/src/index.ts"] 284 | } 285 | } 286 | } 287 | ``` 288 | 289 | ### Testen mit MCP Inspector 290 | 291 | ```bash 292 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 293 | ``` 294 | 295 | ## Fehlerbehebung 296 | 297 | ### ERR_MODULE_NOT_FOUND 298 | 299 | Wenn du diesen Fehler siehst, versuche `bunx` anstelle von `npx` zu verwenden. 300 | 301 | ```json 302 | { 303 | "mcpServers": { 304 | "context7": { 305 | "command": "bunx", 306 | "args": ["-y", "@upstash/context7-mcp@latest"] 307 | } 308 | } 309 | } 310 | ``` 311 | 312 | Dies löst häufig Probleme bei der Modulauflösung, besonders in Umgebungen, in denen `npx` Pakete nicht ordnungsgemäß installiert oder auflöst. 313 | 314 | ### ESM-Auflösungsprobleme 315 | 316 | Wenn du einen Fehler wie `Error: Cannot find module 'uriTemplate.js'` bekommst, versuche mit dem Flag `--experimental-vm-modules` auszuführen: 317 | 318 | ```json 319 | { 320 | "mcpServers": { 321 | "context7": { 322 | "command": "npx", 323 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 324 | } 325 | } 326 | } 327 | ``` 328 | 329 | ### MCP-Client-Fehler 330 | 331 | 1. Versuche, `@latest` aus dem Paketnamen zu entfernen. 332 | 333 | 2. Versuche, `bunx` als Alternative zu verwenden. 334 | 335 | 3. Versuche, `deno` als Alternative zu verwenden. 336 | 337 | 4. Stelle sicher, dass du Node v18 oder höher verwendest, um native Fetch-Unterstützung mit `npx` zu haben. 338 | 339 | ## Haftungsausschluss 340 | 341 | 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. 342 | 343 | ## Context7 in den Medien 344 | 345 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 346 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 347 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 348 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 349 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 350 | - [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 351 | 352 | ## Verlauf der Sterne 353 | 354 | [](https://www.star-history.com/#upstash/context7&Date) 355 | 356 | ## Lizenz 357 | 358 | MIT 359 | -------------------------------------------------------------------------------- /docs/README.es.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Documentación Actualizada Para Cualquier Prompt 2 | 3 | [](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="Instalar en VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Instalar%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) 4 | 5 | ## ❌ Sin Context7 6 | 7 | Los LLMs dependen de información desactualizada o genérica sobre las bibliotecas que utilizas. Obtienes: 8 | 9 | - ❌ Ejemplos de código desactualizados y basados en datos de entrenamiento de hace un año 10 | - ❌ APIs inventadas que ni siquiera existen 11 | - ❌ Respuestas genéricas para versiones antiguas de paquetes 12 | 13 | ## ✅ Con Context7 14 | 15 | El Context7 MCP obtiene documentación y ejemplos de código actualizados y específicos de la versión directamente desde la fuente, y los coloca directamente en tu prompt. 16 | 17 | Añade `use context7` a tu prompt en Cursor: 18 | 19 | ```txt 20 | Crea un proyecto básico de Next.js con app router. use context7 21 | ``` 22 | 23 | ```txt 24 | Crea un script para eliminar las filas donde la ciudad es "" dadas las credenciales de PostgreSQL. use context7 25 | ``` 26 | 27 | Context7 obtiene ejemplos de código y documentación actualizados directamente en el contexto de tu LLM. 28 | 29 | - 1️⃣ Escribe tu prompt de forma natural 30 | - 2️⃣ Dile al LLM que `use context7` 31 | - 3️⃣ Obtén respuestas de código que funcionan 32 | 33 | Sin cambiar de pestaña, sin APIs inventadas que no existen, sin generaciones de código desactualizadas. 34 | 35 | ## 🛠️ Empezando 36 | 37 | ### Requisitos 38 | 39 | - Node.js >= v18.0.0 40 | - Cursor, Windsurf, Claude Desktop u otro Cliente MCP 41 | 42 | ### Instalando vía Smithery 43 | 44 | Para instalar Context7 MCP Server para Claude Desktop automáticamente vía [Smithery](https://smithery.ai/server/@upstash/context7-mcp): 45 | 46 | ```bash 47 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 48 | ``` 49 | 50 | ### Instalar en Cursor 51 | 52 | Ve a: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 53 | 54 | Pegar la siguiente configuración en tu archivo `~/.cursor/mcp.json` de Cursor es el metodo recomendado. Consulta la [documentación de MCP de Cursor](https://docs.cursor.com/context/model-context-protocol) para más información. 55 | 56 | ```json 57 | { 58 | "mcpServers": { 59 | "context7": { 60 | "command": "npx", 61 | "args": ["-y", "@upstash/context7-mcp@latest"] 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | <details> 68 | <summary>Alternativa: Usar Bun</summary> 69 | 70 | ```json 71 | { 72 | "mcpServers": { 73 | "context7": { 74 | "command": "bunx", 75 | "args": ["-y", "@upstash/context7-mcp@latest"] 76 | } 77 | } 78 | } 79 | ``` 80 | 81 | </details> 82 | 83 | <details> 84 | <summary>Alternativa: Usar Deno</summary> 85 | 86 | ```json 87 | { 88 | "mcpServers": { 89 | "context7": { 90 | "command": "deno", 91 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 92 | } 93 | } 94 | } 95 | ``` 96 | 97 | </details> 98 | 99 | ### Instalar en Windsurf 100 | 101 | Añade esto a tu archivo de configuración MCP de Windsurf. Consulta la [documentación de MCP de Windsurf](https://docs.windsurf.com/windsurf/mcp) para más información. 102 | 103 | ```json 104 | { 105 | "mcpServers": { 106 | "context7": { 107 | "command": "npx", 108 | "args": ["-y", "@upstash/context7-mcp@latest"] 109 | } 110 | } 111 | } 112 | ``` 113 | 114 | ### Instalar en VS Code 115 | 116 | [<img alt="Instalar en VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Instalar%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) 117 | [<img alt="Instalar en VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Instalar%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) 118 | 119 | Añade esto a tu archivo de configuración MCP de VS Code. Consulta la [documentación de VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) para más información. 120 | 121 | ```json 122 | { 123 | "servers": { 124 | "Context7": { 125 | "type": "stdio", 126 | "command": "npx", 127 | "args": ["-y", "@upstash/context7-mcp@latest"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | ### Instalar en Claude Code 134 | 135 | Ejecuta este comando. Consulta la [documentación de MCP de Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) para más información. 136 | 137 | ```sh 138 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 139 | ``` 140 | 141 | ### Instalar en Claude Desktop 142 | 143 | Añade esto a tu archivo `claude_desktop_config.json` de Claude Desktop. Consulta la [documentación de MCP de Claude Desktop](https://modelcontextprotocol.io/quickstart/user) para más información. 144 | 145 | ```json 146 | { 147 | "mcpServers": { 148 | "Context7": { 149 | "command": "npx", 150 | "args": ["-y", "@upstash/context7-mcp@latest"] 151 | } 152 | } 153 | } 154 | ``` 155 | 156 | ### Instalar en Copilot Coding Agent 157 | 158 | Agrega la siguiente configuración a la sección `mcp` de tu archivo de configuración de Copilot Coding Agent (Repository->Settings->Copilot->Coding agent->MCP configuration): 159 | 160 | ```json 161 | { 162 | "mcpServers": { 163 | "context7": { 164 | "type": "http", 165 | "url": "https://mcp.context7.com/mcp", 166 | "tools": [ 167 | "get-library-docs", 168 | "resolve-library-id" 169 | ] 170 | } 171 | } 172 | } 173 | ``` 174 | 175 | Para más información, consulta la [documentación oficial de GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 176 | 177 | 178 | ### Herramientas Disponibles 179 | 180 | - `resolve-library-id`: Resuelve un nombre de una biblioteca general en un ID de biblioteca compatible con Context7. 181 | - `libraryName` (requerido) 182 | - `get-library-docs`: Obtiene documentación para una biblioteca utilizando un ID de biblioteca compatible con Context7. 183 | - `context7CompatibleLibraryID` (requerido) 184 | - `topic` (opcional): Enfoca la documentación en un tema específico (p. ej., "routing", "hooks") 185 | - `tokens` (opcional, por defecto 10000): Número máximo de tokens a devolver. Los valores inferiores a 10000 se aumentan automáticamente a 10000. 186 | 187 | ## Desarrollo 188 | 189 | Clona el proyecto e instala las dependencias: 190 | 191 | ```bash 192 | bun i 193 | ``` 194 | 195 | Compila: 196 | 197 | ```bash 198 | bun run build 199 | ``` 200 | 201 | ### Ejemplo de Configuración Local 202 | 203 | ```json 204 | { 205 | "mcpServers": { 206 | "context7": { 207 | "command": "npx", 208 | "args": ["tsx", "/ruta/a/la/carpeta/context7-mcp/src/index.ts"] 209 | } 210 | } 211 | } 212 | ``` 213 | 214 | ### Probando con MCP Inspector 215 | 216 | ```bash 217 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 218 | ``` 219 | 220 | ## Solución de Problemas 221 | 222 | ### ERR_MODULE_NOT_FOUND 223 | 224 | Si ves este error, intenta usar `bunx` en lugar de `npx`. 225 | 226 | ```json 227 | { 228 | "mcpServers": { 229 | "context7": { 230 | "command": "bunx", 231 | "args": ["-y", "@upstash/context7-mcp@latest"] 232 | } 233 | } 234 | } 235 | ``` 236 | 237 | Esto a menudo resuelve problemas de resolución de módulos, especialmente en entornos donde `npx` no instala o resuelve paquetes correctamente. 238 | 239 | ### Errores del Cliente MCP 240 | 241 | 1. Intenta eliminar `@latest` del nombre del paquete. 242 | 243 | 2. Intenta usar `bunx` como alternativa. 244 | 245 | 3. Intenta usar `deno` como alternativa. 246 | 247 | ## Context7 en los Medios 248 | 249 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 250 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 251 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 252 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 253 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 254 | - [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 255 | 256 | ## Historial de Estrellas 257 | 258 | [](https://www.star-history.com/#upstash/context7&Date) 259 | 260 | ## Licencia 261 | 262 | MIT 263 | -------------------------------------------------------------------------------- /docs/README.fr.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Documentation à jour pour vos prompts 2 | 3 | [](https://context7.com) [](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) 4 | 5 | ## ❌ Sans Context7 6 | 7 | Les LLMs s’appuient sur des informations obsolètes ou génériques concernant les bibliothèques que vous utilisez. Vous obtenez : 8 | 9 | - ❌ Des exemples de code obsolètes, basés sur des données d’entraînement vieilles d’un an 10 | - ❌ Des APIs inventées qui n’existent même pas 11 | - ❌ Des réponses génériques pour d’anciennes versions de packages 12 | 13 | ## ✅ Avec Context7 14 | 15 | Context7 MCP récupère la documentation et les exemples de code à jour, spécifiques à la version, directement à la source — et les place dans votre prompt. 16 | 17 | Ajoutez `use context7` à votre prompt dans Cursor : 18 | 19 | ```txt 20 | Crée un projet Next.js basique avec app router. use context7 21 | ``` 22 | 23 | ```txt 24 | Crée un script pour supprimer les lignes où la ville est "" avec des identifiants PostgreSQL. use context7 25 | ``` 26 | 27 | Context7 apporte des exemples de code et de la documentation à jour directement dans le contexte de votre LLM. 28 | 29 | - 1️⃣ Rédigez votre prompt naturellement 30 | - 2️⃣ Dites au LLM `use context7` 31 | - 3️⃣ Obtenez des réponses de code qui fonctionnent 32 | 33 | Plus besoin de changer d’onglet, plus d’APIs inventées, plus de code obsolète. 34 | 35 | ## 🛠️ Démarrage 36 | 37 | ### Prérequis 38 | 39 | - Node.js >= v18.0.0 40 | - Cursor, Windsurf, Claude Desktop ou un autre client MCP 41 | 42 | ### Installation via Smithery 43 | 44 | Pour installer Context7 MCP Server pour Claude Desktop automatiquement via [Smithery](https://smithery.ai/server/@upstash/context7-mcp) : 45 | 46 | ```bash 47 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 48 | ``` 49 | 50 | ### Installation dans Cursor 51 | 52 | Allez dans : `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 53 | 54 | La méthode recommandée est de coller la configuration suivante dans votre fichier `~/.cursor/mcp.json`. Voir la [documentation Cursor MCP](https://docs.cursor.com/context/model-context-protocol) pour plus d’informations. 55 | 56 | ```json 57 | { 58 | "mcpServers": { 59 | "context7": { 60 | "command": "npx", 61 | "args": ["-y", "@upstash/context7-mcp@latest"] 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | <details> 68 | <summary>Alternative : Utiliser Bun</summary> 69 | 70 | ```json 71 | { 72 | "mcpServers": { 73 | "context7": { 74 | "command": "bunx", 75 | "args": ["-y", "@upstash/context7-mcp@latest"] 76 | } 77 | } 78 | } 79 | ``` 80 | 81 | </details> 82 | 83 | <details> 84 | <summary>Alternative : Utiliser Deno</summary> 85 | 86 | ```json 87 | { 88 | "mcpServers": { 89 | "context7": { 90 | "command": "deno", 91 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 92 | } 93 | } 94 | } 95 | ``` 96 | 97 | </details> 98 | 99 | ### Installation dans Windsurf 100 | 101 | Ajoutez ceci à votre fichier de configuration MCP Windsurf. Voir la [documentation Windsurf MCP](https://docs.windsurf.com/windsurf/mcp) pour plus d’informations. 102 | 103 | ```json 104 | { 105 | "mcpServers": { 106 | "context7": { 107 | "command": "npx", 108 | "args": ["-y", "@upstash/context7-mcp@latest"] 109 | } 110 | } 111 | } 112 | ``` 113 | 114 | ### Installation dans VS Code 115 | 116 | [<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) 117 | [<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) 118 | 119 | 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. 120 | 121 | ```json 122 | { 123 | "servers": { 124 | "Context7": { 125 | "type": "stdio", 126 | "command": "npx", 127 | "args": ["-y", "@upstash/context7-mcp@latest"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | ### Installation dans Zed 134 | 135 | Peut être installé via [Zed Extensions](https://zed.dev/extensions?query=Context7) ou en ajoutant ceci à votre `settings.json` Zed. Voir la [documentation Zed Context Server](https://zed.dev/docs/assistant/context-servers). 136 | 137 | ```json 138 | { 139 | "context_servers": { 140 | "Context7": { 141 | "command": { 142 | "path": "npx", 143 | "args": ["-y", "@upstash/context7-mcp@latest"] 144 | }, 145 | "settings": {} 146 | } 147 | } 148 | } 149 | ``` 150 | 151 | ### Installation dans Claude Code 152 | 153 | Exécutez cette commande. Voir la [documentation Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp). 154 | 155 | ```sh 156 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 157 | ``` 158 | 159 | 160 | 161 | ### Installation dans Claude Desktop 162 | 163 | Ajoutez ceci à votre fichier `claude_desktop_config.json`. Voir la [documentation Claude Desktop MCP](https://modelcontextprotocol.io/quickstart/user). 164 | 165 | ```json 166 | { 167 | "mcpServers": { 168 | "Context7": { 169 | "command": "npx", 170 | "args": ["-y", "@upstash/context7-mcp@latest"] 171 | } 172 | } 173 | } 174 | ``` 175 | 176 | ### Installation dans BoltAI 177 | 178 | Ouvrez la page "Settings" de l'application, naviguez jusqu'à "Plugins", et entrez le JSON suivant : 179 | 180 | ```json 181 | { 182 | "mcpServers": { 183 | "context7": { 184 | "command": "npx", 185 | "args": ["-y", "@upstash/context7-mcp@latest"] 186 | } 187 | } 188 | } 189 | ``` 190 | 191 | 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). 192 | 193 | ### Installation dans Copilot Coding Agent 194 | 195 | Ajoutez la configuration suivante à la section `mcp` de votre fichier de configuration Copilot Coding Agent (Repository->Settings->Copilot->Coding agent->MCP configuration) : 196 | 197 | ```json 198 | { 199 | "mcpServers": { 200 | "context7": { 201 | "type": "http", 202 | "url": "https://mcp.context7.com/mcp", 203 | "tools": [ 204 | "get-library-docs", 205 | "resolve-library-id" 206 | ] 207 | } 208 | } 209 | } 210 | ``` 211 | 212 | Pour plus d'informations, consultez la [documentation officielle GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 213 | 214 | ### Utilisation avec Docker 215 | 216 | Si vous préférez exécuter le serveur MCP dans un conteneur Docker : 217 | 218 | 1. **Construisez l’image Docker :** 219 | 220 | Créez un `Dockerfile` à la racine du projet (ou ailleurs) : 221 | 222 | <details> 223 | <summary>Voir le contenu du Dockerfile</summary> 224 | 225 | ```Dockerfile 226 | FROM node:18-alpine 227 | 228 | WORKDIR /app 229 | 230 | # Installer la dernière version en global 231 | RUN npm install -g @upstash/context7-mcp@latest 232 | 233 | # Exposer le port par défaut si besoin (optionnel) 234 | # EXPOSE 3000 235 | 236 | # Commande par défaut 237 | CMD ["context7-mcp"] 238 | ``` 239 | 240 | </details> 241 | 242 | Puis, construisez l’image : 243 | 244 | ```bash 245 | docker build -t context7-mcp . 246 | ``` 247 | 248 | 2. **Configurez votre client MCP :** 249 | 250 | Mettez à jour la configuration de votre client MCP pour utiliser la commande Docker. 251 | 252 | _Exemple pour un fichier cline_mcp_settings.json :_ 253 | 254 | ```json 255 | { 256 | "mcpServers": { 257 | "Сontext7": { 258 | "autoApprove": [], 259 | "disabled": false, 260 | "timeout": 60, 261 | "command": "docker", 262 | "args": ["run", "-i", "--rm", "context7-mcp"], 263 | "transportType": "stdio" 264 | } 265 | } 266 | } 267 | ``` 268 | 269 | _Note : Ceci est un exemple. Adaptez la structure selon votre client MCP (voir plus haut dans ce README). Assurez-vous que le nom de l’image dans `args` correspond au tag utilisé lors du build._ 270 | 271 | ### Installation sous Windows 272 | 273 | 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`. 274 | 275 | ```json 276 | { 277 | "mcpServers": { 278 | "github.com/upstash/context7-mcp": { 279 | "command": "cmd", 280 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], 281 | "disabled": false, 282 | "autoApprove": [] 283 | } 284 | } 285 | } 286 | ``` 287 | 288 | ### Variables d'environnement 289 | 290 | - `DEFAULT_MINIMUM_TOKENS`: Définissez le nombre minimum de tokens pour la récupération de documentation (par défaut: 10000). 291 | 292 | Exemples: 293 | 294 | ```json 295 | { 296 | "mcpServers": { 297 | "context7": { 298 | "command": "npx", 299 | "args": ["-y", "@upstash/context7-mcp@latest"], 300 | "env": { 301 | "DEFAULT_MINIMUM_TOKENS": "10000" 302 | } 303 | } 304 | } 305 | } 306 | ``` 307 | 308 | ### Outils disponibles 309 | 310 | - `resolve-library-id` : Résout un nom de bibliothèque général en un ID compatible Context7. 311 | - `libraryName` (obligatoire) 312 | - `get-library-docs` : Récupère la documentation d’une bibliothèque via un ID Context7. 313 | - `context7CompatibleLibraryID` (obligatoire) 314 | - `topic` (optionnel) : Focaliser la doc sur un sujet précis (ex : "routing", "hooks") 315 | - `tokens` (optionnel, par défaut 10000) : Nombre max de tokens à retourner. Les valeurs < 10000 sont automatiquement augmentées à 10000. 316 | 317 | ## Développement 318 | 319 | Clonez le projet et installez les dépendances : 320 | 321 | ```bash 322 | bun i 323 | ``` 324 | 325 | Build : 326 | 327 | ```bash 328 | bun run build 329 | ``` 330 | 331 | ### Exemple de configuration locale 332 | 333 | ```json 334 | { 335 | "mcpServers": { 336 | "context7": { 337 | "command": "npx", 338 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 339 | } 340 | } 341 | } 342 | ``` 343 | 344 | ### Tester avec MCP Inspector 345 | 346 | ```bash 347 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 348 | ``` 349 | 350 | ## Dépannage 351 | 352 | ### ERR_MODULE_NOT_FOUND 353 | 354 | Si vous voyez cette erreur, essayez d’utiliser `bunx` à la place de `npx`. 355 | 356 | ```json 357 | { 358 | "mcpServers": { 359 | "context7": { 360 | "command": "bunx", 361 | "args": ["-y", "@upstash/context7-mcp@latest"] 362 | } 363 | } 364 | } 365 | ``` 366 | 367 | Cela résout souvent les problèmes de résolution de modules, surtout si `npx` n’installe ou ne résout pas correctement les packages. 368 | 369 | ### Problèmes de résolution ESM 370 | 371 | Si vous rencontrez une erreur comme : `Error: Cannot find module 'uriTemplate.js'` essayez d'exécuter avec le drapeau `--experimental-vm-modules` : 372 | 373 | ```json 374 | { 375 | "mcpServers": { 376 | "context7": { 377 | "command": "npx", 378 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 379 | } 380 | } 381 | } 382 | ``` 383 | 384 | ### Erreurs client MCP 385 | 386 | 1. Essayez de retirer `@latest` du nom du package. 387 | 2. Essayez d'utiliser `bunx` comme alternative. 388 | 3. Essayez d'utiliser `deno` comme alternative. 389 | 4. Assurez-vous d'utiliser Node v18 ou supérieur pour avoir le support natif de fetch avec `npx`. 390 | 391 | ## Clause de non-responsabilité 392 | 393 | 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. 394 | 395 | ## Context7 dans les médias 396 | 397 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 398 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 399 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 400 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 401 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 402 | - [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 403 | - [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo) 404 | - [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM) 405 | 406 | ## Historique des stars 407 | 408 | [](https://www.star-history.com/#upstash/context7&Date) 409 | 410 | ## Licence 411 | 412 | MIT 413 | -------------------------------------------------------------------------------- /docs/README.id-ID.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Dokumentasi Ter-Update Untuk Setiap Prompt 2 | 3 | [](https://context7.com) [](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) 4 | 5 | [](./README.zh-CN.md) [](./README.ko.md) [](./README.es.md) [](./README.fr.md) [-purple>)](./README.pt-BR.md) [](./README.id-ID.md) 6 | 7 | ## ❌ Tanpa Context7 8 | 9 | LLM mengandalkan informasi yang sudah lama atau umum tentang library yang Anda gunakan, bukan yang terbaru. 10 | 11 | Hasilnya anda akan mendapatkan: 12 | 13 | - ❌ Contoh kode sudah usang dan berdasarkan data pelatihan yang sudah lama 14 | - ❌ API yang dikarang yang sebetulnya tidak ada sama sekali 15 | - ❌ Jawaban umum untuk versi paket lama 16 | 17 | ## ✅ Dengan Context7 18 | 19 | Context7 MCP mengambil dokumentasi dan contoh kode terkini, spesifik versi langsung dari sumbernya — dan menempatkannya langsung ke dalam prompt Anda. 20 | 21 | Tambahkan `gunakan context7` ke prompt Anda di Cursor: 22 | 23 | ```txt 24 | Buat proyek Next.js dasar dengan app router. gunakan context7 25 | ``` 26 | 27 | ```txt 28 | Buat skrip untuk menghapus baris di mana kota adalah "" berdasarkan kredensial PostgreSQL. gunakan context7 29 | ``` 30 | 31 | Context7 mengambil contoh kode dan dokumentasi terkini langsung ke dalam konteks LLM Anda. 32 | 33 | - 1️⃣ Tulis prompt Anda secara natural 34 | - 2️⃣ Beri tahu LLM untuk `use context7` 35 | - 3️⃣ Dapatkan jawaban dengan kode yang berfungsi 36 | 37 | Tidak perlu beralih tab, tidak ada API yang dikarang yang sebetulnya tidak ada sama sekali, tidak akan menghasilkan kode yang usang. 38 | 39 | ## 🛠️ Memulai 40 | 41 | ### Persyaratan 42 | 43 | - Node.js >= v18.0.0 44 | - Cursor, Windsurf, Claude Desktop atau MCP Client lainnya 45 | 46 | ### Instalasi melalui Smithery 47 | 48 | Untuk menginstal Context7 MCP Server untuk Claude Desktop secara otomatis melalui [Smithery](https://smithery.ai/server/@upstash/context7-mcp): 49 | 50 | ```bash 51 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 52 | ``` 53 | 54 | ### Instalasi di Cursor 55 | 56 | Buka: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 57 | 58 | Tambahkan konfigurasi berikut ke dalam file Cursor `~/.cursor/mcp.json` Anda adalah pendekatan yang direkomendasikan. Lihat [Dokumentasi Cursor MCP](https://docs.cursor.com/context/model-context-protocol) untuk informasi lebih lanjut. 59 | 60 | ```json 61 | { 62 | "mcpServers": { 63 | "context7": { 64 | "command": "npx", 65 | "args": ["-y", "@upstash/context7-mcp@latest"] 66 | } 67 | } 68 | } 69 | ``` 70 | 71 | <details> 72 | <summary>Alternatif: Menggunakan Bun</summary> 73 | 74 | ```json 75 | { 76 | "mcpServers": { 77 | "context7": { 78 | "command": "bunx", 79 | "args": ["-y", "@upstash/context7-mcp@latest"] 80 | } 81 | } 82 | } 83 | ``` 84 | 85 | </details> 86 | 87 | <details> 88 | <summary>Alternatif: Menggunakan Deno</summary> 89 | 90 | ```json 91 | { 92 | "mcpServers": { 93 | "context7": { 94 | "command": "deno", 95 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 96 | } 97 | } 98 | } 99 | ``` 100 | 101 | </details> 102 | 103 | ### Instalasi di Windsurf 104 | 105 | Tambahkan ini ke file konfigurasi MCP Windsurf Anda. Lihat [Dokumentasi Windsurf MCP](https://docs.windsurf.com/windsurf/mcp) untuk informasi lebih lanjut. 106 | 107 | ```json 108 | { 109 | "mcpServers": { 110 | "context7": { 111 | "command": "npx", 112 | "args": ["-y", "@upstash/context7-mcp@latest"] 113 | } 114 | } 115 | } 116 | ``` 117 | 118 | ### Instalasi di VS Code 119 | 120 | [<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) 121 | [<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) 122 | 123 | Tambahkan ini ke file konfigurasi MCP VS Code Anda. Lihat [Dokumentasi VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) untuk informasi lebih lanjut. 124 | 125 | ```json 126 | { 127 | "servers": { 128 | "Context7": { 129 | "type": "stdio", 130 | "command": "npx", 131 | "args": ["-y", "@upstash/context7-mcp@latest"] 132 | } 133 | } 134 | } 135 | ``` 136 | 137 | ### Instalasi di Zed 138 | 139 | Dapat diinstal melalui [Ekstensi Zed](https://zed.dev/extensions?query=Context7) atau Anda dapat menambahkan ini ke `settings.json` Zed Anda. Lihat [Dokumentasi Zed Context Server](https://zed.dev/docs/assistant/context-servers) untuk informasi lebih lanjut. 140 | 141 | ```json 142 | { 143 | "context_servers": { 144 | "Context7": { 145 | "command": { 146 | "path": "npx", 147 | "args": ["-y", "@upstash/context7-mcp@latest"] 148 | }, 149 | "settings": {} 150 | } 151 | } 152 | } 153 | ``` 154 | 155 | ### Instalasi di Claude Code 156 | 157 | Jalankan perintah ini. Lihat [Dokumentasi Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) untuk informasi lebih lanjut. 158 | 159 | ```sh 160 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 161 | ``` 162 | 163 | ### Instalasi di Claude Desktop 164 | 165 | Tambahkan ini ke file `claude_desktop_config.json` Claude Desktop Anda. Lihat [Dokumentasi Claude Desktop MCP](https://modelcontextprotocol.io/quickstart/user) untuk informasi lebih lanjut. 166 | 167 | ```json 168 | { 169 | "mcpServers": { 170 | "Context7": { 171 | "command": "npx", 172 | "args": ["-y", "@upstash/context7-mcp@latest"] 173 | } 174 | } 175 | } 176 | ``` 177 | 178 | ### Instalasi di Copilot Coding Agent 179 | 180 | Tambahkan konfigurasi berikut ke bagian `mcp` pada file konfigurasi Copilot Coding Agent Anda (Repository->Settings->Copilot->Coding agent->MCP configuration): 181 | 182 | ```json 183 | { 184 | "mcpServers": { 185 | "context7": { 186 | "type": "http", 187 | "url": "https://mcp.context7.com/mcp", 188 | "tools": [ 189 | "get-library-docs", 190 | "resolve-library-id" 191 | ] 192 | } 193 | } 194 | } 195 | ``` 196 | 197 | Untuk informasi lebih lanjut, lihat [dokumentasi resmi GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 198 | 199 | ### Menggunakan Docker 200 | 201 | Jika Anda lebih suka menjalankan server MCP dalam kontainer Docker: 202 | 203 | 1. **Membuat Image Docker:** 204 | 205 | Pertama, buat `Dockerfile` di root proyek (atau di mana pun Anda suka): 206 | 207 | <details> 208 | <summary>Klik untuk melihat konten Dockerfile</summary> 209 | 210 | ```Dockerfile 211 | FROM node:18-alpine 212 | 213 | WORKDIR /app 214 | 215 | # Instal versi terbaru secara global 216 | RUN npm install -g @upstash/context7-mcp@latest 217 | 218 | # Ekspos port default jika diperlukan (opsional, tergantung pada interaksi klien MCP) 219 | # EXPOSE 3000 220 | 221 | # Perintah default untuk menjalankan server 222 | CMD ["context7-mcp"] 223 | ``` 224 | 225 | </details> 226 | 227 | Kemudian, buat image menggunakan tag (misalnya, `context7-mcp`). **Pastikan Docker Desktop (atau daemon Docker) sedang berjalan.** Jalankan perintah berikut di direktori yang sama di mana Anda menyimpan `Dockerfile`: 228 | 229 | ```bash 230 | docker build -t context7-mcp . 231 | ``` 232 | 233 | 2. **Konfigurasi MCP Client Anda:** 234 | 235 | Perbarui konfigurasi MCP client Anda untuk menggunakan perintah Docker. 236 | 237 | _Contoh untuk cline_mcp_settings.json:_ 238 | 239 | ```json 240 | { 241 | "mcpServers": { 242 | "Сontext7": { 243 | "autoApprove": [], 244 | "disabled": false, 245 | "timeout": 60, 246 | "command": "docker", 247 | "args": ["run", "-i", "--rm", "context7-mcp"], 248 | "transportType": "stdio" 249 | } 250 | } 251 | } 252 | ``` 253 | 254 | _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`._ 255 | 256 | ### Alat yang Tersedia 257 | 258 | - `resolve-library-id`: Menyelesaikan nama library umum menjadi ID library yang kompatibel dengan Context7. 259 | - `libraryName` (wajib) 260 | - `get-library-docs`: Mengambil dokumentasi untuk library menggunakan ID library yang kompatibel dengan Context7. 261 | - `context7CompatibleLibraryID` (wajib) 262 | - `topic` (opsional): Fokuskan dokumentasi pada topik tertentu (misalnya, "routing", "hooks") 263 | - `tokens` (opsional, default 10000): Jumlah maksimum token yang akan dihasilkan. Nilai kurang dari 10000 secara otomatis ditingkatkan menjadi 10000. 264 | 265 | ## Pengembangan 266 | 267 | Kloning proyek dan instal dependensi: 268 | 269 | ```bash 270 | bun i 271 | ``` 272 | 273 | Build: 274 | 275 | ```bash 276 | bun run build 277 | ``` 278 | 279 | ### Contoh Konfigurasi Lokal 280 | 281 | ```json 282 | { 283 | "mcpServers": { 284 | "context7": { 285 | "command": "npx", 286 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 287 | } 288 | } 289 | } 290 | ``` 291 | 292 | ### Pengujian dengan MCP Inspector 293 | 294 | ```bash 295 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 296 | ``` 297 | 298 | ## Pemecahan Masalah 299 | 300 | ### ERR_MODULE_NOT_FOUND 301 | 302 | Jika Anda melihat kesalahan ini, coba gunakan `bunx` sebagai pengganti `npx`. 303 | 304 | ```json 305 | { 306 | "mcpServers": { 307 | "context7": { 308 | "command": "bunx", 309 | "args": ["-y", "@upstash/context7-mcp@latest"] 310 | } 311 | } 312 | } 313 | ``` 314 | 315 | Ini sering menyelesaikan masalah resolusi modul, terutama di lingkungan di mana `npx` tidak menginstal atau menyelesaikan paket dengan benar. 316 | 317 | ### Masalah Resolusi ESM 318 | 319 | Jika Anda mengalami kesalahan seperti: `Error: Cannot find module 'uriTemplate.js'` coba jalankan dengan flag `--experimental-vm-modules`: 320 | 321 | ```json 322 | { 323 | "mcpServers": { 324 | "context7": { 325 | "command": "npx", 326 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 327 | } 328 | } 329 | } 330 | ``` 331 | 332 | ### Kesalahan MCP Client 333 | 334 | 1. Coba hapus `@latest` dari nama paket. 335 | 336 | 2. Coba gunakan `bunx` sebagai alternatif. 337 | 338 | 3. Coba gunakan `deno` sebagai alternatif. 339 | 340 | 4. Pastikan Anda menggunakan Node v18 atau lebih tinggi untuk memiliki dukungan fetch native dengan `npx`. 341 | 342 | ## Disclaimer 343 | 344 | 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. 345 | 346 | ## Context7 Di Media 347 | 348 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 349 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 350 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 351 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 352 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 353 | - [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 354 | 355 | ## Grafik Riwayat Bintang 356 | 357 | [](https://www.star-history.com/#upstash/context7&Date) 358 | 359 | ## Lisensi 360 | 361 | MIT 362 | -------------------------------------------------------------------------------- /docs/README.it.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Documentazione aggiornata per qualsiasi prompt 2 | 3 | [](https://context7.com) [](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) 4 | 5 | [](./docs/README.zh-CN.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) [-purple>)](./docs/README.pt-BR.md) [](./docs/README.it.md) 6 | 7 | ## ❌ Senza Context7 8 | 9 | LLMs si affidano a informazioni obsolete o generiche sulle librerie che utilizzi. Ottieni: 10 | 11 | - ❌ Gli esempi di codice sono obsoleti e basati su dati di formazione vecchi di anni 12 | - ❌ Le API allucinate non esistono nemmeno 13 | - ❌ Risposte generiche per vecchie versioni del pacchetto 14 | 15 | ## ✅ Con Context7 16 | 17 | Context7 MCP recupera documentazione aggiornata, specifica per versione e esempi di codice direttamente dalla fonte — e li inserisce direttamente nel tuo prompt. 18 | 19 | Aggiungi `use context7` al prompt in Cursor: 20 | 21 | ```txt 22 | Crea un progetto Next.js di base con app router. Usa context7 23 | ``` 24 | 25 | ```txt 26 | Creare uno script per eliminare le righe in cui la città è "", date le credenziali di PostgreSQL. usare context7 27 | ``` 28 | 29 | Context7 recupera esempi di codice e documentazione aggiornati direttamente nel contesto del tuo LLM. 30 | 31 | - 1️⃣ Scrivi il tuo prompt in modo naturale 32 | - 2️⃣ Indica all'LLM di usare context7 33 | - 3️⃣ Ottieni risposte di codice funzionante 34 | 35 | Nessun cambio di tab, nessuna API allucinata che non esiste, nessuna generazione di codice obsoleta. 36 | 37 | ## 🛠️ Iniziare 38 | 39 | ### Requisiti 40 | 41 | - Node.js >= v18.0.0 42 | - Cursor, Windsurf, Claude Desktop o un altro client MCP 43 | 44 | ### Installazione tramite Smithery 45 | 46 | Per installare Context7 MCP Server per Claude Desktop automaticamente tramite [Smithery](https://smithery.ai/server/@upstash/context7-mcp): 47 | 48 | ```bash 49 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 50 | ``` 51 | 52 | ### Installare in Cursor 53 | 54 | Vai a: `Impostazioni` -> `Impostazioni cursore` -> `MCP` -> `Aggiungi nuovo server MCP globale` 55 | 56 | Incollare la seguente configurazione nel file `~/.cursor/mcp.json` di Cursor è l'approccio consigliato. Vedi [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) per ulteriori informazioni. 57 | 58 | ```json 59 | { 60 | "mcpServers": { 61 | "context7": { 62 | "command": "npx", 63 | "args": ["-y", "@upstash/context7-mcp@latest"] 64 | } 65 | } 66 | } 67 | ``` 68 | 69 | <details> 70 | <summary>Alternativa: Usa Bun</summary> 71 | 72 | ```json 73 | { 74 | "mcpServers": { 75 | "context7": { 76 | "command": "bunx", 77 | "args": ["-y", "@upstash/context7-mcp@latest"] 78 | } 79 | } 80 | } 81 | ``` 82 | 83 | </details> 84 | 85 | <details> 86 | <summary>Alternativa: Usa Deno</summary> 87 | 88 | ```json 89 | { 90 | "mcpServers": { 91 | "context7": { 92 | "command": "deno", 93 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 94 | } 95 | } 96 | } 97 | ``` 98 | 99 | </details> 100 | 101 | ### Installare in Windsurf 102 | 103 | Aggiungi questo al tuo file di configurazione Windsurf MCP. Vedi [Windsurf MCP docs](https://docs.windsurf.com/windsurf/mcp) per ulteriori informazioni. 104 | 105 | ```json 106 | { 107 | "mcpServers": { 108 | "context7": { 109 | "command": "npx", 110 | "args": ["-y", "@upstash/context7-mcp@latest"] 111 | } 112 | } 113 | } 114 | ``` 115 | 116 | ### Installare in VS Code 117 | 118 | [<img alt="Installa 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) 119 | [<img alt="Installa in VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Installa%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) 120 | 121 | Aggiungi questo al tuo file di configurazione MCP di VS Code. Vedi [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) per ulteriori informazioni. 122 | 123 | ```json 124 | { 125 | "servers": { 126 | "Context7": { 127 | "type": "stdio", 128 | "command": "npx", 129 | "args": ["-y", "@upstash/context7-mcp@latest"] 130 | } 131 | } 132 | } 133 | ``` 134 | 135 | ### Installare in Zed 136 | 137 | Può essere installato tramite [Zed Extensions](https://zed.dev/extensions?query=Context7) oppure puoi aggiungere questo al tuo `settings.json` di Zed. Vedi [Zed Context Server docs](https://zed.dev/docs/assistant/context-servers) per ulteriori informazioni. 138 | 139 | ```json 140 | { 141 | "context_servers": { 142 | "Context7": { 143 | "command": { 144 | "path": "npx", 145 | "args": ["-y", "@upstash/context7-mcp@latest"] 146 | }, 147 | "settings": {} 148 | } 149 | } 150 | } 151 | ``` 152 | 153 | ### Installare in Claude Code 154 | 155 | Esegui questo comando. Vedi [Claude Code MCP docs](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) per ulteriori informazioni. 156 | 157 | ```sh 158 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 159 | ``` 160 | 161 | ### Installare in Claude Desktop 162 | 163 | Aggiungi questo al tuo file `claude_desktop_config.json` di Claude Desktop. Vedi [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user) per ulteriori informazioni. 164 | 165 | ```json 166 | { 167 | "mcpServers": { 168 | "Context7": { 169 | "command": "npx", 170 | "args": ["-y", "@upstash/context7-mcp@latest"] 171 | } 172 | } 173 | } 174 | ``` 175 | 176 | ### Installazione in Copilot Coding Agent 177 | 178 | Aggiungi la seguente configurazione alla sezione `mcp` del file di configurazione di Copilot Coding Agent (Repository->Settings->Copilot->Coding agent->MCP configuration): 179 | 180 | ```json 181 | { 182 | "mcpServers": { 183 | "context7": { 184 | "type": "http", 185 | "url": "https://mcp.context7.com/mcp", 186 | "tools": [ 187 | "get-library-docs", 188 | "resolve-library-id" 189 | ] 190 | } 191 | } 192 | } 193 | ``` 194 | 195 | Per maggiori informazioni, consulta la [documentazione ufficiale GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 196 | 197 | ### Utilizzo di Docker 198 | 199 | Se preferisci eseguire il server MCP in un contenitore Docker: 200 | 201 | 1. **Costruisci l'immagine Docker:** 202 | 203 | Prima, crea un `Dockerfile` nella radice del progetto (o ovunque tu preferisca): 204 | 205 | <details> 206 | <summary>Clicca per visualizzare il contenuto del Dockerfile</summary> 207 | 208 | ```Dockerfile 209 | FROM node:18-alpine 210 | 211 | WORKDIR /app 212 | 213 | # Installa l ultima versione globalmente 214 | RUN npm install -g @upstash/context7-mcp@latest 215 | 216 | # Esponi la porta predefinita se necessario (opzionale, dipende dall interazione del client MCP) 217 | # EXPOSE 3000 218 | 219 | # Comando predefinito per eseguire il server 220 | CMD ["context7-mcp"] 221 | ``` 222 | 223 | </details> 224 | 225 | Poi, costruisci l'immagine utilizzando un tag (ad esempio, `context7-mcp`). **Assicurati che Docker Desktop (o il demone Docker) sia in esecuzione.** Esegui il seguente comando nella stessa directory in cui hai salvato il `Dockerfile`: 226 | 227 | ```bash 228 | docker build -t context7-mcp . 229 | ``` 230 | 231 | 2. **Configura il tuo client MCP:** 232 | 233 | Aggiorna la configurazione del tuo client MCP per utilizzare il comando Docker. 234 | 235 | _Esempio per un file cline_mcp_settings.json:_ 236 | 237 | ```json 238 | { 239 | "mcpServers": { 240 | "Сontext7": { 241 | "autoApprove": [], 242 | "disabled": false, 243 | "timeout": 60, 244 | "command": "docker", 245 | "args": ["run", "-i", "--rm", "context7-mcp"], 246 | "transportType": "stdio" 247 | } 248 | } 249 | } 250 | ``` 251 | 252 | _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`._ 253 | 254 | ### Strumenti Disponibili 255 | 256 | - `resolve-library-id`: Converte un nome generico di libreria in un ID di libreria compatibile con Context7. 257 | - `libraryName` (obbligatorio) 258 | - `get-library-docs`: Recupera la documentazione per una libreria utilizzando un ID di libreria compatibile con Context7. 259 | - `context7CompatibleLibraryID` (obbligatorio) 260 | - `topic` (opzionale): Concentra la documentazione su un argomento specifico (es., "routing", "hooks") 261 | - `tokens` (opzionale, predefinito 10000): Numero massimo di token da restituire. I valori inferiori a 10000 vengono automaticamente aumentati a 10000. 262 | 263 | ## Sviluppo 264 | 265 | Clona il progetto e installa le dipendenze: 266 | 267 | ```bash 268 | bun i 269 | ``` 270 | 271 | Compila: 272 | 273 | ```bash 274 | bun run build 275 | ``` 276 | 277 | ### Esempio di Configurazione Locale 278 | 279 | ```json 280 | { 281 | "mcpServers": { 282 | "context7": { 283 | "command": "npx", 284 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 285 | } 286 | } 287 | } 288 | ``` 289 | 290 | ### Test con MCP Inspector 291 | 292 | ```bash 293 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 294 | ``` 295 | 296 | ## Risoluzione dei problemi 297 | 298 | ### ERR_MODULE_NOT_FOUND 299 | 300 | Se vedi questo errore, prova a usare `bunx` invece di `npx`. 301 | 302 | ```json 303 | { 304 | "mcpServers": { 305 | "context7": { 306 | "command": "bunx", 307 | "args": ["-y", "@upstash/context7-mcp@latest"] 308 | } 309 | } 310 | } 311 | ``` 312 | 313 | Questo spesso risolve i problemi di risoluzione dei moduli, specialmente negli ambienti dove `npx` non installa o risolve correttamente i pacchetti. 314 | 315 | ### Problemi di risoluzione ESM 316 | 317 | Se riscontri un errore come: `Error: Cannot find module 'uriTemplate.js'` prova a eseguire con il flag `--experimental-vm-modules`: 318 | 319 | ```json 320 | { 321 | "mcpServers": { 322 | "context7": { 323 | "command": "npx", 324 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 325 | } 326 | } 327 | } 328 | ``` 329 | 330 | ### Errori del Client MCP 331 | 332 | 1. Prova a rimuovere `@latest` dal nome del pacchetto. 333 | 334 | 2. Prova a usare `bunx` come alternativa. 335 | 336 | 3. Prova a usare `deno` come alternativa. 337 | 338 | 4. Assicurati di utilizzare Node v18 o superiore per avere il supporto nativo di fetch con `npx`. 339 | 340 | ## Dichiarazione di non responsabilità 341 | 342 | 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. 343 | 344 | ## Context7 nei Media 345 | 346 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 347 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 348 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 349 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 350 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 351 | - [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 352 | 353 | ## Storico delle Stelle 354 | 355 | [](https://www.star-history.com/#upstash/context7&Date) 356 | 357 | ## Licenza 358 | 359 | MIT 360 | -------------------------------------------------------------------------------- /docs/README.ja.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - どんなプロンプトにも最新のコードドキュメントで応える 2 | 3 | [](https://context7.com) [](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) 4 | 5 | [](./docs/README.zh-TW.md) [](./docs/README.zh-CN.md) [](./docs/README.ja.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) [-purple>)](./docs/README.pt-BR.md) [](./docs/README.it.md) [](./docs/README.id-ID.md) [](./docs/README.de.md) [](./docs/README.ru.md) [](./docs/README.tr.md) [](./docs/README.ar.md) 6 | 7 | ## ❌ Context7 を使わないと 8 | 9 | LLM は使用しているライブラリに関する古い情報や一般的な情報に依存しています。その結果: 10 | 11 | - ❌ コード例が古く、1 年前のトレーニングデータに基づいている 12 | - ❌ 存在しない API をハルシネーションして生成する 13 | - ❌ 古いパッケージバージョンに対する一般的な回答しか得られない 14 | 15 | ## ✅ Context7 を使うと 16 | 17 | Context7 MCP は最新のバージョン固有のドキュメントとコード例をソースから直接取得し、プロンプトに直接配置します。 18 | 19 | Cursor のプロンプトに `use context7` を追加するだけ: 20 | 21 | ```txt 22 | Create a basic Next.js project with app router. use context7 23 | ``` 24 | 25 | ```txt 26 | Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7 27 | ``` 28 | 29 | Context7 は最新のコード例とドキュメントを直接 LLM のコンテキストに取得します。 30 | 31 | - 1️⃣ 普段通りにプロンプトを書く 32 | - 2️⃣ LLM に `use context7` と指示する 33 | - 3️⃣ 動作するコードの回答を得る 34 | 35 | タブの切り替えも、存在しない API のハルシネーションも、古いコード生成もありません。 36 | 37 | ## 📚 プロジェクトの追加 38 | 39 | [プロジェクト追加ガイド](./adding-projects.md) をチェックして、お気に入りのライブラリを Context7 に追加(または更新)する方法を学びましょう。 40 | 41 | ## 🛠️ インストール 42 | 43 | ### 必須要件 44 | 45 | - Node.js >= v18.0.0 46 | - Cursor、Windsurf、Claude Desktop またはその他の MCP クライアント 47 | 48 | <details> 49 | <summary><b>Smithery 経由でのインストール</b></summary> 50 | 51 | [Smithery](https://smithery.ai/server/@upstash/context7-mcp) 経由で任意のクライアントに Context7 MCP サーバーを自動的にインストールするには: 52 | 53 | ```bash 54 | npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY> 55 | ``` 56 | 57 | Smithery キーは [Smithery.ai Web ページ](https://smithery.ai/server/@upstash/context7-mcp) で確認できます。 58 | 59 | </details> 60 | 61 | <details> 62 | <summary><b>Cursor へのインストール</b></summary> 63 | 64 | `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` に移動します 65 | 66 | 以下の設定を Cursor の `~/.cursor/mcp.json` ファイルに貼り付けることが推奨されます。プロジェクトフォルダに `.cursor/mcp.json` を作成することで、特定のプロジェクトにインストールすることもできます。詳細は [Cursor MCP ドキュメント](https://docs.cursor.com/context/model-context-protocol) を参照してください。 67 | 68 | > Cursor 1.0 以降、下のインストールボタンをクリックすることで、ワンクリックで即座にインストールできます。 69 | 70 | #### Cursor リモートサーバー接続 71 | 72 | [](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D) 73 | 74 | ```json 75 | { 76 | "mcpServers": { 77 | "context7": { 78 | "url": "https://mcp.context7.com/mcp" 79 | } 80 | } 81 | } 82 | ``` 83 | 84 | #### Cursor ローカルサーバー接続 85 | 86 | [](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9) 87 | 88 | ```json 89 | { 90 | "mcpServers": { 91 | "context7": { 92 | "command": "npx", 93 | "args": ["-y", "@upstash/context7-mcp"] 94 | } 95 | } 96 | } 97 | ``` 98 | 99 | <details> 100 | <summary>代替方法:Bun を使用</summary> 101 | 102 | [](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D) 103 | 104 | ```json 105 | { 106 | "mcpServers": { 107 | "context7": { 108 | "command": "bunx", 109 | "args": ["-y", "@upstash/context7-mcp"] 110 | } 111 | } 112 | } 113 | ``` 114 | 115 | </details> 116 | 117 | <details> 118 | <summary>代替方法:Deno を使用</summary> 119 | 120 | [](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9) 121 | 122 | ```json 123 | { 124 | "mcpServers": { 125 | "context7": { 126 | "command": "deno", 127 | "args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | </details> 134 | 135 | </details> 136 | 137 | <details> 138 | <summary><b>Windsurf へのインストール</b></summary> 139 | 140 | これを Windsurf MCP 設定ファイルに追加します。詳細は [Windsurf MCP ドキュメント](https://docs.windsurf.com/windsurf/mcp) を参照してください。 141 | 142 | #### Windsurf リモートサーバー接続 143 | 144 | ```json 145 | { 146 | "mcpServers": { 147 | "context7": { 148 | "serverUrl": "https://mcp.context7.com/sse" 149 | } 150 | } 151 | } 152 | ``` 153 | 154 | #### Windsurf ローカルサーバー接続 155 | 156 | ```json 157 | { 158 | "mcpServers": { 159 | "context7": { 160 | "command": "npx", 161 | "args": ["-y", "@upstash/context7-mcp"] 162 | } 163 | } 164 | } 165 | ``` 166 | 167 | </details> 168 | 169 | <details> 170 | <summary><b>VS Code へのインストール</b></summary> 171 | 172 | [<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) 173 | [<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) 174 | 175 | これを VS Code MCP 設定ファイルに追加します。詳細は [VS Code MCP ドキュメント](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) を参照してください。 176 | 177 | #### VS Code リモートサーバー接続 178 | 179 | ```json 180 | "mcp": { 181 | "servers": { 182 | "context7": { 183 | "type": "http", 184 | "url": "https://mcp.context7.com/mcp" 185 | } 186 | } 187 | } 188 | ``` 189 | 190 | #### VS Code ローカルサーバー接続 191 | 192 | ```json 193 | "mcp": { 194 | "servers": { 195 | "context7": { 196 | "type": "stdio", 197 | "command": "npx", 198 | "args": ["-y", "@upstash/context7-mcp"] 199 | } 200 | } 201 | } 202 | ``` 203 | 204 | </details> 205 | 206 | <details> 207 | <summary><b>Visual Studio 2022 へのインストール</b></summary> 208 | 209 | [Visual Studio MCP サーバードキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) に従って、Visual Studio 2022 で Context7 MCP を設定できます。 210 | 211 | これを Visual Studio MCP 設定ファイルに追加します(詳細は [Visual Studio ドキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) を参照): 212 | 213 | ```json 214 | { 215 | "mcp": { 216 | "servers": { 217 | "context7": { 218 | "type": "http", 219 | "url": "https://mcp.context7.com/mcp" 220 | } 221 | } 222 | } 223 | } 224 | ``` 225 | 226 | または、ローカルサーバーの場合: 227 | 228 | ```json 229 | { 230 | "mcp": { 231 | "servers": { 232 | "context7": { 233 | "type": "stdio", 234 | "command": "npx", 235 | "args": ["-y", "@upstash/context7-mcp"] 236 | } 237 | } 238 | } 239 | } 240 | ``` 241 | 242 | 詳細情報とトラブルシューティングについては、[Visual Studio MCP サーバードキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) を参照してください。 243 | </details> 244 | 245 | <details> 246 | <summary><b>Zed へのインストール</b></summary> 247 | 248 | [Zed Extensions](https://zed.dev/extensions?query=Context7) 経由でインストールできるか、Zed の `settings.json` にこれを追加できます。詳細は [Zed Context Server ドキュメント](https://zed.dev/docs/assistant/context-servers) を参照してください。 249 | 250 | ```json 251 | { 252 | "context_servers": { 253 | "Context7": { 254 | "command": { 255 | "path": "npx", 256 | "args": ["-y", "@upstash/context7-mcp"] 257 | }, 258 | "settings": {} 259 | } 260 | } 261 | } 262 | ``` 263 | 264 | </details> 265 | 266 | <details> 267 | <summary><b>Claude Code へのインストール</b></summary> 268 | 269 | このコマンドを実行します。詳細は [Claude Code MCP ドキュメント](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) を参照してください。 270 | 271 | #### Claude Code リモートサーバー接続 272 | 273 | ```sh 274 | claude mcp add --transport sse context7 https://mcp.context7.com/sse 275 | ``` 276 | 277 | #### Claude Code ローカルサーバー接続 278 | 279 | ```sh 280 | claude mcp add context7 -- npx -y @upstash/context7-mcp 281 | ``` 282 | 283 | </details> 284 | 285 | <details> 286 | <summary><b>Claude Desktop へのインストール</b></summary> 287 | 288 | これを Claude Desktop の `claude_desktop_config.json` ファイルに追加します。詳細は [Claude Desktop MCP ドキュメント](https://modelcontextprotocol.io/quickstart/user) を参照してください。 289 | 290 | ```json 291 | { 292 | "mcpServers": { 293 | "Context7": { 294 | "command": "npx", 295 | "args": ["-y", "@upstash/context7-mcp"] 296 | } 297 | } 298 | } 299 | ``` 300 | 301 | </details> 302 | 303 | <details> 304 | <summary><b>BoltAI へのインストール</b></summary> 305 | 306 | アプリの "Settings" ページを開き、"Plugins" に移動し、以下の JSON を入力します: 307 | 308 | ```json 309 | { 310 | "mcpServers": { 311 | "context7": { 312 | "command": "npx", 313 | "args": ["-y", "@upstash/context7-mcp"] 314 | } 315 | } 316 | } 317 | ``` 318 | 319 | 保存後、チャットで `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)。 320 | 321 | </details> 322 | 323 | <details> 324 | <summary><b>Copilot Coding Agent へのインストール</b></summary> 325 | 326 | 以下の設定を Copilot Coding Agent の `mcp` セクション(Repository->Settings->Copilot->Coding agent->MCP configuration)に追加してください: 327 | 328 | ```json 329 | { 330 | "mcpServers": { 331 | "context7": { 332 | "type": "http", 333 | "url": "https://mcp.context7.com/mcp", 334 | "tools": [ 335 | "get-library-docs", 336 | "resolve-library-id" 337 | ] 338 | } 339 | } 340 | } 341 | ``` 342 | 343 | 詳細は [公式 GitHub ドキュメント](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp) をご覧ください。 344 | 345 | </details> 346 | 347 | <details> 348 | <summary><b>Docker を使用</b></summary> 349 | 350 | MCP サーバーを Docker コンテナで実行したい場合: 351 | 352 | 1. **Docker イメージのビルド:** 353 | 354 | まず、プロジェクトルート(または希望の場所)に `Dockerfile` を作成します: 355 | 356 | <details> 357 | <summary>Dockerfile の内容を表示</summary> 358 | 359 | ```Dockerfile 360 | FROM node:18-alpine 361 | 362 | WORKDIR /app 363 | 364 | # 最新バージョンをグローバルにインストール 365 | RUN npm install -g @upstash/context7-mcp 366 | 367 | # 必要に応じてデフォルトポートを公開(任意、MCP クライアントの相互作用に依存) 368 | # EXPOSE 3000 369 | 370 | # サーバーを実行するデフォルトコマンド 371 | CMD ["context7-mcp"] 372 | ``` 373 | 374 | </details> 375 | 376 | 次に、タグ(例:`context7-mcp`)を使用してイメージをビルドします。**Docker Desktop(または Docker デーモン)が実行中であることを確認してください。** `Dockerfile` を保存した同じディレクトリで次のコマンドを実行します: 377 | 378 | ```bash 379 | docker build -t context7-mcp . 380 | ``` 381 | 382 | 2. **MCP クライアントの設定:** 383 | 384 | MCP クライアントの設定を更新して Docker コマンドを使用するようにします。 385 | 386 | _cline_mcp_settings.json の例:_ 387 | 388 | ```json 389 | { 390 | "mcpServers": { 391 | "Сontext7": { 392 | "autoApprove": [], 393 | "disabled": false, 394 | "timeout": 60, 395 | "command": "docker", 396 | "args": ["run", "-i", "--rm", "context7-mcp"], 397 | "transportType": "stdio" 398 | } 399 | } 400 | } 401 | ``` 402 | 403 | _注:これは設定例です。この README の前半で MCP クライアント(Cursor、VS Code など)の具体的な例を参照して、構造(例:`mcpServers` 対 `servers`)を適応させてください。また、`args` 内のイメージ名が `docker build` コマンドで使用したタグと一致していることを確認してください。_ 404 | 405 | </details> 406 | 407 | <details> 408 | <summary><b>Windows へのインストール</b></summary> 409 | 410 | Windows での設定は Linux や macOS と比べて少し異なります(_例では `Cline` を使用_)。同じ原則が他のエディタにも適用されます。`command` と `args` の設定を参照してください。 411 | 412 | ```json 413 | { 414 | "mcpServers": { 415 | "github.com/upstash/context7-mcp": { 416 | "command": "cmd", 417 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], 418 | "disabled": false, 419 | "autoApprove": [] 420 | } 421 | } 422 | } 423 | ``` 424 | 425 | </details> 426 | 427 | <details> 428 | <summary><b>Augment Code へのインストール</b></summary> 429 | 430 | Augment Code で Context7 MCP を設定するには、グラフィカルインターフェースまたは手動設定のいずれかを使用できます。 431 | 432 | ### **A. Augment Code UI を使用する場合** 433 | 434 | 1. ハンバーガーメニューをクリックします。 435 | 2. **Settings** を選択します。 436 | 3. **Tools** セクションに移動します。 437 | 4. **+ Add MCP** ボタンをクリックします。 438 | 5. 以下のコマンドを入力します: 439 | 440 | ``` 441 | npx -y @upstash/context7-mcp@latest 442 | ``` 443 | 444 | 6. MCP に **Context7** と名前を付けます。 445 | 7. **Add** ボタンをクリックします。 446 | 447 | MCP サーバーが追加されたら、Augment Code 内で Context7 の最新コードドキュメンテーション機能を直接使用できます。 448 | 449 | --- 450 | 451 | ### **B. 手動設定** 452 | 453 | 1. Cmd/Ctrl Shift P を押すか、Augment パネルのハンバーガーメニューに移動します 454 | 2. Edit Settings を選択します 455 | 3. Advanced の下で、Edit in settings.json をクリックします 456 | 4. `augment.advanced` オブジェクト内の `mcpServers` 配列にサーバー設定を追加します 457 | 458 | "augment.advanced": { 459 | "mcpServers": [ 460 | { 461 | "name": "context7", 462 | "command": "npx", 463 | "args": ["-y", "@upstash/context7-mcp"] 464 | } 465 | ] 466 | } 467 | 468 | MCP サーバーが追加されたら、エディタを再起動します。エラーが発生した場合は、構文をチェックして、閉じ括弧やカンマが欠けていないことを確認してください。 469 | 470 | </details> 471 | 472 | <details> 473 | <summary><b>Roo Code へのインストール</b></summary> 474 | 475 | これを Roo Code MCP 設定ファイルに追加します。詳細は [Roo Code MCP ドキュメント](https://docs.roocode.com/features/mcp/using-mcp-in-roo) を参照してください。 476 | 477 | #### Roo Code リモートサーバー接続 478 | 479 | ```json 480 | { 481 | "mcpServers": { 482 | "context7": { 483 | "type": "streamable-http", 484 | "url": "https://mcp.context7.com/mcp" 485 | } 486 | } 487 | } 488 | ``` 489 | 490 | #### Roo Code ローカルサーバー接続 491 | 492 | ```json 493 | { 494 | "mcpServers": { 495 | "context7": { 496 | "command": "npx", 497 | "args": ["-y", "@upstash/context7-mcp"] 498 | } 499 | } 500 | } 501 | ``` 502 | 503 | </details> 504 | 505 | <details> 506 | <summary><b>Zencoder へのインストール</b></summary> 507 | 508 | Zencoder で Context7 MCP を設定するには、以下の手順に従います: 509 | 510 | 1. Zencoder メニュー (...) に移動します 511 | 2. ドロップダウンメニューから Agent tools を選択します 512 | 3. Add custom MCP をクリックします 513 | 4. 以下から名前とサーバー設定を追加し、Install ボタンを必ず押してください 514 | 515 | ```json 516 | { 517 | "command": "npx", 518 | "args": [ 519 | "-y", 520 | "@upstash/context7-mcp@latest" 521 | ] 522 | } 523 | ``` 524 | 525 | MCP サーバーが追加されたら、簡単に使用を続けることができます。 526 | 527 | </details> 528 | 529 | <details> 530 | <summary><b>Amazon Q Developer CLI へのインストール</b></summary> 531 | 532 | これを Amazon Q Developer CLI 設定ファイルに追加します。詳細は [Amazon Q Developer CLI ドキュメント](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) を参照してください。 533 | 534 | ```json 535 | { 536 | "mcpServers": { 537 | "context7": { 538 | "command": "npx", 539 | "args": ["-y", "@upstash/context7-mcp@latest"] 540 | } 541 | } 542 | } 543 | ``` 544 | </details> 545 | 546 | ## 🔨 利用可能なツール 547 | 548 | Context7 MCP は LLM が使用できる以下のツールを提供します: 549 | 550 | - `resolve-library-id`:一般的なライブラリ名を Context7 互換のライブラリ ID に変換します。 551 | 552 | - `libraryName`(必須):検索するライブラリの名前 553 | 554 | - `get-library-docs`:Context7 互換のライブラリ ID を使用してライブラリのドキュメントを取得します。 555 | - `context7CompatibleLibraryID`(必須):正確な Context7 互換のライブラリ ID(例:`/mongodb/docs`、`/vercel/next.js`) 556 | - `topic`(任意):ドキュメントの特定のトピックに焦点を当てます(例:"routing"、"hooks") 557 | - `tokens`(任意、デフォルト 10000):返すトークンの最大数。デフォルト値 10000 未満の値は自動的に 10000 に増加されます。 558 | 559 | ## 💻 開発 560 | 561 | プロジェクトをクローンして依存関係をインストールします: 562 | 563 | ```bash 564 | bun i 565 | ``` 566 | 567 | ビルド: 568 | 569 | ```bash 570 | bun run build 571 | ``` 572 | 573 | サーバーを実行: 574 | 575 | ```bash 576 | bun run dist/index.js 577 | ``` 578 | 579 | ### CLI 引数 580 | 581 | `context7-mcp` は以下の CLI フラグを受け付けます: 582 | 583 | - `--transport <stdio|http|sse>` – 使用するトランスポート(デフォルトは `stdio`)。 584 | - `--port <number>` – `http` または `sse` トランスポート使用時にリッスンするポート(デフォルト `3000`)。 585 | 586 | http トランスポートとポート 8080 の例: 587 | 588 | ```bash 589 | bun run dist/index.js --transport http --port 8080 590 | ``` 591 | 592 | <details> 593 | <summary><b>ローカル設定例</b></summary> 594 | 595 | ```json 596 | { 597 | "mcpServers": { 598 | "context7": { 599 | "command": "npx", 600 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 601 | } 602 | } 603 | } 604 | ``` 605 | 606 | </details> 607 | 608 | <details> 609 | <summary><b>MCP Inspector でのテスト</b></summary> 610 | 611 | ```bash 612 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp 613 | ``` 614 | 615 | </details> 616 | 617 | ## 🚨 トラブルシューティング 618 | 619 | <details> 620 | <summary><b>モジュールが見つからないエラー</b></summary> 621 | 622 | `ERR_MODULE_NOT_FOUND` が発生した場合は、`npx` の代わりに `bunx` を使用してみてください: 623 | 624 | ```json 625 | { 626 | "mcpServers": { 627 | "context7": { 628 | "command": "bunx", 629 | "args": ["-y", "@upstash/context7-mcp"] 630 | } 631 | } 632 | } 633 | ``` 634 | 635 | これにより、`npx` がパッケージを正しくインストールまたは解決できない環境でのモジュール解決の問題が解決されることがあります。 636 | 637 | </details> 638 | 639 | <details> 640 | <summary><b>ESM 解決の問題</b></summary> 641 | 642 | `Error: Cannot find module 'uriTemplate.js'` のようなエラーの場合は、`--experimental-vm-modules` フラグを試してください: 643 | 644 | ```json 645 | { 646 | "mcpServers": { 647 | "context7": { 648 | "command": "npx", 649 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 650 | } 651 | } 652 | } 653 | ``` 654 | 655 | </details> 656 | 657 | <details> 658 | <summary><b>TLS/証明書の問題</b></summary> 659 | 660 | TLS 関連の問題を回避するには、`--experimental-fetch` フラグを使用します: 661 | 662 | ```json 663 | { 664 | "mcpServers": { 665 | "context7": { 666 | "command": "npx", 667 | "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"] 668 | } 669 | } 670 | } 671 | ``` 672 | 673 | </details> 674 | 675 | <details> 676 | <summary><b>一般的な MCP クライアントエラー</b></summary> 677 | 678 | 1. パッケージ名に `@latest` を追加してみる 679 | 2. `npx` の代替として `bunx` を使用する 680 | 3. 別の代替方法として `deno` の使用を検討する 681 | 4. ネイティブ fetch サポートのために Node.js v18 以上を使用していることを確認する 682 | 683 | </details> 684 | 685 | ## ⚠️ 免責事項 686 | 687 | Context7 プロジェクトはコミュニティが貢献しているもので、高品質を維持するよう努めていますが、すべてのライブラリドキュメントの正確性、完全性、セキュリティを保証することはできません。Context7 にリストされているプロジェクトは、Context7 ではなく、それぞれの所有者によって開発および保守されています。疑わしい、不適切な、または潜在的に有害なコンテンツを発見した場合は、プロジェクトページの「報告」ボタンを使用して、すぐにお知らせください。私たちはすべての報告を真剣に受け止め、プラットフォームの整合性と安全性を維持するために、フラグが付けられたコンテンツを迅速にレビューします。Context7 を使用することにより、あなたは自己の裁量とリスクで使用することを認めます。 688 | 689 | ## 🤝 私たちとつながる 690 | 691 | 最新情報を入手し、コミュニティに参加しましょう: 692 | 693 | - 📢 最新ニュースとアップデートのために [X](https://x.com/contextai) でフォローしてください 694 | - 🌐 [Web サイト](https://context7.com) を訪問してください 695 | - 💬 [Discord コミュニティ](https://upstash.com/discord) に参加してください 696 | 697 | ## 📺 メディアでの Context7 698 | 699 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 700 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 701 | - [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 702 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 703 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 704 | - [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 705 | - [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo) 706 | - [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM) 707 | 708 | ## ⭐ スター履歴 709 | 710 | [](https://www.star-history.com/#upstash/context7&Date) 711 | 712 | ## 📄 ライセンス 713 | 714 | MIT 715 | -------------------------------------------------------------------------------- /docs/README.ko.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - 모든 프롬프트를 위한 최신 코드 문서 2 | 3 | [](https://context7.com) [](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) 4 | 5 | [](./docs/README.zh-TW.md) [](./docs/README.zh-CN.md) [](./docs/README.ja.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) [-purple>)](./docs/README.pt-BR.md) [](./docs/README.it.md) [](./docs/README.id-ID.md) [](./docs/README.de.md) [](./docs/README.ru.md) [](./docs/README.tr.md) [](./docs/README.ar.md) 6 | 7 | ## ❌ Context7 없이 8 | 9 | LLM은 사용하는 라이브러리에 대한 오래되거나 일반적인 정보에 의존하면 다음과 같은 문제가 발생할 수 있습니다: 10 | 11 | - ❌ 1년 전 학습 데이터를 기반으로 한 오래된 코드 예제 12 | - ❌ 실제로 존재하지 않는 API에 대한 환각 13 | - ❌ 구 버전 패키지에 대한 일반적인 답변 14 | 15 | ## ✅ Context7 사용 시 16 | 17 | Context7 MCP는 최신 버전별 문서와 코드 예제를 소스에서 직접 가져와 프롬프트에 즉시 적용합니다. 18 | 19 | Cursor에서 프롬프트에 `use context7`을 추가하세요: 20 | 21 | ```txt 22 | 쿠키에서 유효한 JWT를 확인하고 인증되지 않은 사용자를 /login으로 리디렉션하는 Next.js 미들웨어를 만들어주세요. use context7 23 | ``` 24 | 25 | ```txt 26 | JSON API 응답을 5분 동안 캐시하도록 Cloudflare Worker 스크립트를 구성해주세요. use context7 27 | ``` 28 | 29 | Context7은 최신 코드 예제와 문서를 LLM의 컨텍스트에 즉시 가져옵니다. 30 | 31 | - 1️⃣ 평소처럼 자연스럽게 프롬프트 작성 32 | - 2️⃣ `use context7` 키워드 추가 33 | - 3️⃣ 실제 동작하는 코드 답변 받기 34 | 35 | 탭 전환도, 존재하지 않는 API도, 오래된 코드 생성도 없습니다. 36 | 37 | ## 📚 프로젝트 추가하기 38 | 39 | Context7에 여러분이 좋아하는 라이브러리를 추가(또는 업데이트)하는 방법을 알아보려면 [프로젝트 추가 가이드](./adding-projects.md)를 확인하세요. 40 | 41 | ## 🛠️ 시작하기 42 | 43 | ### 요구사항 44 | 45 | - Node.js >= v18.0.0 46 | - Cursor, Windsurf, Claude Desktop 또는 다른 MCP 클라이언트 47 | 48 | <details> 49 | <summary><b>Smithery를 통한 설치</b></summary> 50 | 51 | [Smithery](https://smithery.ai/server/@upstash/context7-mcp)를 통해 모든 클라이언트에 Context7 MCP 서버를 자동으로 설치하려면: 52 | 53 | ```bash 54 | npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY> 55 | ``` 56 | 57 | Smithery 키는 [Smithery.ai 웹페이지](https://smithery.ai/server/@upstash/context7-mcp)에서 찾을 수 있습니다. 58 | 59 | </details> 60 | 61 | <details> 62 | <summary><b>Cursor에 설치</b></summary> 63 | 64 | 다음으로 이동: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 65 | 66 | 다음 설정을 Cursor의 `~/.cursor/mcp.json` 파일에 붙여넣는 것이 권장됩니다. 프로젝트 폴더에 `.cursor/mcp.json`을 생성하여 특정 프로젝트에 설치할 수도 있습니다. 자세한 내용은 [Cursor MCP 문서](https://docs.cursor.com/context/model-context-protocol)를 참조하세요. 67 | 68 | > Cursor 1.0부터는 아래 설치 버튼으로 한 번에 설치할 수 있습니다. 69 | 70 | #### Cursor 원격 서버 연결 71 | 72 | [](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D) 73 | 74 | ```json 75 | { 76 | "mcpServers": { 77 | "context7": { 78 | "url": "https://mcp.context7.com/mcp" 79 | } 80 | } 81 | } 82 | ``` 83 | 84 | #### Cursor 로컬 서버 연결 85 | 86 | [](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9) 87 | 88 | ```json 89 | { 90 | "mcpServers": { 91 | "context7": { 92 | "command": "npx", 93 | "args": ["-y", "@upstash/context7-mcp"] 94 | } 95 | } 96 | } 97 | ``` 98 | 99 | <details> 100 | <summary>대안: Bun 사용</summary> 101 | 102 | [](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D) 103 | 104 | ```json 105 | { 106 | "mcpServers": { 107 | "context7": { 108 | "command": "bunx", 109 | "args": ["-y", "@upstash/context7-mcp"] 110 | } 111 | } 112 | } 113 | ``` 114 | 115 | </details> 116 | 117 | <details> 118 | <summary>대안: Deno 사용</summary> 119 | 120 | [](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9) 121 | 122 | ```json 123 | { 124 | "mcpServers": { 125 | "context7": { 126 | "command": "deno", 127 | "args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | </details> 134 | 135 | </details> 136 | 137 | <details> 138 | <summary><b>Windsurf에 설치</b></summary> 139 | 140 | Windsurf MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [Windsurf MCP 문서](https://docs.windsurf.com/windsurf/mcp)를 참조하세요. 141 | 142 | #### Windsurf 원격 서버 연결 143 | 144 | ```json 145 | { 146 | "mcpServers": { 147 | "context7": { 148 | "serverUrl": "https://mcp.context7.com/sse" 149 | } 150 | } 151 | } 152 | ``` 153 | 154 | #### Windsurf 로컬 서버 연결 155 | 156 | ```json 157 | { 158 | "mcpServers": { 159 | "context7": { 160 | "command": "npx", 161 | "args": ["-y", "@upstash/context7-mcp"] 162 | } 163 | } 164 | } 165 | ``` 166 | 167 | </details> 168 | 169 | <details> 170 | <summary><b>Trae에 설치</b></summary> 171 | 172 | 수동 추가 기능을 사용하여 해당 MCP 서버의 JSON 설정 정보를 입력하세요. 173 | 자세한 내용은 [Trae 문서](https://docs.trae.ai/ide/model-context-protocol?_lang=en)를 참조하세요. 174 | 175 | #### Trae 원격 서버 연결 176 | 177 | ```json 178 | { 179 | "mcpServers": { 180 | "context7": { 181 | "url": "https://mcp.context7.com/mcp" 182 | } 183 | } 184 | } 185 | ``` 186 | 187 | #### Trae 로컬 서버 연결 188 | 189 | ```json 190 | { 191 | "mcpServers": { 192 | "context7": { 193 | "command": "npx", 194 | "args": [ 195 | "-y", 196 | "@upstash/context7-mcp" 197 | ] 198 | } 199 | } 200 | } 201 | ``` 202 | 203 | </details> 204 | 205 | <details> 206 | <summary><b>VS Code에 설치</b></summary> 207 | 208 | [<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) 209 | [<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) 210 | 211 | VS Code MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [VS Code MCP 문서](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)를 참조하세요. 212 | 213 | #### VS Code 원격 서버 연결 214 | 215 | ```json 216 | "mcp": { 217 | "servers": { 218 | "context7": { 219 | "type": "http", 220 | "url": "https://mcp.context7.com/mcp" 221 | } 222 | } 223 | } 224 | ``` 225 | 226 | #### VS Code 로컬 서버 연결 227 | 228 | ```json 229 | "mcp": { 230 | "servers": { 231 | "context7": { 232 | "type": "stdio", 233 | "command": "npx", 234 | "args": ["-y", "@upstash/context7-mcp"] 235 | } 236 | } 237 | } 238 | ``` 239 | 240 | </details> 241 | 242 | <details> 243 | <summary><b>Visual Studio 2022에 설치</b></summary> 244 | 245 | [Visual Studio MCP 서버 문서](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)에 따라 Visual Studio 2022에서 Context7 MCP를 설정할 수 있습니다. 246 | 247 | Visual Studio MCP 설정 파일에 다음을 추가하세요(자세한 내용은 [Visual Studio 문서](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) 참조): 248 | 249 | ```json 250 | { 251 | "mcp": { 252 | "servers": { 253 | "context7": { 254 | "type": "http", 255 | "url": "https://mcp.context7.com/mcp" 256 | } 257 | } 258 | } 259 | } 260 | ``` 261 | 262 | 또는 로컬 서버의 경우: 263 | 264 | ```json 265 | { 266 | "mcp": { 267 | "servers": { 268 | "context7": { 269 | "type": "stdio", 270 | "command": "npx", 271 | "args": ["-y", "@upstash/context7-mcp"] 272 | } 273 | } 274 | } 275 | } 276 | ``` 277 | 278 | 자세한 정보 및 문제 해결은 [Visual Studio MCP 서버 문서](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)를 참조하세요. 279 | </details> 280 | 281 | <details> 282 | <summary><b>Zed에 설치</b></summary> 283 | 284 | [Zed 확장 프로그램](https://zed.dev/extensions?query=Context7)을 통해 설치하거나 Zed `settings.json`에 다음을 추가할 수 있습니다. 자세한 내용은 [Zed 컨텍스트 서버 문서](https://zed.dev/docs/assistant/context-servers)를 참조하세요. 285 | 286 | ```json 287 | { 288 | "context_servers": { 289 | "Context7": { 290 | "command": { 291 | "path": "npx", 292 | "args": ["-y", "@upstash/context7-mcp"] 293 | }, 294 | "settings": {} 295 | } 296 | } 297 | } 298 | ``` 299 | 300 | </details> 301 | 302 | <details> 303 | <summary><b>Gemini CLI에 설치</b></summary> 304 | 305 | 자세한 내용은 [Gemini CLI 설정](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md)을 참조하세요. 306 | 307 | 1. Gemini CLI 설정 파일을 엽니다. 위치는 `~/.gemini/settings.json`입니다 (`~`는 홈 디렉토리). 308 | 2. `settings.json` 파일의 `mcpServers` 객체에 다음을 추가합니다: 309 | 310 | ```json 311 | { 312 | "mcpServers": { 313 | "context7": { 314 | "command": "npx", 315 | "args": ["-y", "@upstash/context7-mcp"] 316 | } 317 | } 318 | } 319 | ``` 320 | 321 | `mcpServers` 객체가 없으면 새로 만드세요. 322 | 323 | </details> 324 | 325 | <details> 326 | <summary><b>Claude Code에 설치</b></summary> 327 | 328 | 이 명령을 실행하세요. 자세한 내용은 [Claude Code MCP 문서](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)를 참조하세요. 329 | 330 | #### Claude Code 원격 서버 연결 331 | 332 | ```sh 333 | claude mcp add --transport http context7 https://mcp.context7.com/mcp 334 | ``` 335 | 336 | 또는 SSE 전송 사용: 337 | 338 | ```sh 339 | claude mcp add --transport sse context7 https://mcp.context7.com/sse 340 | ``` 341 | 342 | #### Claude Code 로컬 서버 연결 343 | 344 | ```sh 345 | claude mcp add context7 -- npx -y @upstash/context7-mcp 346 | ``` 347 | 348 | </details> 349 | 350 | <details> 351 | <summary><b>Claude Desktop에 설치</b></summary> 352 | 353 | Claude Desktop의 `claude_desktop_config.json` 파일에 다음을 추가하세요. 자세한 내용은 [Claude Desktop MCP 문서](https://modelcontextprotocol.io/quickstart/user)를 참조하세요. 354 | 355 | ```json 356 | { 357 | "mcpServers": { 358 | "Context7": { 359 | "command": "npx", 360 | "args": ["-y", "@upstash/context7-mcp"] 361 | } 362 | } 363 | } 364 | ``` 365 | 366 | </details> 367 | 368 | <details> 369 | <summary> 370 | <b>Cline에 설치</b> 371 | </summary> 372 | 373 | 다음 지침에 따라 [Cline MCP 서버 마켓플레이스](https://cline.bot/mcp-marketplace)를 통해 Context7을 쉽게 설치할 수 있습니다: 374 | 375 | 1. **Cline**을 엽니다. 376 | 2. 햄버거 메뉴 아이콘(☰)을 클릭하여 **MCP 서버** 섹션으로 들어갑니다. 377 | 3. **마켓플레이스** 탭 내의 검색창을 사용하여 *Context7*을 찾습니다. 378 | 4. **설치** 버튼을 클릭합니다. 379 | 380 | </details> 381 | 382 | <details> 383 | <summary><b>BoltAI에 설치</b></summary> 384 | 385 | 앱의 "설정" 페이지를 열고 "플러그인"으로 이동한 후 다음 JSON을 입력합니다: 386 | 387 | ```json 388 | { 389 | "mcpServers": { 390 | "context7": { 391 | "command": "npx", 392 | "args": ["-y", "@upstash/context7-mcp"] 393 | } 394 | } 395 | } 396 | ``` 397 | 398 | 저장되면 채팅에 `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)를 참조하세요. 399 | 400 | </details> 401 | 402 | <details> 403 | <summary><b>Copilot Coding Agent 설치</b></summary> 404 | 405 | 아래 설정을 Copilot Coding Agent의 `mcp` 섹션(Repository->Settings->Copilot->Coding agent->MCP configuration)에 추가하세요: 406 | 407 | ```json 408 | { 409 | "mcpServers": { 410 | "context7": { 411 | "type": "http", 412 | "url": "https://mcp.context7.com/mcp", 413 | "tools": [ 414 | "get-library-docs", 415 | "resolve-library-id" 416 | ] 417 | } 418 | } 419 | } 420 | ``` 421 | 422 | 자세한 내용은 [공식 GitHub 문서](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp)를 참고하세요. 423 | 424 | </details> 425 | 426 | <details> 427 | <summary><b>Docker 사용하기</b></summary> 428 | 429 | MCP 서버를 Docker 컨테이너에서 실행하려면: 430 | 431 | 1. **Docker 이미지 빌드:** 432 | 433 | 먼저 프로젝트 루트(또는 원하는 위치)에 `Dockerfile`을 만듭니다: 434 | 435 | <details> 436 | <summary>Dockerfile 내용 보기</summary> 437 | 438 | ```Dockerfile 439 | FROM node:18-alpine 440 | 441 | WORKDIR /app 442 | 443 | # 최신 버전 전역 설치 444 | RUN npm install -g @upstash/context7-mcp 445 | 446 | # 필요한 경우 기본 포트 노출 (선택 사항, MCP 클라이언트 상호 작용에 따라 다름) 447 | # EXPOSE 3000 448 | 449 | # 서버 실행 기본 명령어 450 | CMD ["context7-mcp"] 451 | ``` 452 | 453 | </details> 454 | 455 | 그런 다음 태그(예: `context7-mcp`)를 사용하여 이미지를 빌드합니다. **Docker Desktop (또는 Docker 데몬)이 실행 중인지 확인하세요.** `Dockerfile`을 저장한 디렉토리에서 다음 명령을 실행합니다: 456 | 457 | ```bash 458 | docker build -t context7-mcp . 459 | ``` 460 | 461 | 2. **MCP 클라이언트 설정:** 462 | 463 | MCP 클라이언트 설정을 업데이트하여 Docker 명령을 사용하도록 합니다. 464 | 465 | _cline_mcp_settings.json 예시:_ 466 | 467 | ```json 468 | { 469 | "mcpServers": { 470 | "Сontext7": { 471 | "autoApprove": [], 472 | "disabled": false, 473 | "timeout": 60, 474 | "command": "docker", 475 | "args": ["run", "-i", "--rm", "context7-mcp"], 476 | "transportType": "stdio" 477 | } 478 | } 479 | } 480 | ``` 481 | 482 | _참고: 이것은 예시 설정입니다. 이 README의 앞부분에 있는 특정 MCP 클라이언트(Cursor, VS Code 등) 예시를 참조하여 구조를 조정하세요(예: `mcpServers` 대 `servers`). 또한 `args`의 이미지 이름이 `docker build` 명령 중 사용된 태그와 일치하는지 확인하세요._ 483 | 484 | </details> 485 | 486 | <details> 487 | <summary><b>Windows에 설치</b></summary> 488 | 489 | Windows에서의 설정은 Linux나 macOS와 약간 다릅니다 (_예시에서는 `Cline` 사용_). 다른 편집기에도 동일한 원칙이 적용됩니다. `command`와 `args` 설정을 참조하세요. 490 | 491 | ```json 492 | { 493 | "mcpServers": { 494 | "github.com/upstash/context7-mcp": { 495 | "command": "cmd", 496 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], 497 | "disabled": false, 498 | "autoApprove": [] 499 | } 500 | } 501 | } 502 | ``` 503 | 504 | </details> 505 | 506 | <details> 507 | <summary><b>Augment Code에 설치</b></summary> 508 | 509 | Augment Code에서 Context7 MCP를 설정하려면 그래픽 인터페이스 또는 수동 설정을 사용할 수 있습니다. 510 | 511 | ### **A. Augment Code UI 사용** 512 | 513 | 1. 햄버거 메뉴를 클릭합니다. 514 | 2. **설정**을 선택합니다. 515 | 3. **도구** 섹션으로 이동합니다. 516 | 4. **+ MCP 추가** 버튼을 클릭합니다. 517 | 5. 다음 명령을 입력합니다: 518 | 519 | ``` 520 | npx -y @upstash/context7-mcp@latest 521 | ``` 522 | 523 | 6. MCP 이름을 **Context7**으로 지정합니다. 524 | 7. **추가** 버튼을 클릭합니다. 525 | 526 | MCP 서버가 추가되면 Augment Code 내에서 직접 Context7의 최신 코드 문서 기능을 사용할 수 있습니다. 527 | 528 | --- 529 | 530 | ### **B. 수동 설정** 531 | 532 | 1. Cmd/Ctrl Shift P를 누르거나 Augment 패널의 햄버거 메뉴로 이동합니다. 533 | 2. 설정 편집을 선택합니다. 534 | 3. 고급 아래에서 settings.json에서 편집을 클릭합니다. 535 | 4. `augment.advanced` 객체의 `mcpServers` 배열에 서버 설정을 추가합니다. 536 | 537 | "augment.advanced": { 538 | "mcpServers": [ 539 | { 540 | "name": "context7", 541 | "command": "npx", 542 | "args": ["-y", "@upstash/context7-mcp"] 543 | } 544 | ] 545 | } 546 | 547 | MCP 서버가 추가되면 편집기를 다시 시작하세요. 오류가 발생하면 닫는 괄호나 쉼표가 누락되지 않았는지 구문을 확인하세요. 548 | 549 | </details> 550 | 551 | <details> 552 | <summary><b>Roo Code에 설치</b></summary> 553 | 554 | Roo Code MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [Roo Code MCP 문서](https://docs.roocode.com/features/mcp/using-mcp-in-roo)를 참조하세요. 555 | 556 | #### Roo Code 원격 서버 연결 557 | 558 | ```json 559 | { 560 | "mcpServers": { 561 | "context7": { 562 | "type": "streamable-http", 563 | "url": "https://mcp.context7.com/mcp" 564 | } 565 | } 566 | } 567 | ``` 568 | 569 | #### Roo Code 로컬 서버 연결 570 | 571 | ```json 572 | { 573 | "mcpServers": { 574 | "context7": { 575 | "command": "npx", 576 | "args": ["-y", "@upstash/context7-mcp"] 577 | } 578 | } 579 | } 580 | ``` 581 | 582 | </details> 583 | 584 | <details> 585 | <summary><b>Zencoder에 설치</b></summary> 586 | 587 | Zencoder에서 Context7 MCP를 설정하려면 다음 단계를 따르세요: 588 | 589 | 1. Zencoder 메뉴(...)로 이동합니다. 590 | 2. 드롭다운 메뉴에서 에이전트 도구를 선택합니다. 591 | 3. 사용자 지정 MCP 추가를 클릭합니다. 592 | 4. 아래에서 이름과 서버 설정을 추가하고 설치 버튼을 누릅니다. 593 | 594 | ```json 595 | { 596 | "command": "npx", 597 | "args": [ 598 | "-y", 599 | "@upstash/context7-mcp@latest" 600 | ] 601 | } 602 | ``` 603 | 604 | MCP 서버가 추가되면 쉽게 계속 사용할 수 있습니다. 605 | 606 | </details> 607 | 608 | <details> 609 | <summary><b>Amazon Q Developer CLI에 설치</b></summary> 610 | 611 | Amazon Q Developer CLI 설정 파일에 다음을 추가하세요. 자세한 내용은 [Amazon Q Developer CLI 문서](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html)를 참조하세요. 612 | 613 | ```json 614 | { 615 | "mcpServers": { 616 | "context7": { 617 | "command": "npx", 618 | "args": ["-y", "@upstash/context7-mcp@latest"] 619 | } 620 | } 621 | } 622 | ``` 623 | </details> 624 | 625 | <details> 626 | <summary><b>Qodo Gen에 설치</b></summary> 627 | 628 | 자세한 내용은 [Qodo Gen 문서](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps)를 참조하세요. 629 | 630 | 1. VSCode 또는 IntelliJ에서 Qodo Gen 채팅 패널을 엽니다. 631 | 2. 더 많은 도구 연결을 클릭합니다. 632 | 3. + 새 MCP 추가를 클릭합니다. 633 | 4. 다음 설정을 추가합니다: 634 | 635 | ```json 636 | { 637 | "mcpServers": { 638 | "context7": { 639 | "url": "https://mcp.context7.com/mcp" 640 | } 641 | } 642 | } 643 | ``` 644 | </details> 645 | 646 | <details> 647 | <summary><b>JetBrains AI Assistant에 설치</b></summary> 648 | 649 | 자세한 내용은 [JetBrains AI Assistant 문서](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html)를 참조하세요. 650 | 651 | 1. JetBrains IDE에서 `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`로 이동합니다. 652 | 2. `+ 추가`를 클릭합니다. 653 | 3. 대화 상자 왼쪽 상단의 `Command`를 클릭하고 목록에서 JSON으로 옵션을 선택합니다. 654 | 4. 이 설정을 추가하고 `OK`를 클릭합니다. 655 | 656 | ```json 657 | { 658 | "mcpServers": { 659 | "context7": { 660 | "command": "npx", 661 | "args": ["-y", "@upstash/context7-mcp"] 662 | } 663 | } 664 | } 665 | ``` 666 | 667 | 5. `Apply`를 클릭하여 변경 사항을 저장합니다. 668 | 669 | </details> 670 | 671 | <details> 672 | <summary><b>Warp에 설치</b></summary> 673 | 674 | 자세한 내용은 [Warp 모델 컨텍스트 프로토콜 문서](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server)를 참조하세요. 675 | 676 | 1. `Settings` > `AI` > `Manage MCP servers`로 이동합니다. 677 | 2. `+ Add` 버튼을 클릭하여 새 MCP 서버를 추가합니다. 678 | 3. 아래 주어진 설정을 붙여넣습니다: 679 | 680 | ```json 681 | { 682 | "Context7": { 683 | "command": "npx", 684 | "args": [ 685 | "-y", 686 | "@upstash/context7-mcp" 687 | ], 688 | "env": {}, 689 | "working_directory": null, 690 | "start_on_launch": true 691 | } 692 | } 693 | ``` 694 | 695 | 4. `Save`를 클릭하여 변경 사항을 적용합니다. 696 | 697 | </details> 698 | 699 | <details> 700 | <summary><b>Opencode에 설치</b></summary> 701 | 702 | Opencode 설정 파일에 다음을 추가하세요. 자세한 내용은 [Opencode MCP 문서](https://opencode.ai/docs/mcp-servers)를 참조하세요. 703 | 704 | #### Opencode 원격 서버 연결 705 | 706 | ```json 707 | "mcp": { 708 | "context7": { 709 | "type": "remote", 710 | "url": "https://mcp.context7.com/mcp", 711 | "enabled": true 712 | } 713 | } 714 | ``` 715 | 716 | #### Opencode 로컬 서버 연결 717 | 718 | ```json 719 | 720 | { 721 | "mcp": { 722 | "context7": { 723 | "type": "local", 724 | "command": ["npx", "-y", "@upstash/context7-mcp"], 725 | "enabled": true 726 | } 727 | } 728 | } 729 | ``` 730 | 731 | </details> 732 | 733 | ## 🔨 사용 가능한 도구 734 | 735 | Context7 MCP는 LLM이 사용할 수 있는 다음 도구들을 제공합니다: 736 | 737 | - `resolve-library-id`: 일반적인 라이브러리 이름을 Context7이 인식할 수 있는 라이브러리 ID로 변환합니다. 738 | 739 | - `libraryName` (필수): 검색할 라이브러리의 이름 740 | 741 | - `get-library-docs`: Context7이 인식하는 라이브러리 ID를 사용하여 해당 라이브러리의 문서를 가져옵니다. 742 | - `context7CompatibleLibraryID` (필수): 정확한 Context7 호환 라이브러리 ID (예: `/mongodb/docs`, `/vercel/next.js`) 743 | - `topic` (선택): 특정 주제에 대한 문서에 집중합니다 (예: "routing", "hooks") 744 | - `tokens` (선택, 기본값 10000): 가져올 문서의 최대 토큰 수. 기본값인 10000보다 작은 값은 자동으로 10000으로 증가합니다. 745 | 746 | ## 🛟 팁 747 | 748 | ### 규칙 추가 749 | > 모든 프롬프트에 `use context7`을 추가하고 싶지 않다면, Windsurf의 `.windsurfrules` 파일이나 Cursor의 `Cursor Settings > Rules` 섹션(또는 사용 중인 MCP 클라이언트의 해당 기능)에서 간단한 규칙을 정의하여 코드 관련 질문에 Context7을 자동으로 호출할 수 있습니다: 750 | > ```toml 751 | > [[calls]] 752 | > match = "when the user requests code examples, setup or configuration steps, or library/API documentation" 753 | > tool = "context7" 754 | > ``` 755 | > 그러면 추가 입력 없이도 관련 대화에서 Context7의 문서를 얻을 수 있습니다. match 부분에 여러분의 사용 사례를 추가할 수 있습니다. 756 | 757 | ### 라이브러리 ID 사용 758 | > 사용하려는 라이브러리를 이미 정확히 알고 있다면, 프롬프트에 해당 라이브러리의 Context7 ID를 추가하세요. 이렇게 하면 Context7 MCP 서버가 라이브러리 매칭 단계를 건너뛰고 바로 문서 검색을 진행할 수 있습니다. 759 | > ```txt 760 | > supabase로 기본 인증을 구현해줘. API와 문서는 /supabase/supabase 라이브러리를 사용해줘 761 | > ``` 762 | > 슬래시 구문은 MCP 도구에게 어떤 라이브러리의 문서를 로드할지 정확히 알려줍니다. 763 | 764 | 765 | 766 | ## 💻 개발 767 | 768 | 프로젝트를 복제하고 의존성을 설치하세요: 769 | 770 | ```bash 771 | bun i 772 | ``` 773 | 774 | 빌드: 775 | 776 | ```bash 777 | bun run build 778 | ``` 779 | 780 | 서버 실행: 781 | 782 | ```bash 783 | bun run dist/index.js 784 | ``` 785 | 786 | ### CLI 인수 787 | 788 | `context7-mcp`는 다음 CLI 플래그를 지원합니다: 789 | 790 | - `--transport <stdio|http|sse>` – 사용할 전송 방식 (`stdio`가 기본값). 791 | - `--port <number>` – `http` 또는 `sse` 전송 방식 사용 시 수신 대기할 포트 (기본값 `3000`). 792 | 793 | http 전송과 포트 8080을 사용하는 예시: 794 | 795 | ```bash 796 | bun run dist/index.js --transport http --port 8080 797 | ``` 798 | 799 | <details> 800 | <summary><b>로컬 설정 예시</b></summary> 801 | 802 | ```json 803 | { 804 | "mcpServers": { 805 | "context7": { 806 | "command": "npx", 807 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 808 | } 809 | } 810 | } 811 | ``` 812 | 813 | </details> 814 | 815 | <details> 816 | <summary><b>MCP Inspector로 테스트</b></summary> 817 | 818 | ```bash 819 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp 820 | ``` 821 | 822 | </details> 823 | 824 | ## 🚨 문제 해결 825 | 826 | <details> 827 | <summary><b>Module Not Found Errors</b></summary> 828 | 829 | `ERR_MODULE_NOT_FOUND` 오류가 발생하면 `npx` 대신 `bunx`를 사용해 보세요: 830 | 831 | ```json 832 | { 833 | "mcpServers": { 834 | "context7": { 835 | "command": "bunx", 836 | "args": ["-y", "@upstash/context7-mcp"] 837 | } 838 | } 839 | } 840 | ``` 841 | 842 | 이 방법은 `npx`가 패키지를 제대로 설치하거나 확인하지 못하는 환경에서 모듈 확인 문제를 해결하는 경우가 많습니다. 843 | 844 | </details> 845 | 846 | <details> 847 | <summary><b>ESM Resolution 문제</b></summary> 848 | 849 | `Error: Cannot find module 'uriTemplate.js'`와 같은 오류의 경우 `--experimental-vm-modules` 플래그를 사용해 보세요: 850 | 851 | ```json 852 | { 853 | "mcpServers": { 854 | "context7": { 855 | "command": "npx", 856 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 857 | } 858 | } 859 | } 860 | ``` 861 | 862 | </details> 863 | 864 | <details> 865 | <summary><b>TLS/인증서 문제</b></summary> 866 | 867 | `--experimental-fetch` 플래그를 사용하여 TLS 관련 문제를 우회하세요: 868 | 869 | ```json 870 | { 871 | "mcpServers": { 872 | "context7": { 873 | "command": "npx", 874 | "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"] 875 | } 876 | } 877 | } 878 | ``` 879 | 880 | </details> 881 | 882 | <details> 883 | <summary><b>일반적인 MCP 클라이언트 오류</b></summary> 884 | 885 | 1. 패키지 이름에 `@latest`를 추가해 보세요. 886 | 2. `npx` 대신 `bunx`를 사용해 보세요. 887 | 3. 또 다른 대안으로 `deno` 사용을 고려해 보세요. 888 | 4. 네이티브 fetch 지원을 위해 Node.js v18 이상을 사용하고 있는지 확인하세요. 889 | 890 | </details> 891 | 892 | ## ⚠️ 면책 조항 893 | 894 | Context7 프로젝트는 커뮤니티 기여로 이루어지며, 높은 품질을 유지하기 위해 노력하지만 모든 라이브러리 문서의 정확성, 완전성 또는 보안을 보장할 수는 없습니다. Context7에 등록된 프로젝트는 Context7이 아닌 각 소유자에 의해 개발되고 유지 관리됩니다. 의심스럽거나, 부적절하거나, 잠재적으로 유해한 콘텐츠를 발견하면 프로젝트 페이지의 "신고" 버튼을 사용하여 즉시 저희에게 알려주십시오. 저희는 모든 신고를 심각하게 받아들이고 플랫폼의 무결성과 안전을 유지하기 위해 신고된 콘텐츠를 신속하게 검토할 것입니다. Context7을 사용함으로써 귀하는 자신의 재량과 책임 하에 사용함을 인정하는 것입니다. 895 | 896 | ## 🤝 소통하기 897 | 898 | 최신 정보를 받고 커뮤니티에 참여하세요: 899 | 900 | - 📢 [X](https://x.com/contextai)에서 저희를 팔로우하고 최신 소식과 업데이트를 받아보세요. 901 | - 🌐 저희 [웹사이트](https://context7.com)를 방문하세요. 902 | - 💬 저희 [디스코드 커뮤니티](https://upstash.com/discord)에 참여하세요. 903 | 904 | ## 📺 미디어 속 Context7 905 | 906 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 907 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 908 | - [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 909 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 910 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 911 | - [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 912 | - [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo) 913 | - [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM) 914 | 915 | ## ⭐ Star History 916 | 917 | [](https://www.star-history.com/#upstash/context7&Date) 918 | 919 | ## 라이선스 920 | 921 | MIT 922 | -------------------------------------------------------------------------------- /docs/README.pt-BR.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Documentação Atualizada Para Qualquer Prompt 2 | 3 | [](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="Instalar no 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) 4 | 5 | [](./docs/README.zh-CN.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) 6 | 7 | ## ❌ Sem o Context7 8 | 9 | Os LLMs dependem de informações desatualizadas ou genéricas sobre as bibliotecas que você usa. Você obtém: 10 | 11 | - ❌ Exemplos de código desatualizados e baseados em dados de treinamento de anos atrás 12 | - ❌ APIs alucinadas que nem existem 13 | - ❌ Respostas genéricas para versões antigas de pacotes 14 | 15 | ## ✅ Com o Context7 16 | 17 | O Context7 MCP extrai documentação e exemplos de código atualizados e específicos para cada versão diretamente da fonte — e os coloca diretamente em seu prompt. 18 | 19 | Adicione `use context7` ao seu prompt no Cursor: 20 | 21 | ```txt 22 | Create a basic Next.js project with app router. use context7 23 | ``` 24 | 25 | ```txt 26 | Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7 27 | ``` 28 | 29 | O Context7 busca exemplos de código e documentação atualizados diretamente para o contexto do seu LLM. 30 | 31 | - 1️⃣ Escreva seu prompt naturalmente 32 | - 2️⃣ Diga ao LLM para `use context7` 33 | - 3️⃣ Obtenha respostas com código funcional 34 | 35 | Sem alternar entre abas, sem APIs alucinadas que não existem, sem gerações de código desatualizadas. 36 | 37 | ## 🛠️ Primeiros Passos 38 | 39 | ### Requisitos 40 | 41 | - Node.js >= v18.0.0 42 | - Cursor, Windsurf, Claude Desktop ou outro Cliente MCP 43 | 44 | ### Instalando via Smithery 45 | 46 | Para instalar o Servidor Context7 MCP para Claude Desktop automaticamente via [Smithery](https://smithery.ai/server/@upstash/context7-mcp): 47 | 48 | ```bash 49 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 50 | ``` 51 | 52 | ### Instalar no Cursor 53 | 54 | Vá para: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 55 | 56 | Colar a seguinte configuração no seu arquivo Cursor `~/.cursor/mcp.json` é a abordagem recomendada. Veja a [documentação do Cursor MCP](https://docs.cursor.com/context/model-context-protocol) para mais informações. 57 | 58 | ```json 59 | { 60 | "mcpServers": { 61 | "context7": { 62 | "command": "npx", 63 | "args": ["-y", "@upstash/context7-mcp@latest"] 64 | } 65 | } 66 | } 67 | ``` 68 | 69 | <details> 70 | <summary>Alternativa: Usar Bun</summary> 71 | 72 | ```json 73 | { 74 | "mcpServers": { 75 | "context7": { 76 | "command": "bunx", 77 | "args": ["-y", "@upstash/context7-mcp@latest"] 78 | } 79 | } 80 | } 81 | ``` 82 | 83 | </details> 84 | 85 | <details> 86 | <summary>Alternativa: Usar Deno</summary> 87 | 88 | ```json 89 | { 90 | "mcpServers": { 91 | "context7": { 92 | "command": "deno", 93 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 94 | } 95 | } 96 | } 97 | ``` 98 | 99 | </details> 100 | 101 | ### Instalar no Windsurf 102 | 103 | Adicione isto ao seu arquivo de configuração MCP do Windsurf. Veja a [documentação do Windsurf MCP](https://docs.windsurf.com/windsurf/mcp) para mais informações. 104 | 105 | ```json 106 | { 107 | "mcpServers": { 108 | "context7": { 109 | "command": "npx", 110 | "args": ["-y", "@upstash/context7-mcp@latest"] 111 | } 112 | } 113 | } 114 | ``` 115 | 116 | ### Instalar no VS Code 117 | 118 | [<img alt="Instalar no 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) 119 | [<img alt="Instalar no 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) 120 | 121 | Adicione isto ao seu arquivo de configuração MCP do VS Code. Veja a [documentação do VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) para mais informações. 122 | 123 | ```json 124 | { 125 | "servers": { 126 | "Context7": { 127 | "type": "stdio", 128 | "command": "npx", 129 | "args": ["-y", "@upstash/context7-mcp@latest"] 130 | } 131 | } 132 | } 133 | ``` 134 | 135 | ### Instalar no Zed 136 | 137 | Pode ser instalado via [Extensões do Zed](https://zed.dev/extensions?query=Context7) ou você pode adicionar isto ao seu `settings.json` do Zed. Veja a [documentação de Servidores de Contexto do Zed](https://zed.dev/docs/assistant/context-servers) para mais informações. 138 | 139 | ```json 140 | { 141 | "context_servers": { 142 | "Context7": { 143 | "command": { 144 | "path": "npx", 145 | "args": ["-y", "@upstash/context7-mcp@latest"] 146 | }, 147 | "settings": {} 148 | } 149 | } 150 | } 151 | ``` 152 | 153 | ### Instalar no Claude Code 154 | 155 | Execute este comando. Veja a [documentação do Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) para mais informações. 156 | 157 | ```sh 158 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 159 | ``` 160 | 161 | ### Instalar no Claude Desktop 162 | 163 | Adicione isto ao seu arquivo `claude_desktop_config.json` do Claude Desktop. Veja a [documentação do Claude Desktop MCP](https://modelcontextprotocol.io/quickstart/user) para mais informações. 164 | 165 | ```json 166 | { 167 | "mcpServers": { 168 | "Context7": { 169 | "command": "npx", 170 | "args": ["-y", "@upstash/context7-mcp@latest"] 171 | } 172 | } 173 | } 174 | ``` 175 | 176 | ### Instalação no Copilot Coding Agent 177 | 178 | Adicione a seguinte configuração à seção `mcp` do seu arquivo de configuração do Copilot Coding Agent (Repository->Settings->Copilot->Coding agent->MCP configuration): 179 | 180 | ```json 181 | { 182 | "mcpServers": { 183 | "context7": { 184 | "type": "http", 185 | "url": "https://mcp.context7.com/mcp", 186 | "tools": [ 187 | "get-library-docs", 188 | "resolve-library-id" 189 | ] 190 | } 191 | } 192 | } 193 | ``` 194 | 195 | Para mais informações, consulte a [documentação oficial do GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 196 | 197 | ### Usando Docker 198 | 199 | Se você preferir executar o servidor MCP em um contêiner Docker: 200 | 201 | 1. **Construa a Imagem Docker:** 202 | 203 | Primeiro, crie um `Dockerfile` na raiz do projeto (ou onde preferir): 204 | 205 | <details> 206 | <summary>Clique para ver o conteúdo do Dockerfile</summary> 207 | 208 | ```Dockerfile 209 | FROM node:18-alpine 210 | 211 | WORKDIR /app 212 | 213 | # Instala a versão mais recente globalmente 214 | RUN npm install -g @upstash/context7-mcp@latest 215 | 216 | # Expõe a porta padrão se necessário (opcional, depende da interação do cliente MCP) 217 | # EXPOSE 3000 218 | 219 | # Comando padrão para executar o servidor 220 | CMD ["context7-mcp"] 221 | ``` 222 | 223 | </details> 224 | 225 | Em seguida, construa a imagem usando uma tag (por exemplo, `context7-mcp`). **Certifique-se de que o Docker Desktop (ou o daemon do Docker) esteja em execução.** Execute o seguinte comando no mesmo diretório onde você salvou o `Dockerfile`: 226 | 227 | ```bash 228 | docker build -t context7-mcp . 229 | ``` 230 | 231 | 2. **Configure Seu Cliente MCP:** 232 | 233 | Atualize a configuração do seu cliente MCP para usar o comando Docker. 234 | 235 | _Exemplo para um cline_mcp_settings.json:_ 236 | 237 | ```json 238 | { 239 | "mcpServers": { 240 | "Сontext7": { 241 | "autoApprove": [], 242 | "disabled": false, 243 | "timeout": 60, 244 | "command": "docker", 245 | "args": ["run", "-i", "--rm", "context7-mcp"], 246 | "transportType": "stdio" 247 | } 248 | } 249 | } 250 | ``` 251 | 252 | _Nota: Este é um exemplo de configuração. Consulte os exemplos específicos para o seu cliente MCP (como Cursor, VS Code, etc.) mencionados anteriormente neste README para adaptar a estrutura (por exemplo, `mcpServers` vs `servers`). Além disso, certifique-se de que o nome da imagem em `args` corresponda à tag usada durante o comando `docker build`._ 253 | 254 | ### Ferramentas Disponíveis 255 | 256 | - `resolve-library-id`: Resolve um nome geral de biblioteca em um ID de biblioteca compatível com Context7. 257 | - `libraryName` (obrigatório) 258 | - `get-library-docs`: Busca documentação para uma biblioteca usando um ID de biblioteca compatível com Context7. 259 | - `context7CompatibleLibraryID` (obrigatório) 260 | - `topic` (opcional): Concentra a documentação em um tópico específico (por exemplo, "routing", "hooks") 261 | - `tokens` (opcional, padrão 10000): Número máximo de tokens a retornar. Valores menores que 10000 são automaticamente aumentados para 10000. 262 | 263 | ## Desenvolvimento 264 | 265 | Clone o projeto e instale as dependências: 266 | 267 | ```bash 268 | bun i 269 | ``` 270 | 271 | Compilação: 272 | 273 | ```bash 274 | bun run build 275 | ``` 276 | 277 | ### Exemplo de Configuração Local 278 | 279 | ```json 280 | { 281 | "mcpServers": { 282 | "context7": { 283 | "command": "npx", 284 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 285 | } 286 | } 287 | } 288 | ``` 289 | 290 | ### Testando com o MCP Inspector 291 | 292 | ```bash 293 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 294 | ``` 295 | 296 | ## Solução de Problemas 297 | 298 | ### ERR_MODULE_NOT_FOUND 299 | 300 | Se você vir este erro, tente usar `bunx` em vez de `npx`. 301 | 302 | ```json 303 | { 304 | "mcpServers": { 305 | "context7": { 306 | "command": "bunx", 307 | "args": ["-y", "@upstash/context7-mcp@latest"] 308 | } 309 | } 310 | } 311 | ``` 312 | 313 | Isso geralmente resolve problemas de resolução de módulos, especialmente em ambientes onde o `npx` não instala ou resolve pacotes adequadamente. 314 | 315 | ### Problemas de Resolução ESM 316 | 317 | Se você encontrar um erro como: `Error: Cannot find module 'uriTemplate.js'` tente executar com a flag `--experimental-vm-modules`: 318 | 319 | ```json 320 | { 321 | "mcpServers": { 322 | "context7": { 323 | "command": "npx", 324 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 325 | } 326 | } 327 | } 328 | ``` 329 | 330 | ### Erros do Cliente MCP 331 | 332 | 1. Tente remover `@latest` do nome do pacote. 333 | 334 | 2. Tente usar `bunx` como alternativa. 335 | 336 | 3. Tente usar `deno` como alternativa. 337 | 338 | 4. Certifique-se de estar usando o Node v18 ou superior para ter suporte nativo ao fetch com `npx`. 339 | 340 | ## Aviso Legal 341 | 342 | Os projetos Context7 são contribuições da comunidade e, embora nos esforcemos para manter alta qualidade, não podemos garantir a precisão, completude ou segurança de toda a documentação da biblioteca. Os projetos listados no Context7 são desenvolvidos e mantidos por seus respectivos proprietários, não pelo Context7. Se você encontrar qualquer conteúdo suspeito, inadequado ou potencialmente prejudicial, use o botão "Report" na página do projeto para nos notificar imediatamente. Levamos todos os relatórios a sério e revisaremos o conteúdo sinalizado prontamente para manter a integridade e segurança de nossa plataforma. Ao usar o Context7, você reconhece que o faz por sua própria conta e risco. 343 | 344 | ## Context7 na Mídia 345 | 346 | - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) 347 | - [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 348 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 349 | - [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) 350 | - [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) 351 | - [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 352 | 353 | ## Histórico de Estrelas 354 | 355 | [](https://www.star-history.com/#upstash/context7&Date) 356 | 357 | ## Licença 358 | 359 | MIT 360 | -------------------------------------------------------------------------------- /docs/README.ru.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Актуальная документация для любого промпта 2 | 3 | [](https://context7.com) [](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) 4 | 5 | ## ❌ Без Context7 6 | 7 | LLMs полагаются на устаревшую или обобщённую информацию о библиотеках, с которыми вы работаете. В результате этого вы получаете: 8 | 9 | - ❌ Устаревшие примеры кода многолетней давности 10 | - ❌ Выдуманные API, которые даже не существуют 11 | - ❌ Обобщённые ответы для старых библиотек 12 | 13 | ## ✅ С Context7 14 | 15 | Context7 MCP получает актуальную документацию и примеры кода, строго соответствующие нужной версии, прямо из исходных источников и вставляет их прямо в ваш промпт. 16 | 17 | Добавьте строку `use context7` в промпт для Cursor: 18 | 19 | ```txt 20 | Создай базовый Next.js проект с маршрутизатором приложений. Use context7 21 | ``` 22 | 23 | ```txt 24 | Создай скрипт, удаляющий строки, где город равен "", используя учётные данные PostgreSQL. Use context7 25 | ``` 26 | 27 | Context7 MCP подгружает свежие примеры кода и документацию из источников прямо в контекст вашей LLM. 28 | 29 | - 1️⃣ Напишите свой промпт так, как писали его всегда 30 | - 2️⃣ Добавьте к промпту `use context7` 31 | - 3️⃣ Получите работающий результат 32 | 33 | Никакого переключения между вкладками, выдуманного API или устаревшего кода. 34 | 35 | ## 🛠️ Начало работы 36 | 37 | ### Требования 38 | 39 | - Node.js >= v18.0.0 40 | - Cursor, Windsurf, Claude Desktop или другой MCP клиент 41 | 42 | ### Установка через Smithery 43 | 44 | Воспользуйтесь [Smithery](https://smithery.ai/server/@upstash/context7-mcp), чтобы автоматически установить MCP сервер Context7 для Claude Desktop: 45 | 46 | ```bash 47 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 48 | ``` 49 | 50 | ### Установка в Cursor 51 | 52 | Перейдите в вкладку: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 53 | 54 | Рекомендуется вставить конфигурацию в файл `~/.cursor/mcp.json`. Также можно установить конфигурацию для конкретного проекта, создав файл `.cursor/mcp.json` в его директории. Смотрите [документацию Cursor MCP](https://docs.cursor.com/context/model-context-protocol) для получения дополнительной информации. 55 | 56 | ```json 57 | { 58 | "mcpServers": { 59 | "context7": { 60 | "command": "npx", 61 | "args": ["-y", "@upstash/context7-mcp"] 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | <details> 68 | <summary>Альтернативный вариант - Bun</summary> 69 | 70 | ```json 71 | { 72 | "mcpServers": { 73 | "context7": { 74 | "command": "bunx", 75 | "args": ["-y", "@upstash/context7-mcp"] 76 | } 77 | } 78 | } 79 | ``` 80 | 81 | </details> 82 | 83 | <details> 84 | <summary>Альтернативный вариант - Deno</summary> 85 | 86 | ```json 87 | { 88 | "mcpServers": { 89 | "context7": { 90 | "command": "deno", 91 | "args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"] 92 | } 93 | } 94 | } 95 | ``` 96 | 97 | </details> 98 | 99 | ### Установка в Windsurf 100 | 101 | Добавьте следующие строки в ваш конфигурационный файл Windsurf MCP. Смотрите [документацию Windsurf MCP](https://docs.windsurf.com/windsurf/mcp) для получения дополнительной информации. 102 | 103 | ```json 104 | { 105 | "mcpServers": { 106 | "context7": { 107 | "command": "npx", 108 | "args": ["-y", "@upstash/context7-mcp"] 109 | } 110 | } 111 | } 112 | ``` 113 | 114 | ### Установка в VS Code 115 | 116 | [<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) 117 | [<img alt="Установка в VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Установить%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) 118 | 119 | Добавьте следующие строки в ваш конфигурационный файл VS Code MCP. Смотрите [документацию VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) для получения дополнительной информации. 120 | 121 | ```json 122 | { 123 | "servers": { 124 | "Context7": { 125 | "type": "stdio", 126 | "command": "npx", 127 | "args": ["-y", "@upstash/context7-mcp"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | ### Установка in Zed 134 | 135 | Можно установить через [Zed расширение](https://zed.dev/extensions?query=Context7) или добавить следующие строки в `settings.json`. Смотрите [документацию Zed Context Server](https://zed.dev/docs/assistant/context-servers) для получения дополнительной информации. 136 | 137 | ```json 138 | { 139 | "context_servers": { 140 | "Context7": { 141 | "command": { 142 | "path": "npx", 143 | "args": ["-y", "@upstash/context7-mcp"] 144 | }, 145 | "settings": {} 146 | } 147 | } 148 | } 149 | ``` 150 | 151 | ### Установка в Claude Code 152 | 153 | Запустите следующую команду для установки. Смотрите [документацию Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) для получения дополнительной информации. 154 | 155 | ```sh 156 | claude mcp add context7 -- npx -y @upstash/context7-mcp 157 | ``` 158 | 159 | ### Установка в Claude Desktop 160 | 161 | Добавьте следующие следующие строки в ваш конфигурационный файл `claude_desktop_config.json`. Смотрите [документацию Claude Desktop MCP](https://modelcontextprotocol.io/quickstart/user) для получения дополнительной информации. 162 | 163 | ```json 164 | { 165 | "mcpServers": { 166 | "Context7": { 167 | "command": "npx", 168 | "args": ["-y", "@upstash/context7-mcp"] 169 | } 170 | } 171 | } 172 | ``` 173 | 174 | ### Установка в BoltAI 175 | 176 | Откройте страницу "Settings", перейдите в "Plugins" и добавьте следующие JSON-строки: 177 | 178 | ```json 179 | { 180 | "mcpServers": { 181 | "context7": { 182 | "args": ["-y", "@upstash/context7-mcp"], 183 | "command": "npx" 184 | } 185 | } 186 | } 187 | ``` 188 | 189 | ### Установка в Copilot Coding Agent 190 | 191 | Добавьте следующую конфигурацию в секцию `mcp` вашего файла настроек Copilot Coding Agent (Repository->Settings->Copilot->Coding agent->MCP configuration): 192 | 193 | ```json 194 | { 195 | "mcpServers": { 196 | "context7": { 197 | "type": "http", 198 | "url": "https://mcp.context7.com/mcp", 199 | "tools": [ 200 | "get-library-docs", 201 | "resolve-library-id" 202 | ] 203 | } 204 | } 205 | } 206 | ``` 207 | 208 | Подробнее см. в [официальной документации GitHub](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp). 209 | 210 | ### Используя Docker 211 | 212 | Если вы предпочитаете запускать MCP сервер в Docker контейнере: 213 | 214 | 1. **Создайте образ Docker:** 215 | 216 | Во-первых, создайте `Dockerfile` в корне вашего проекта (или в любом другом месте): 217 | 218 | <details> 219 | <summary>Нажмите, чтобы просмотреть содержимое файла Dockerfile</summary> 220 | 221 | ```Dockerfile 222 | FROM node:18-alpine 223 | 224 | WORKDIR /app 225 | 226 | # Установите последнюю версию пакета глобально 227 | RUN npm install -g @upstash/context7-mcp 228 | 229 | # Откройте стандартный порт, если это необходимо (необязательно, это зависит от взаимодействия с MCP клиентом) 230 | # EXPOSE 3000 231 | 232 | # Стандартная команда для запуска сервера 233 | CMD ["context7-mcp"] 234 | ``` 235 | 236 | </details> 237 | 238 | Затем, соберите образ, используя тег (например, `context7-mcp`). **Убедитесь, что Docker Desktop (или демон Docker) работает.** Запустите следующую команду в этой же директории, где сохранён `Dockerfile`: 239 | 240 | ```bash 241 | docker build -t context7-mcp . 242 | ``` 243 | 244 | 2. **Настройте ваш MCP клиент:** 245 | 246 | Обновите вашу конфигурацию MCP клиента, чтобы использовать Docker команду. 247 | 248 | _Пример для cline_mcp_settings.json:_ 249 | 250 | ```json 251 | { 252 | "mcpServers": { 253 | "Сontext7": { 254 | "autoApprove": [], 255 | "disabled": false, 256 | "timeout": 60, 257 | "command": "docker", 258 | "args": ["run", "-i", "--rm", "context7-mcp"], 259 | "transportType": "stdio" 260 | } 261 | } 262 | } 263 | ``` 264 | 265 | _Примечение: это пример конфигурации. Обратитесь к конкретным примерам для вашего MCP-клиента (например, Cursor, VS Code и т.д.), в предыдущих разделах этого README, чтобы адаптировать структуру (например, `mcpServers` вместо `servers`). Также убедитесь, что имя образа в `args` соответствует тегу, использованному при выполнении команды `docker build`._ 266 | 267 | ### Установка в Windows 268 | 269 | Конфигурация в Windows немного отличается от Linux или macOS (_в качестве примера используется `Cline`_). Однако, эти же же принципы применимы и к другим редакторам. В случае необходимости обратитесь к настройкам `command` и `args`. 270 | 271 | ```json 272 | { 273 | "mcpServers": { 274 | "github.com/upstash/context7-mcp": { 275 | "command": "cmd", 276 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp"], 277 | "disabled": false, 278 | "autoApprove": [] 279 | } 280 | } 281 | } 282 | ``` 283 | 284 | ### Переменные окружения 285 | 286 | - `DEFAULT_MINIMUM_TOKENS`: минимальное количество токенов, необходимое для получения документации (по умолчанию: 10000). 287 | 288 | Examples: 289 | 290 | ```json 291 | { 292 | "mcpServers": { 293 | "context7": { 294 | "command": "npx", 295 | "args": ["-y", "@upstash/context7-mcp"], 296 | "env": { 297 | "DEFAULT_MINIMUM_TOKENS": "10000" 298 | } 299 | } 300 | } 301 | } 302 | ``` 303 | 304 | ### Доступные инструменты 305 | 306 | - `resolve-library-id`: преобразует общее название библиотеки в совместимый с Context7 идентификатор. 307 | - `libraryName` (обязательно) 308 | - `get-library-docs`: получает документацию по библиотеке по совместимому с Context7 идентификатору. 309 | - `context7CompatibleLibraryID` (обязательно) 310 | - `topic` (необязательно): фокусирует документацию на определённой теме (например, "routing", "hooks") 311 | - `tokens` (необязательно, по умолчанию 10000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него. 312 | 313 | ## Разработка 314 | 315 | Склонируйте проект и установите зависимости: 316 | 317 | ```bash 318 | bun i 319 | ``` 320 | 321 | Сборка: 322 | 323 | ```bash 324 | bun run build 325 | ``` 326 | 327 | ### Пример локальной конфигурации 328 | 329 | ```json 330 | { 331 | "mcpServers": { 332 | "context7": { 333 | "command": "npx", 334 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 335 | } 336 | } 337 | } 338 | ``` 339 | 340 | ### Тестирование с помощью инспектора MCP 341 | 342 | ```bash 343 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp 344 | ``` 345 | 346 | ## Решение проблем 347 | 348 | ### ERR_MODULE_NOT_FOUND 349 | 350 | Если вы видите эту ошибку, используйте `bunx` вместо `npx`. 351 | 352 | ```json 353 | { 354 | "mcpServers": { 355 | "context7": { 356 | "command": "bunx", 357 | "args": ["-y", "@upstash/context7-mcp"] 358 | } 359 | } 360 | } 361 | ``` 362 | 363 | Зачастую это решает проблему с недостающими модулями, особенно в окружении, где `npx` некорректно устанавливает или разрешает библиотеки. 364 | 365 | ### Проблемы с разрешением ESM 366 | 367 | Если вы сталкиваетесь с проблемой по типу: `Error: Cannot find module 'uriTemplate.js'`, попробуйте запустить команду с флагом `--experimental-vm-modules`: 368 | 369 | ```json 370 | { 371 | "mcpServers": { 372 | "context7": { 373 | "command": "npx", 374 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp"] 375 | } 376 | } 377 | } 378 | ``` 379 | 380 | ### Проблемы с TLS/сертификатами 381 | 382 | Используйте флаг `--experimental-fetch` c `npx`, чтобы избежать ошибки, связанные с TLS: 383 | 384 | ```json 385 | { 386 | "mcpServers": { 387 | "context7": { 388 | "command": "npx", 389 | "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"] 390 | } 391 | } 392 | } 393 | ``` 394 | 395 | ### Ошибки MCP клиента 396 | 397 | 1. Попробуйте добавить тег `@latest` в имя пакета. 398 | 399 | 2. Попробуйте использовать `bunx` как альтернативу `npx`. 400 | 401 | 3. Попробуйте использовать `deno` как замену `npx` или `bunx`. 402 | 403 | 4. Убедитесь, что используете версию Node v18 или выше, чтобы `npx` поддерживал встроенный `fetch`. 404 | 405 | ## Отказ от ответственности 406 | 407 | Проекты Context7 создаются сообществом. Мы стремимся поддерживать высокое качество, однако не можем гарантировать точность, полноту или безопасность всей документации по библиотекам. Проекты, представленные в Context7, разрабатываются и поддерживаются их авторами, а не командой Context7. 408 | 409 | Если вы столкнётесь с подозрительным, неуместным или потенциально вредоносным контентом, пожалуйста, воспользуйтесь кнопкой "Report" на странице проекта, чтобы немедленно сообщить нам. Мы внимательно относимся ко всем обращениям и оперативно проверяем помеченные материалы, чтобы обеспечить надёжность и безопасность платформы. 410 | 411 | Используя Context7, вы признаёте, что делаете это по собственному усмотрению и на свой страх и риск. 412 | 413 | ## Оставайтесь с нами на связи 414 | 415 | Будьте в курсе последних новостей на наших платформах: 416 | 417 | - 📢 Следите за нашими новостями на [X](https://x.com/contextai), чтобы быть в курсе последних новостей 418 | - 🌐 Загляните на наш [сайт](https://context7.com) 419 | - 💬 При желании присоединяйтесь к нашему [сообществу в Discord](https://upstash.com/discord) 420 | 421 | ## Context7 в СМИ 422 | 423 | - [Better Stack: "Бесплатный инструмент делает Cursor в 10 раз умнее"](https://youtu.be/52FC3qObp9E) 424 | - [Cole Medin: "Это, без сомнения, ЛУЧШИЙ MCP-сервер для AI-помощников в коде"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 425 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: Это уже AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 426 | - [Julian Goldie SEO: "Context7: обновление MCP-агента"](https://www.youtube.com/watch?v=CTZm6fBYisc) 427 | - [JeredBlu: "Context 7 MCP: мгновенный доступ к документации + настройка для VS Code"](https://www.youtube.com/watch?v=-ls0D-rtET4) 428 | - [Income stream surfers: "Context7: новый MCP-сервер, который изменит кодинг с ИИ"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 429 | - [AICodeKing: "Context7 + Cline & RooCode: Этот MCP сервер делает CLINE в 100 раз ЭФФЕКТИВНЕЕ!"](https://www.youtube.com/watch?v=qZfENAPMnyo) 430 | - [Sean Kochel: "5 MCP серверов для стремительного вайб-программирования (Подключи и Работай)"](https://www.youtube.com/watch?v=LqTQi8qexJM) 431 | 432 | ## История звёзд на GitHub 433 | 434 | [](https://www.star-history.com/#upstash/context7&Date) 435 | 436 | ## Лицензия 437 | 438 | MIT 439 | -------------------------------------------------------------------------------- /docs/README.tr.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - Herhangi Bir Prompt İçin Güncel Kod Belgeleri 2 | 3 | [](https://context7.com) [](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) 4 | 5 | [](./docs/README.zh-CN.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) [-purple>)](./docs/README.pt-BR.md) [](./docs/README.it.md) [](./docs/README.id-ID.md) [](./docs/README.de.md) [](./docs/README.ru.md) [](./docs/README.tr.md) 6 | 7 | ## ❌ Context7 Olmadan 8 | 9 | LLM'ler, kullandığınız kütüphaneler hakkında güncel olmayan veya genel bilgilere güvenir. Karşılaştığınız sorunlar: 10 | 11 | - ❌ Kod örnekleri eskidir ve bir yıllık eğitim verilerine dayanır 12 | - ❌ Halüsinasyon yapılan API'ler gerçekte mevcut değildir 13 | - ❌ Eski paket sürümleri için genel cevaplar alırsınız 14 | 15 | ## ✅ Context7 İle 16 | 17 | 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. 18 | 19 | Cursor'da prompt'unuza `use context7` ekleyin: 20 | 21 | ```txt 22 | Next.js ile app router kullanan basit bir proje oluştur. use context7 23 | ``` 24 | 25 | ```txt 26 | PostgreSQL kimlik bilgileriyle şehir değeri "" olan satırları silmek için bir betik oluştur. use context7 27 | ``` 28 | 29 | Context7, güncel kod örneklerini ve belgelerini doğrudan LLM'inizin içeriğine getirir. 30 | 31 | - 1️⃣ Prompt'unuzu doğal bir şekilde yazın 32 | - 2️⃣ LLM'e `use context7` kullanmasını söyleyin 33 | - 3️⃣ Çalışan kod cevapları alın 34 | 35 | Sekme değiştirme, var olmayan halüsinasyon API'ler, güncel olmayan kod üretimleri yok. 36 | 37 | ## 🛠️ Başlangıç 38 | 39 | ### Gereksinimler 40 | 41 | - Node.js >= v18.0.0 42 | - Cursor, Windsurf, Claude Desktop veya başka bir MCP İstemcisi 43 | 44 | ### Smithery aracılığıyla kurulum 45 | 46 | Context7 MCP Server'ı Claude Desktop için [Smithery](https://smithery.ai/server/@upstash/context7-mcp) aracılığıyla otomatik olarak kurmak için: 47 | 48 | ```bash 49 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 50 | ``` 51 | 52 | ### Cursor'da Kurulum 53 | 54 | Şu yolu izleyin: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 55 | 56 | 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. 57 | 58 | ```json 59 | { 60 | "mcpServers": { 61 | "context7": { 62 | "command": "npx", 63 | "args": ["-y", "@upstash/context7-mcp@latest"] 64 | } 65 | } 66 | } 67 | ``` 68 | 69 | <details> 70 | <summary>Alternatif: Bun Kullanın</summary> 71 | 72 | ```json 73 | { 74 | "mcpServers": { 75 | "context7": { 76 | "command": "bunx", 77 | "args": ["-y", "@upstash/context7-mcp@latest"] 78 | } 79 | } 80 | } 81 | ``` 82 | 83 | </details> 84 | 85 | <details> 86 | <summary>Alternatif: Deno Kullanın</summary> 87 | 88 | ```json 89 | { 90 | "mcpServers": { 91 | "context7": { 92 | "command": "deno", 93 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 94 | } 95 | } 96 | } 97 | ``` 98 | 99 | </details> 100 | 101 | ### Windsurf'te Kurulum 102 | 103 | Bunu Windsurf MCP yapılandırma dosyanıza ekleyin. Daha fazla bilgi için [Windsurf MCP belgelerine](https://docs.windsurf.com/windsurf/mcp) bakabilirsiniz. 104 | 105 | ```json 106 | { 107 | "mcpServers": { 108 | "context7": { 109 | "command": "npx", 110 | "args": ["-y", "@upstash/context7-mcp@latest"] 111 | } 112 | } 113 | } 114 | ``` 115 | 116 | ### VS Code'da Kurulum 117 | 118 | [<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) 119 | [<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) 120 | 121 | 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. 122 | 123 | ```json 124 | { 125 | "servers": { 126 | "Context7": { 127 | "type": "stdio", 128 | "command": "npx", 129 | "args": ["-y", "@upstash/context7-mcp@latest"] 130 | } 131 | } 132 | } 133 | ``` 134 | 135 | ### Zed'de Kurulum 136 | 137 | [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. 138 | 139 | ```json 140 | { 141 | "context_servers": { 142 | "Context7": { 143 | "command": { 144 | "path": "npx", 145 | "args": ["-y", "@upstash/context7-mcp@latest"] 146 | }, 147 | "settings": {} 148 | } 149 | } 150 | } 151 | ``` 152 | 153 | ### Claude Code'da Kurulum 154 | 155 | 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. 156 | 157 | ```sh 158 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 159 | ``` 160 | 161 | ### Claude Desktop'ta Kurulum 162 | 163 | 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. 164 | 165 | ```json 166 | { 167 | "mcpServers": { 168 | "Context7": { 169 | "command": "npx", 170 | "args": ["-y", "@upstash/context7-mcp@latest"] 171 | } 172 | } 173 | } 174 | ``` 175 | 176 | ### Copilot Coding Agent Kurulumu 177 | 178 | Aşağıdaki yapılandırmayı Copilot Coding Agent'ın `mcp` bölümüne ekleyin (Repository->Settings->Copilot->Coding agent->MCP configuration): 179 | 180 | ```json 181 | { 182 | "mcpServers": { 183 | "context7": { 184 | "type": "http", 185 | "url": "https://mcp.context7.com/mcp", 186 | "tools": [ 187 | "get-library-docs", 188 | "resolve-library-id" 189 | ] 190 | } 191 | } 192 | } 193 | ``` 194 | 195 | Daha fazla bilgi için [resmi GitHub dokümantasyonuna](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp) bakabilirsiniz. 196 | 197 | ### Docker Kullanımı 198 | 199 | MCP sunucusunu bir Docker konteynerinde çalıştırmayı tercih ederseniz: 200 | 201 | 1. **Docker Görüntüsü Oluşturun:** 202 | 203 | Önce, proje kökünde (veya tercih ettiğiniz herhangi bir yerde) bir `Dockerfile` oluşturun: 204 | 205 | <details> 206 | <summary>Dockerfile içeriğini görmek için tıklayın</summary> 207 | 208 | ```Dockerfile 209 | FROM node:18-alpine 210 | 211 | WORKDIR /app 212 | 213 | # En son sürümü global olarak yükleyin 214 | RUN npm install -g @upstash/context7-mcp@latest 215 | 216 | # Gerekirse varsayılan portu açın (isteğe bağlı, MCP istemci etkileşimine bağlıdır) 217 | # EXPOSE 3000 218 | 219 | # Sunucuyu çalıştırmak için varsayılan komut 220 | CMD ["context7-mcp"] 221 | ``` 222 | 223 | </details> 224 | 225 | 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: 226 | 227 | ```bash 228 | docker build -t context7-mcp . 229 | ``` 230 | 231 | 2. **MCP İstemcinizi Yapılandırın:** 232 | 233 | MCP istemcinizin yapılandırmasını Docker komutunu kullanacak şekilde güncelleyin. 234 | 235 | _cline_mcp_settings.json için örnek:_ 236 | 237 | ```json 238 | { 239 | "mcpServers": { 240 | "Сontext7": { 241 | "autoApprove": [], 242 | "disabled": false, 243 | "timeout": 60, 244 | "command": "docker", 245 | "args": ["run", "-i", "--rm", "context7-mcp"], 246 | "transportType": "stdio" 247 | } 248 | } 249 | } 250 | ``` 251 | 252 | _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._ 253 | 254 | ### Çevre Değişkenleri 255 | 256 | - `DEFAULT_MINIMUM_TOKENS`: Belge alımı için minimum token sayısını ayarlayın (varsayılan: 10000). 257 | 258 | Örnekler: 259 | 260 | ```json 261 | { 262 | "mcpServers": { 263 | "context7": { 264 | "command": "npx", 265 | "args": ["-y", "@upstash/context7-mcp@latest"], 266 | "env": { 267 | "DEFAULT_MINIMUM_TOKENS": "10000" 268 | } 269 | } 270 | } 271 | } 272 | ``` 273 | 274 | ### Kullanılabilir Araçlar 275 | 276 | - `resolve-library-id`: Genel bir kütüphane adını Context7 uyumlu bir kütüphane ID'sine dönüştürür. 277 | - `libraryName` (gerekli) 278 | - `get-library-docs`: Context7 uyumlu bir kütüphane ID'si kullanarak bir kütüphane için belgeleri getirir. 279 | - `context7CompatibleLibraryID` (gerekli) 280 | - `topic` (isteğe bağlı): Belgeleri belirli bir konuya odaklayın (örn. "routing", "hooks") 281 | - `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. 282 | 283 | ## Geliştirme 284 | 285 | Projeyi klonlayın ve bağımlılıkları yükleyin: 286 | 287 | ```bash 288 | bun i 289 | ``` 290 | 291 | Derleyin: 292 | 293 | ```bash 294 | bun run build 295 | ``` 296 | 297 | ### Yerel Yapılandırma Örneği 298 | 299 | ```json 300 | { 301 | "mcpServers": { 302 | "context7": { 303 | "command": "npx", 304 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 305 | } 306 | } 307 | } 308 | ``` 309 | 310 | ### MCP Inspector ile Test Etme 311 | 312 | ```bash 313 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 314 | ``` 315 | 316 | ## Sorun Giderme 317 | 318 | ### ERR_MODULE_NOT_FOUND 319 | 320 | Bu hatayı görürseniz, `npx` yerine `bunx` kullanmayı deneyin. 321 | 322 | ```json 323 | { 324 | "mcpServers": { 325 | "context7": { 326 | "command": "bunx", 327 | "args": ["-y", "@upstash/context7-mcp@latest"] 328 | } 329 | } 330 | } 331 | ``` 332 | 333 | Bu, özellikle `npx`'in paketleri düzgün şekilde yüklemediği veya çözemediği ortamlarda modül çözümleme sorunlarını genellikle çözer. 334 | 335 | ### ESM Çözümleme Sorunları 336 | 337 | `Error: Cannot find module 'uriTemplate.js'` gibi bir hatayla karşılaşırsanız, `--experimental-vm-modules` bayrağıyla çalıştırmayı deneyin: 338 | 339 | ```json 340 | { 341 | "mcpServers": { 342 | "context7": { 343 | "command": "npx", 344 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 345 | } 346 | } 347 | } 348 | ``` 349 | 350 | ### MCP İstemci Hataları 351 | 352 | 1. Paket adından `@latest` ifadesini kaldırmayı deneyin. 353 | 354 | 2. Alternatif olarak `bunx` kullanmayı deneyin. 355 | 356 | 3. Alternatif olarak `deno` kullanmayı deneyin. 357 | 358 | 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. 359 | 360 | ## Sorumluluk Reddi 361 | 362 | 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. 363 | 364 | ## Context7 Medyada 365 | 366 | - [Better Stack: "Ücretsiz Araç Cursor'u 10 Kat Daha Akıllı Yapıyor"](https://youtu.be/52FC3qObp9E) 367 | - [Cole Medin: "Bu, Tartışmasız AI Kodlama Asistanları İçin EN İYİ MCP Sunucusudur"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 368 | - [Income stream surfers: "Context7 + SequentialThinking MCP'leri: Bu AGI mi?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 369 | - [Julian Goldie SEO: "Context7: Yeni MCP AI Aracı Güncellemesi"](https://www.youtube.com/watch?v=CTZm6fBYisc) 370 | - [JeredBlu: "Context 7 MCP: Belgeleri Anında Alın + VS Code Kurulumu"](https://www.youtube.com/watch?v=-ls0D-rtET4) 371 | - [Income stream surfers: "Context7: AI Kodlamayı DEĞİŞTİRECEK Yeni MCP Sunucusu"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 372 | - [AICodeKing: "Context7 + Cline & RooCode: Bu MCP Sunucusu CLINE'ı 100 KAT DAHA ETKİLİ YAPIYOR!"](https://www.youtube.com/watch?v=qZfENAPMnyo) 373 | - [Sean Kochel: "Vibe Kodlama İhtişamı İçin 5 MCP Sunucusu (Tak ve Çalıştır)"](https://www.youtube.com/watch?v=LqTQi8qexJM) 374 | 375 | ## Yıldız Geçmişi 376 | 377 | [](https://www.star-history.com/#upstash/context7&Date) 378 | 379 | ## Lisans 380 | 381 | MIT 382 | -------------------------------------------------------------------------------- /docs/README.zh-CN.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - 为所有Prompt获取最新文档 2 | 3 | [](https://context7.com) [](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=安装Context7%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) 4 | 5 | ## ❌ 不使用Context7 6 | 7 | 大语言模型(LLM)可能依赖过时或通用的库信息。你可能会遇到: 8 | 9 | - ❌ 代码示例已过时,或基于一年前的训练数据 10 | - ❌ 幻觉产生的API根本不存在 11 | - ❌ 针对旧版本包的通用回答 12 | 13 | ## ✅ 使用Context7 14 | 15 | Context7 MCP直接从源头获取最新的、特定版本的文档和代码示例 — 并将它们直接放入你的提示中。 16 | 17 | 在Cursor中添加`使用 context7`到你的提示: 18 | 19 | ```txt 20 | 创建一个使用app router的基本Next.js项目。使用 context7 21 | ``` 22 | 23 | ```txt 24 | 创建一个脚本,删除PostgreSQL数据库中city字段为""的行。使用 context7 25 | ``` 26 | 27 | Context7将最新的代码示例和文档直接获取到你的LLM上下文中。 28 | 29 | - 1️⃣ 按照往常,自然地编写你的提示 30 | - 2️⃣ 告诉LLM`使用 context7` 31 | - 3️⃣ 获取可用的代码回复 32 | 33 | 无需在标签间切换,不存在幻觉API,不会生成过时的代码。 34 | 35 | ## 🛠️ 开始使用 36 | 37 | ### 要求 38 | 39 | - Node.js >= v18.0.0 40 | - Cursor, Windsurf, Claude Desktop或其他MCP客户端 41 | 42 | ### 通过Smithery安装 43 | 44 | 要通过[Smithery](https://smithery.ai/server/@upstash/context7-mcp)自动安装Context7 MCP Server for Claude Desktop: 45 | 46 | ```bash 47 | npx -y @smithery/cli install @upstash/context7-mcp --client claude 48 | ``` 49 | 50 | ### 在Cursor中安装 51 | 52 | 前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 53 | 54 | 推荐的方法是将以下配置粘贴到你的Cursor `~/.cursor/mcp.json`文件中。更多信息请参见[Cursor MCP文档](https://docs.cursor.com/context/model-context-protocol)。 55 | 56 | ```json 57 | { 58 | "mcpServers": { 59 | "context7": { 60 | "command": "npx", 61 | "args": ["-y", "@upstash/context7-mcp@latest"] 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | <details> 68 | <summary>替代方案:使用Bun</summary> 69 | 70 | ```json 71 | { 72 | "mcpServers": { 73 | "context7": { 74 | "command": "bunx", 75 | "args": ["-y", "@upstash/context7-mcp@latest"] 76 | } 77 | } 78 | } 79 | ``` 80 | 81 | </details> 82 | 83 | <details> 84 | <summary>替代方案:使用Deno</summary> 85 | 86 | ```json 87 | { 88 | "mcpServers": { 89 | "context7": { 90 | "command": "deno", 91 | "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] 92 | } 93 | } 94 | } 95 | ``` 96 | 97 | </details> 98 | 99 | ### 在Windsurf中安装 100 | 101 | 将此内容添加到你的Windsurf MCP配置文件中。更多信息请参见[Windsurf MCP文档](https://docs.windsurf.com/windsurf/mcp)。 102 | 103 | ```json 104 | { 105 | "mcpServers": { 106 | "context7": { 107 | "command": "npx", 108 | "args": ["-y", "@upstash/context7-mcp@latest"] 109 | } 110 | } 111 | } 112 | ``` 113 | 114 | ### 在VSCode中安装 115 | 116 | [<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%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) 117 | [<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%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) 118 | 119 | 将此内容添加到你的VSCode MCP配置文件中。更多信息请参见[VSCode MCP文档](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。 120 | 121 | ```json 122 | { 123 | "servers": { 124 | "Context7": { 125 | "type": "stdio", 126 | "command": "npx", 127 | "args": ["-y", "@upstash/context7-mcp@latest"] 128 | } 129 | } 130 | } 131 | ``` 132 | 133 | ### 在Zed中安装 134 | 135 | 可以通过[Zed扩展](https://zed.dev/extensions?query=Context7)安装,或者你可以将以下内容添加到你的Zed `settings.json`文件中。更多信息请参见[Zed Context Server文档](https://zed.dev/docs/assistant/context-servers)。 136 | 137 | ```json 138 | { 139 | "context_servers": { 140 | "Context7": { 141 | "command": { 142 | "path": "npx", 143 | "args": ["-y", "@upstash/context7-mcp@latest"] 144 | }, 145 | "settings": {} 146 | } 147 | } 148 | } 149 | ``` 150 | 151 | ### 在Claude Code中安装 152 | 153 | 运行此命令。更多信息请参见[Claude Code MCP文档](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)。 154 | 155 | ```sh 156 | claude mcp add context7 -- npx -y @upstash/context7-mcp@latest 157 | ``` 158 | 159 | ### 在Claude Desktop中安装 160 | 161 | 将此内容添加到你的Claude Desktop `claude_desktop_config.json`文件中。更多信息请参见[Claude Desktop MCP文档](https://modelcontextprotocol.io/quickstart/user)。 162 | 163 | ```json 164 | { 165 | "mcpServers": { 166 | "Context7": { 167 | "command": "npx", 168 | "args": ["-y", "@upstash/context7-mcp@latest"] 169 | } 170 | } 171 | } 172 | ``` 173 | 174 | ### 在 Copilot Coding Agent 中安装 175 | 176 | 将以下配置添加到 Copilot Coding Agent 的 `mcp` 配置部分(Repository->Settings->Copilot->Coding agent->MCP configuration): 177 | 178 | ```json 179 | { 180 | "mcpServers": { 181 | "context7": { 182 | "type": "http", 183 | "url": "https://mcp.context7.com/mcp", 184 | "tools": [ 185 | "get-library-docs", 186 | "resolve-library-id" 187 | ] 188 | } 189 | } 190 | } 191 | ``` 192 | 193 | 更多信息请参见[官方GitHub文档](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp)。 194 | 195 | ### 使用Docker(容器部署) 196 | 197 | 如果你希望使用Docker容器运行MCP服务器: 198 | 199 | 1. **构建Docker镜像:** 200 | 201 | **确保Docker Desktop(或Docker守护进程)正在运行。** 在项目根目录运行: 202 | 203 | ```bash 204 | docker build -t context7-mcp . 205 | ``` 206 | 207 | 2. **配置MCP客户端:** 208 | 209 | 更新MCP客户端配置以使用Docker命令。 210 | 211 | _cline_mcp_settings.json配置示例:_ 212 | 213 | ```json 214 | { 215 | "mcpServers": { 216 | "Сontext7": { 217 | "autoApprove": [], 218 | "disabled": false, 219 | "timeout": 60, 220 | "command": "docker", 221 | "args": ["run", "-i", "--rm", "context7-mcp"], 222 | "transportType": "stdio" 223 | } 224 | } 225 | } 226 | ``` 227 | 228 | _注意事项:_ 229 | <em> 230 | 231 | - 此为示例配置。请参考前面README中针对具体MCP客户端(如Cursor、VS Code等)的示例来调整结构(如`mcpServers`与`servers`)。同时确保`args`中的镜像名称与`docker build`命令使用的标签一致。 232 | - 当前Cursor版本(0.49.5), 请不要使用本方式启动MCP server,详情:[Cursor官方说明](https://docs.cursor.com/context/model-context-protocol#remote-development) 233 | </em> 234 | 235 | ### 在Windows上安装 236 | 237 | 在windows上的配置相对于linux或macos来说有些许不同,(_示例使用的`Cline`_), 其它编辑器同理, 参考`command`和`args`的配置即可 238 | 239 | ```json 240 | { 241 | "mcpServers": { 242 | "github.com/upstash/context7-mcp": { 243 | "command": "cmd", 244 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], 245 | "disabled": false, 246 | "autoApprove": [] 247 | } 248 | } 249 | } 250 | ``` 251 | 252 | ### 可用工具 253 | 254 | - `resolve-library-id`: 将通用库名称解析为Context7兼容的库ID。 255 | - `libraryName` (必需) 256 | - `get-library-docs`: 使用Context7兼容的库ID获取库的文档。 257 | - `context7CompatibleLibraryID` (必需) 258 | - `topic` (可选): 将文档集中在特定主题上(例如"routing"、"hooks") 259 | - `tokens` (可选,默认10000): 返回的最大令牌数。小于10000的值会自动增加到10000。 260 | 261 | ## 开发 262 | 263 | 克隆项目并安装依赖: 264 | 265 | ```bash 266 | bun i 267 | ``` 268 | 269 | 构建: 270 | 271 | ```bash 272 | bun run build 273 | ``` 274 | 275 | ### 本地配置示例 276 | 277 | ```json 278 | { 279 | "mcpServers": { 280 | "context7": { 281 | "command": "npx", 282 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 283 | } 284 | } 285 | } 286 | ``` 287 | 288 | ### 使用MCP Inspector测试 289 | 290 | ```bash 291 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest 292 | ``` 293 | 294 | ## 故障排除 295 | 296 | ### ERR_MODULE_NOT_FOUND 297 | 298 | 如果你看到这个错误,请尝试使用`bunx`而不是`npx`。 299 | 300 | ```json 301 | { 302 | "mcpServers": { 303 | "context7": { 304 | "command": "bunx", 305 | "args": ["-y", "@upstash/context7-mcp@latest"] 306 | } 307 | } 308 | } 309 | ``` 310 | 311 | 这通常可以解决模块解析问题,特别是在`npx`无法正确安装或解析包的环境中。 312 | 313 | ### MCP客户端错误 314 | 315 | 1. 尝试从包名中删除`@latest`。 316 | 317 | 2. 尝试使用`bunx`作为替代方案。 318 | 319 | 3. 尝试使用`deno`作为替代方案。 320 | 321 | 4. 确保你使用的是Node v18或更高版本,以便使用`npx`时获得原生fetch支持。 322 | 323 | ## Context7媒体报道 324 | 325 | - [Better Stack: "免费工具让Cursor变得更智能10倍"](https://youtu.be/52FC3qObp9E) 326 | - [Cole Medin: "这绝对是AI编码助手的最佳MCP服务器"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 327 | - [Income stream surfers: "Context7 + SequentialThinking MCPs: 这是AGI吗?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) 328 | - [Julian Goldie SEO: "Context7: 新的MCP AI代理更新"](https://www.youtube.com/watch?v=CTZm6fBYisc) 329 | - [JeredBlu: "Context 7 MCP: 即时获取文档 + VS Code设置"](https://www.youtube.com/watch?v=-ls0D-rtET4) 330 | - [Income stream surfers: "Context7: 将改变AI编码的新MCP服务器"](https://www.youtube.com/watch?v=PS-2Azb-C3M) 331 | 332 | ## Star历史 333 | 334 | [](https://www.star-history.com/#upstash/context7&Date) 335 | 336 | ## 许可证 337 | 338 | MIT 339 | -------------------------------------------------------------------------------- /docs/README.zh-TW.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP - 即時更新的程式碼文件,適用於任何提示 2 | 3 | [](https://context7.com) [](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) 4 | 5 | ## ❌ 沒有 Context7 6 | 7 | 大型語言模型(LLM)依賴過時或通用的函式庫資訊。你會遇到: 8 | 9 | - ❌ 程式碼範例過時,僅根據一年前的訓練資料 10 | - ❌ 產生不存在的 API 11 | - ❌ 舊版套件的通用答案 12 | 13 | ## ✅ 有了 Context7 14 | 15 | Context7 MCP 直接從來源拉取即時、特定版本的文件與程式碼範例,並直接放入你的提示中。 16 | 17 | 在 Cursor 的提示中加入 `use context7`: 18 | 19 | ```txt 20 | 建立一個使用 app router 的基本 Next.js 專案。use context7 21 | ``` 22 | 23 | ```txt 24 | 根據 PostgreSQL 資訊,建立一個刪除 city 為 "" 的資料列的腳本。use context7 25 | ``` 26 | 27 | Context7 會將即時的程式碼範例與文件直接帶入你的 LLM 上下文。 28 | 29 | - 1️⃣ 自然地撰寫你的提示 30 | - 2️⃣ 告訴 LLM `use context7` 31 | - 3️⃣ 取得可執行的程式碼解答 32 | 33 | 不需切換分頁、不會產生不存在的 API、不會有過時的程式碼。 34 | 35 | ## 📚 新增專案 36 | 37 | 請參考我們的[專案新增指南](./adding-projects.md),學習如何將你喜愛的函式庫加入 Context7 或更新其內容。 38 | 39 | ## 🛠️ 安裝 40 | 41 | ### 系統需求 42 | 43 | - Node.js >= v18.0.0 44 | - Cursor、Windsurf、Claude Desktop 或其他 MCP 客戶端 45 | 46 | <details> 47 | <summary><b>透過 Smithery 安裝</b></summary> 48 | 49 | 要透過 [Smithery](https://smithery.ai/server/@upstash/context7-mcp) 自動安裝 Context7 MCP Server: 50 | 51 | ```bash 52 | npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY> 53 | ``` 54 | 55 | 你的 Smithery 金鑰可在 [Smithery.ai 網頁](https://smithery.ai/server/@upstash/context7-mcp) 取得。 56 | 57 | </details> 58 | 59 | <details> 60 | <summary><b>在 Cursor 安裝</b></summary> 61 | 62 | 前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` 63 | 64 | 建議將下列設定貼到你的 Cursor `~/.cursor/mcp.json` 檔案。你也可以在專案資料夾建立 `.cursor/mcp.json` 進行專案安裝。詳見 [Cursor MCP 文件](https://docs.cursor.com/context/model-context-protocol)。 65 | 66 | #### Cursor 遠端伺服器連線 67 | 68 | ```json 69 | { 70 | "mcpServers": { 71 | "context7": { 72 | "url": "https://mcp.context7.com/mcp" 73 | } 74 | } 75 | } 76 | ``` 77 | 78 | #### Cursor 本地伺服器連線 79 | 80 | ```json 81 | { 82 | "mcpServers": { 83 | "context7": { 84 | "command": "npx", 85 | "args": ["-y", "@upstash/context7-mcp"] 86 | } 87 | } 88 | } 89 | ``` 90 | 91 | <details> 92 | <summary>替代方案:使用 Bun</summary> 93 | 94 | ```json 95 | { 96 | "mcpServers": { 97 | "context7": { 98 | "command": "bunx", 99 | "args": ["-y", "@upstash/context7-mcp"] 100 | } 101 | } 102 | } 103 | ``` 104 | 105 | </details> 106 | 107 | <details> 108 | <summary>替代方案:使用 Deno</summary> 109 | 110 | ```json 111 | { 112 | "mcpServers": { 113 | "context7": { 114 | "command": "deno", 115 | "args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"] 116 | } 117 | } 118 | } 119 | ``` 120 | 121 | </details> 122 | 123 | </details> 124 | 125 | <details> 126 | <summary><b>在 Windsurf 安裝</b></summary> 127 | 128 | 將下列內容加入 Windsurf MCP 設定檔。詳見 [Windsurf MCP 文件](https://docs.windsurf.com/windsurf/mcp)。 129 | 130 | #### Windsurf 遠端伺服器連線 131 | 132 | ```json 133 | { 134 | "mcpServers": { 135 | "context7": { 136 | "serverUrl": "https://mcp.context7.com/sse" 137 | } 138 | } 139 | } 140 | ``` 141 | 142 | #### Windsurf 本地伺服器連線 143 | 144 | ```json 145 | { 146 | "mcpServers": { 147 | "context7": { 148 | "command": "npx", 149 | "args": ["-y", "@upstash/context7-mcp"] 150 | } 151 | } 152 | } 153 | ``` 154 | 155 | </details> 156 | 157 | <details> 158 | <summary><b>在 VS Code 安裝</b></summary> 159 | 160 | [<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) 161 | [<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) 162 | 163 | 將下列內容加入 VS Code MCP 設定檔。詳見 [VS Code MCP 文件](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。 164 | 165 | #### VS Code 遠端伺服器連線 166 | 167 | ```json 168 | "mcp": { 169 | "servers": { 170 | "context7": { 171 | "type": "http", 172 | "url": "https://mcp.context7.com/mcp" 173 | } 174 | } 175 | } 176 | ``` 177 | 178 | #### VS Code 本地伺服器連線 179 | 180 | ```json 181 | "mcp": { 182 | "servers": { 183 | "context7": { 184 | "type": "stdio", 185 | "command": "npx", 186 | "args": ["-y", "@upstash/context7-mcp"] 187 | } 188 | } 189 | } 190 | ``` 191 | 192 | </details> 193 | 194 | <details> 195 | <summary><b>在 Zed 安裝</b></summary> 196 | 197 | 可透過 [Zed 擴充套件](https://zed.dev/extensions?query=Context7) 安裝,或將下列內容加入 Zed `settings.json`。詳見 [Zed Context Server 文件](https://zed.dev/docs/assistant/context-servers)。 198 | 199 | ```json 200 | { 201 | "context_servers": { 202 | "Context7": { 203 | "command": { 204 | "path": "npx", 205 | "args": ["-y", "@upstash/context7-mcp"] 206 | }, 207 | "settings": {} 208 | } 209 | } 210 | } 211 | ``` 212 | 213 | </details> 214 | 215 | <details> 216 | <summary><b>在 Claude Code 安裝</b></summary> 217 | 218 | 執行下列指令。詳見 [Claude Code MCP 文件](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)。 219 | 220 | #### Claude Code 遠端伺服器連線 221 | 222 | ```sh 223 | claude mcp add --transport sse context7 https://mcp.context7.com/sse 224 | ``` 225 | 226 | #### Claude Code 本地伺服器連線 227 | 228 | ```sh 229 | claude mcp add context7 -- npx -y @upstash/context7-mcp 230 | ``` 231 | 232 | </details> 233 | 234 | <details> 235 | <summary><b>在 Claude Desktop 安裝</b></summary> 236 | 237 | 將下列內容加入 Claude Desktop `claude_desktop_config.json`。詳見 [Claude Desktop MCP 文件](https://modelcontextprotocol.io/quickstart/user)。 238 | 239 | ```json 240 | { 241 | "mcpServers": { 242 | "Context7": { 243 | "command": "npx", 244 | "args": ["-y", "@upstash/context7-mcp"] 245 | } 246 | } 247 | } 248 | ``` 249 | 250 | </details> 251 | 252 | <details> 253 | <summary><b>在 BoltAI 安裝</b></summary> 254 | 255 | 打開應用程式的「Settings」頁面,前往「Plugins」,並輸入下列 JSON: 256 | 257 | ```json 258 | { 259 | "mcpServers": { 260 | "context7": { 261 | "command": "npx", 262 | "args": ["-y", "@upstash/context7-mcp"] 263 | } 264 | } 265 | } 266 | ``` 267 | 268 | 儲存後,在聊天中輸入 `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)。 269 | 270 | </details> 271 | 272 | <details> 273 | <summary><b>在 Copilot Coding Agent 安裝</b></summary> 274 | 275 | 請將以下設定加入 Copilot Coding Agent 的 `mcp` 設定區塊(Repository->Settings->Copilot->Coding agent->MCP configuration): 276 | 277 | ```json 278 | { 279 | "mcpServers": { 280 | "context7": { 281 | "type": "http", 282 | "url": "https://mcp.context7.com/mcp", 283 | "tools": [ 284 | "get-library-docs", 285 | "resolve-library-id" 286 | ] 287 | } 288 | } 289 | } 290 | ``` 291 | 292 | 更多資訊請參見[官方 GitHub 文件](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp)。 293 | 294 | </details> 295 | 296 | <details> 297 | <summary><b>使用 Docker</b></summary> 298 | 299 | 若你偏好在 Docker 容器中執行 MCP 伺服器: 300 | 301 | 1. **建立 Docker 映像檔:** 302 | 303 | 先在專案根目錄(或任意位置)建立 `Dockerfile`: 304 | 305 | <details> 306 | <summary>點擊查看 Dockerfile 內容</summary> 307 | 308 | ```Dockerfile 309 | FROM node:18-alpine 310 | 311 | WORKDIR /app 312 | 313 | # 全域安裝最新版 314 | RUN npm install -g @upstash/context7-mcp 315 | 316 | # 如有需要可開放預設埠(視 MCP 客戶端互動而定) 317 | # EXPOSE 3000 318 | 319 | # 預設啟動指令 320 | CMD ["context7-mcp"] 321 | ``` 322 | 323 | </details> 324 | 325 | 然後使用標籤(如 `context7-mcp`)建構映像檔。**請確保 Docker Desktop(或 Docker daemon)已啟動。**在存有 `Dockerfile` 的目錄執行: 326 | 327 | ```bash 328 | docker build -t context7-mcp . 329 | ``` 330 | 331 | 2. **設定 MCP 客戶端:** 332 | 333 | 更新 MCP 客戶端設定以使用 Docker 指令。 334 | 335 | _cline_mcp_settings.json 範例:_ 336 | 337 | ```json 338 | { 339 | "mcpServers": { 340 | "Сontext7": { 341 | "autoApprove": [], 342 | "disabled": false, 343 | "timeout": 60, 344 | "command": "docker", 345 | "args": ["run", "-i", "--rm", "context7-mcp"], 346 | "transportType": "stdio" 347 | } 348 | } 349 | } 350 | ``` 351 | 352 | _注意:這是範例設定。請參考前述各 MCP 客戶端(如 Cursor、VS Code 等)的範例調整結構(如 `mcpServers` 與 `servers`)。同時確保 `args` 中的映像名稱與 `docker build` 使用的標籤一致。_ 353 | 354 | </details> 355 | 356 | <details> 357 | <summary><b>在 Windows 安裝</b></summary> 358 | 359 | Windows 的設定與 Linux 或 macOS 略有不同(*範例以 Cline 為例*)。其他編輯器同理,請參考 `command` 與 `args` 設定。 360 | 361 | ```json 362 | { 363 | "mcpServers": { 364 | "github.com/upstash/context7-mcp": { 365 | "command": "cmd", 366 | "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], 367 | "disabled": false, 368 | "autoApprove": [] 369 | } 370 | } 371 | } 372 | ``` 373 | 374 | </details> 375 | 376 | <details> 377 | <summary><b>在 Augment Code 安裝</b></summary> 378 | 379 | 在 Augment Code 設定 Context7 MCP,請依下列步驟: 380 | 381 | 1. 按 Cmd/Ctrl Shift P 或於 Augment 面板的漢堡選單中選擇 382 | 2. 選擇 Edit Settings 383 | 3. 於 Advanced 下點選 Edit in settings.json 384 | 4. 將伺服器設定加入 `augment.advanced` 物件的 `mcpServers` 陣列 385 | 386 | ```json 387 | "augment.advanced": { 388 | "mcpServers": [ 389 | { 390 | "name": "context7", 391 | "command": "npx", 392 | "args": ["-y", "@upstash/context7-mcp"] 393 | } 394 | ] 395 | } 396 | ``` 397 | 398 | 加入 MCP 伺服器後,請重啟編輯器。如遇錯誤,請檢查語法是否有遺漏括號或逗號。 399 | 400 | </details> 401 | 402 | ## 🔧 環境變數 403 | 404 | Context7 MCP 伺服器支援下列環境變數: 405 | 406 | - `DEFAULT_MINIMUM_TOKENS`:設定文件擷取的最小 token 數(預設:10000) 407 | 408 | 範例設定: 409 | 410 | ```json 411 | { 412 | "mcpServers": { 413 | "context7": { 414 | "command": "npx", 415 | "args": ["-y", "@upstash/context7-mcp"], 416 | "env": { 417 | "DEFAULT_MINIMUM_TOKENS": "6000" 418 | } 419 | } 420 | } 421 | } 422 | ``` 423 | 424 | ## 🔨 可用工具 425 | 426 | Context7 MCP 提供下列工具供 LLM 使用: 427 | 428 | - `resolve-library-id`:將一般函式庫名稱解析為 Context7 相容的函式庫 ID。 429 | 430 | - `libraryName`(必填):要查詢的函式庫名稱 431 | 432 | - `get-library-docs`:根據 Context7 相容的函式庫 ID 取得文件。 433 | - `context7CompatibleLibraryID`(必填):Context7 相容的函式庫 ID(如 `/mongodb/docs`, `/vercel/next.js`) 434 | - `topic`(選填):聚焦於特定主題(如 "routing", "hooks") 435 | - `tokens`(選填,預設 10000):最大回傳 token 數。小於預設或 `DEFAULT_MINIMUM_TOKENS` 的值會自動提升。 436 | 437 | ## 💻 開發 438 | 439 | 複製專案並安裝依賴: 440 | 441 | ```bash 442 | bun i 443 | ``` 444 | 445 | 建置: 446 | 447 | ```bash 448 | bun run build 449 | ``` 450 | 451 | <details> 452 | <summary><b>本地設定範例</b></summary> 453 | 454 | ```json 455 | { 456 | "mcpServers": { 457 | "context7": { 458 | "command": "npx", 459 | "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"] 460 | } 461 | } 462 | } 463 | ``` 464 | 465 | </details> 466 | 467 | <details> 468 | <summary><b>使用 MCP Inspector 測試</b></summary> 469 | 470 | ```bash 471 | npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp 472 | ``` 473 | 474 | </details> 475 | 476 | ## 🚨 疑難排解 477 | 478 | <details> 479 | <summary><b>找不到模組錯誤</b></summary> 480 | 481 | 若遇到 `ERR_MODULE_NOT_FOUND`,請嘗試用 `bunx` 取代 `npx`: 482 | 483 | ```json 484 | { 485 | "mcpServers": { 486 | "context7": { 487 | "command": "bunx", 488 | "args": ["-y", "@upstash/context7-mcp"] 489 | } 490 | } 491 | } 492 | ``` 493 | 494 | 這通常能解決 `npx` 無法正確安裝或解析套件的問題。 495 | 496 | </details> 497 | 498 | <details> 499 | <summary><b>ESM 解析問題</b></summary> 500 | 501 | 若出現 `Error: Cannot find module 'uriTemplate.js'`,請嘗試加上 `--experimental-vm-modules` 參數: 502 | 503 | ```json 504 | { 505 | "mcpServers": { 506 | "context7": { 507 | "command": "npx", 508 | "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"] 509 | } 510 | } 511 | } 512 | ``` 513 | 514 | </details> 515 | 516 | <details> 517 | <summary><b>TLS/憑證問題</b></summary> 518 | 519 | 可加上 `--experimental-fetch` 參數繞過 TLS 問題: 520 | 521 | ```json 522 | { 523 | "mcpServers": { 524 | "context7": { 525 | "command": "npx", 526 | "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"] 527 | } 528 | } 529 | } 530 | ``` 531 | 532 | </details> 533 | 534 | <details> 535 | <summary><b>一般 MCP 客戶端錯誤</b></summary> 536 | 537 | 1. 嘗試加上 `@latest` 於套件名稱 538 | 2. 改用 `bunx` 取代 `npx` 539 | 3. 或改用 `deno` 540 | 4. 請確認 Node.js 版本為 v18 或以上,以支援原生 fetch 541 | 542 | </details> 543 | 544 | ## ⚠️ 免責聲明 545 | 546 | Context7 專案由社群貢獻,雖然我們致力於維持高品質,但無法保證所有函式庫文件的正確性、完整性或安全性。Context7 上的專案由各自擁有者開發與維護,非 Context7 官方。若發現可疑、不當或潛在有害內容,請於專案頁面點選「檢舉」按鈕通知我們。我們會嚴肅處理所有檢舉,並盡快審查標記內容,以維護平台的完整性與安全。使用 Context7 即表示你同意自行承擔風險。 547 | 548 | ## 🤝 與我們聯繫 549 | 550 | 歡迎追蹤與加入社群: 551 | 552 | - 📢 追蹤我們的 [X](https://x.com/contextai) 以獲取最新消息 553 | - 🌐 造訪我們的 [官方網站](https://context7.com) 554 | - 💬 加入我們的 [Discord 社群](https://upstash.com/discord) 555 | 556 | ## 📺 Context7 媒體報導 557 | 558 | - [Better Stack:「免費工具讓 Cursor 智慧提升 10 倍」](https://youtu.be/52FC3qObp9E) 559 | - [Cole Medin:「這絕對是 AI 程式助理最強 MCP 伺服器」](https://www.youtube.com/watch?v=G7gK8H6u7Rs) 560 | - [Income Stream Surfers:「Context7 + SequentialThinking MCPs:這是 AGI 嗎?」](https://www.youtube.com/watch?v=-ggvzyLpK6o) 561 | - [Julian Goldie SEO:「Context7:全新 MCP AI 代理更新」](https://www.youtube.com/watch?v=CTZm6fBYisc) 562 | - [JeredBlu:「Context 7 MCP:即時獲取文件 + VS Code 設定」](https://www.youtube.com/watch?v=-ls0D-rtET4) 563 | - [Income Stream Surfers:「Context7:將改變 AI 程式開發的新 MCP 伺服器」](https://www.youtube.com/watch?v=PS-2Azb-C3M) 564 | - [AICodeKing:「Context7 + Cline & RooCode:這個 MCP 伺服器讓 CLINE 效率提升 100 倍!」](https://www.youtube.com/watch?v=qZfENAPMnyo) 565 | - [Sean Kochel:「5 個 MCP 伺服器讓你程式開發如虎添翼(即插即用)」](https://www.youtube.com/watch?v=LqTQi8qexJM) 566 | 567 | ## ⭐ 星標歷史 568 | 569 | [](https://www.star-history.com/#upstash/context7&Date) 570 | 571 | ## 📄 授權 572 | 573 | MIT 574 | -------------------------------------------------------------------------------- /docs/adding-projects.md: -------------------------------------------------------------------------------- 1 | # Adding Projects to Context7 2 | 3 | Context7 allows you to add your favorite libraries and frameworks to help developers get up-to-date documentation directly in their coding environment. 4 | 5 | ## Quick Submission 6 | 7 | The easiest way to add a library is through our web interface: 8 | 9 | **[Submit a Library →](https://context7.com/add-library?tab=github)** 10 | 11 | Simply provide the GitHub repository URL and Context7 will automatically parse and index the project's documentation. 12 | 13 | ## Advanced Configuration with `context7.json` 14 | 15 | For more control over how Context7 parses and presents your library, you can add a `context7.json` file to the root of your repository. This file works similar to `robots.txt` and tells Context7 how to handle your project. 16 | 17 | ### Configuration Fields 18 | 19 | Here's an example `context7.json` file with all available options: 20 | 21 | ```json 22 | { 23 | "$schema": "https://context7.com/schema/context7.json", 24 | "projectTitle": "Upstash Ratelimit", 25 | "description": "Ratelimiting library based on Upstash Redis", 26 | "folders": [], 27 | "excludeFolders": ["src"], 28 | "excludeFiles": [], 29 | "rules": ["Use Upstash Redis as a database", "Use single region set up"], 30 | "previousVersions": [ 31 | { 32 | "tag": "v1.2.1", 33 | "title": "version 1.2.1" 34 | } 35 | ] 36 | } 37 | ``` 38 | 39 | > **💡 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. 40 | 41 | #### Field Descriptions 42 | 43 | - **`projectTitle`** (string): The display name for your project in Context7. This overrides the default repository name. 44 | 45 | - **`description`** (string): A brief description of what your library does. This helps coding agents understand the purpose of your project. 46 | 47 | - **`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. 48 | 49 | - **`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. 50 | 51 | - **`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. 52 | 53 | - **`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. 54 | 55 | - **`previousVersions`** (array): Information about previous versions of your library that should also be available in Context7. 56 | - **`tag`**: The Git tag or version identifier 57 | - **`title`**: Human-readable version name 58 | 59 | ### Default Exclusions 60 | 61 | If you don't specify `excludeFiles` or `excludeFolders` in your `context7.json`, Context7 uses these default patterns: 62 | 63 | #### Default Excluded Files 64 | 65 | ``` 66 | CHANGELOG.md, changelog.md, CHANGELOG.mdx, changelog.mdx 67 | LICENSE.md, license.md 68 | CODE_OF_CONDUCT.md, code_of_conduct.md 69 | ``` 70 | 71 | #### Default Excluded Folders 72 | 73 | ``` 74 | *archive*, *archived*, old, docs/old, *deprecated*, *legacy* 75 | *previous*, *outdated*, *superseded* 76 | i18n/zh*, i18n/es*, i18n/fr*, i18n/de*, i18n/ja*, i18n/ko* 77 | i18n/ru*, i18n/pt*, i18n/it*, i18n/ar*, i18n/hi*, i18n/tr* 78 | i18n/nl*, i18n/pl*, i18n/sv*, i18n/vi*, i18n/th* 79 | zh-cn, zh-tw, zh-hk, zh-mo, zh-sg 80 | ``` 81 | 82 | These defaults help ensure that coding agents receive relevant, current documentation without outdated or non-technical content. 83 | 84 | ## Who Can Add Configuration? 85 | 86 | - **Library authors**: Add `context7.json` directly to your repository 87 | - **Contributors**: Submit pull requests to add or update the configuration 88 | - **Community members**: Propose improvements to how popular libraries are parsed 89 | 90 | ## Best Practices 91 | 92 | 1. **Keep descriptions concise**: Aim for one clear sentence that explains your library's purpose to coding agents 93 | 2. **Exclude irrelevant folders**: Use `excludeFolders` to avoid indexing source code, tests, or build artifacts 94 | 3. **Add helpful rules**: Include common gotchas or best practices that coding agents should know when generating code 95 | 4. **Maintain version history**: Keep important previous versions accessible for projects that need older APIs 96 | 97 | ## Adding a Version 98 | 99 | To add a new version to your existing library: 100 | 101 | 1. **Add version to the `context7.json` file**: Update the `previousVersions` array with your new version: 102 | 103 | ```json 104 | "previousVersions": [ 105 | { 106 | "tag": "v2.0.0", 107 | "title": "version 2.0.0" 108 | } 109 | ] 110 | ``` 111 | 112 | > **Note**: The `tag` value must exactly match an existing Git tag in your GitHub repository. 113 | 114 | 2. **Refresh your library**: Go to your library page on Context7 and trigger a refresh to index the new version. 115 | 116 | ## Need Help? 117 | 118 | 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. 119 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | import tseslint from "typescript-eslint"; 2 | import eslintPluginPrettier from "eslint-plugin-prettier"; 3 | 4 | export default tseslint.config({ 5 | // Base ESLint configuration 6 | ignores: ["node_modules/**", "build/**", "dist/**", ".git/**", ".github/**"], 7 | languageOptions: { 8 | ecmaVersion: 2020, 9 | sourceType: "module", 10 | parser: tseslint.parser, 11 | parserOptions: {}, 12 | globals: { 13 | // Add Node.js globals 14 | process: "readonly", 15 | require: "readonly", 16 | module: "writable", 17 | console: "readonly", 18 | }, 19 | }, 20 | // Settings for all files 21 | linterOptions: { 22 | reportUnusedDisableDirectives: true, 23 | }, 24 | // Apply ESLint recommended rules 25 | extends: [tseslint.configs.recommended], 26 | plugins: { 27 | prettier: eslintPluginPrettier, 28 | }, 29 | rules: { 30 | // TypeScript rules 31 | "@typescript-eslint/explicit-module-boundary-types": "off", 32 | "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], 33 | "@typescript-eslint/no-explicit-any": "warn", 34 | // Prettier integration 35 | "prettier/prettier": "error", 36 | }, 37 | }); 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@upstash/context7-mcp", 3 | "version": "1.0.0", 4 | "description": "MCP server for Context7", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "build": "tsc && chmod 755 dist/index.js", 8 | "format": "prettier --write .", 9 | "lint": "eslint \"**/*.{js,ts,tsx}\" --fix", 10 | "lint:check": "eslint \"**/*.{js,ts,tsx}\"", 11 | "start": "node dist/index.js --transport http" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/upstash/context7.git" 16 | }, 17 | "keywords": [ 18 | "modelcontextprotocol", 19 | "mcp", 20 | "context7" 21 | ], 22 | "author": "abdush", 23 | "license": "MIT", 24 | "type": "module", 25 | "bin": { 26 | "context7-mcp": "dist/index.js" 27 | }, 28 | "files": [ 29 | "dist" 30 | ], 31 | "bugs": { 32 | "url": "https://github.com/upstash/context7/issues" 33 | }, 34 | "homepage": "https://github.com/upstash/context7#readme", 35 | "dependencies": { 36 | "@modelcontextprotocol/sdk": "^1.12.0", 37 | "commander": "^14.0.0", 38 | "zod": "^3.24.2" 39 | }, 40 | "devDependencies": { 41 | "@types/node": "^22.13.14", 42 | "@typescript-eslint/eslint-plugin": "^8.28.0", 43 | "@typescript-eslint/parser": "^8.28.0", 44 | "eslint": "^9.23.0", 45 | "eslint-config-prettier": "^10.1.1", 46 | "eslint-plugin-prettier": "^5.2.5", 47 | "prettier": "^3.5.3", 48 | "typescript": "^5.8.2", 49 | "typescript-eslint": "^8.28.0" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /prettier.config.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('prettier').Config} 3 | */ 4 | const config = { 5 | endOfLine: "lf", 6 | singleQuote: false, 7 | tabWidth: 2, 8 | trailingComma: "es5", 9 | printWidth: 100, 10 | arrowParens: "always", 11 | }; 12 | 13 | export default config; 14 | -------------------------------------------------------------------------------- /schema/context7.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://context7.com/schema/context7.json", 4 | "title": "Context7 Configuration Schema", 5 | "description": "Configuration file for Context7 project parsing and documentation generation", 6 | "type": "object", 7 | "properties": { 8 | "projectTitle": { 9 | "type": "string", 10 | "description": "The display name for your project in Context7. This overrides the default repository name.", 11 | "minLength": 1, 12 | "maxLength": 100, 13 | "examples": ["Upstash Ratelimit", "Next.js", "React Query"] 14 | }, 15 | "description": { 16 | "type": "string", 17 | "description": "A brief description of what your library does. This helps coding agents understand the purpose of your project.", 18 | "minLength": 10, 19 | "maxLength": 200, 20 | "examples": [ 21 | "Ratelimiting library based on Upstash Redis", 22 | "The React Framework for Production", 23 | "Powerful data synchronization for React" 24 | ] 25 | }, 26 | "folders": { 27 | "type": "array", 28 | "description": "Specific folder paths to include when parsing documentation. If empty, Context7 will scan the entire repository. Supports regex patterns and requires full paths.", 29 | "items": { 30 | "type": "string", 31 | "minLength": 1 32 | }, 33 | "uniqueItems": true, 34 | "default": [], 35 | "examples": [ 36 | ["docs", "guides", "examples"], 37 | ["documentation/**"], 38 | ["api-reference", "tutorials/*"] 39 | ] 40 | }, 41 | "excludeFolders": { 42 | "type": "array", 43 | "description": "Folder paths to exclude from documentation parsing. Supports regex patterns and requires full paths.", 44 | "items": { 45 | "type": "string", 46 | "minLength": 1 47 | }, 48 | "uniqueItems": true, 49 | "default": [], 50 | "examples": [ 51 | ["src", "build", "node_modules"], 52 | ["**/test/**", "**/tests/**"], 53 | ["legacy/*", "archive"] 54 | ] 55 | }, 56 | "excludeFiles": { 57 | "type": "array", 58 | "description": "Specific file names to exclude from documentation parsing. Only include the filename (not the path). Regex patterns are not supported.", 59 | "items": { 60 | "type": "string", 61 | "minLength": 1, 62 | "pattern": "^[^/\\\\]+quot; 63 | }, 64 | "uniqueItems": true, 65 | "default": [], 66 | "examples": [ 67 | ["CHANGELOG.md", "LICENSE"], 68 | ["README-dev.md", "CONTRIBUTING.md"], 69 | ["package.json", "tsconfig.json"] 70 | ] 71 | }, 72 | "rules": { 73 | "type": "array", 74 | "description": "Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context.", 75 | "items": { 76 | "type": "string", 77 | "minLength": 5, 78 | "maxLength": 200 79 | }, 80 | "default": [], 81 | "examples": [ 82 | ["Always use TypeScript for better type safety"], 83 | ["Use Upstash Redis as a database", "Use single region set up"], 84 | ["Import components from the main package", "Follow the naming conventions"] 85 | ] 86 | }, 87 | "previousVersions": { 88 | "type": "array", 89 | "description": "Information about previous versions of your library that should also be available in Context7.", 90 | "items": { 91 | "type": "object", 92 | "properties": { 93 | "tag": { 94 | "type": "string", 95 | "description": "The Git tag or version identifier", 96 | "pattern": "^v?\\d+\\.\\d+\\.\\d+", 97 | "examples": ["v1.2.1", "2.0.0", "v3.1.0-beta.1"] 98 | }, 99 | "title": { 100 | "type": "string", 101 | "description": "Human-readable version name", 102 | "minLength": 1, 103 | "maxLength": 50, 104 | "examples": ["version 1.2.1", "Legacy Version", "Beta Release"] 105 | } 106 | }, 107 | "required": ["tag", "title"], 108 | "additionalProperties": false 109 | }, 110 | "default": [] 111 | } 112 | }, 113 | "additionalProperties": false, 114 | "examples": [ 115 | { 116 | "projectTitle": "Upstash Ratelimit", 117 | "description": "Ratelimiting library based on Upstash Redis", 118 | "folders": [], 119 | "excludeFolders": ["src"], 120 | "excludeFiles": [], 121 | "rules": ["Use Upstash Redis as a database", "Use single region set up"], 122 | "previousVersions": [ 123 | { 124 | "tag": "v1.2.1", 125 | "title": "version 1.2.1" 126 | } 127 | ] 128 | } 129 | ] 130 | } 131 | -------------------------------------------------------------------------------- /smithery.yaml: -------------------------------------------------------------------------------- 1 | # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml 2 | 3 | startCommand: 4 | type: http 5 | configSchema: 6 | # JSON Schema defining the configuration options for the MCP. 7 | type: object 8 | description: No configuration required 9 | exampleConfig: {} 10 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; 4 | import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; 5 | import { z } from "zod"; 6 | import { searchLibraries, fetchLibraryDocumentation } from "./lib/api.js"; 7 | import { formatSearchResults } from "./lib/utils.js"; 8 | import { SearchResponse } from "./lib/types.js"; 9 | import { createServer } from "http"; 10 | import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; 11 | import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"; 12 | import { Command } from "commander"; 13 | 14 | const DEFAULT_MINIMUM_TOKENS = 10000; 15 | 16 | // Parse CLI arguments using commander 17 | const program = new Command() 18 | .option("--transport <stdio|http|sse>", "transport type", "stdio") 19 | .option("--port <number>", "port for HTTP/SSE transport", "3000") 20 | .allowUnknownOption() // let MCP Inspector / other wrappers pass through extra flags 21 | .parse(process.argv); 22 | 23 | const cliOptions = program.opts<{ 24 | transport: string; 25 | port: string; 26 | }>(); 27 | 28 | // Validate transport option 29 | const allowedTransports = ["stdio", "http", "sse"]; 30 | if (!allowedTransports.includes(cliOptions.transport)) { 31 | console.error( 32 | `Invalid --transport value: '${cliOptions.transport}'. Must be one of: stdio, http, sse.` 33 | ); 34 | process.exit(1); 35 | } 36 | 37 | // Transport configuration 38 | const TRANSPORT_TYPE = (cliOptions.transport || "stdio") as "stdio" | "http" | "sse"; 39 | 40 | // HTTP/SSE port configuration 41 | const CLI_PORT = (() => { 42 | const parsed = parseInt(cliOptions.port, 10); 43 | return isNaN(parsed) ? undefined : parsed; 44 | })(); 45 | 46 | // Store SSE transports by session ID 47 | const sseTransports: Record<string, SSEServerTransport> = {}; 48 | 49 | // Function to create a new server instance with all tools registered 50 | function createServerInstance() { 51 | const server = new McpServer( 52 | { 53 | name: "Context7", 54 | version: "1.0.13", 55 | }, 56 | { 57 | instructions: 58 | "Use this server to retrieve up-to-date documentation and code examples for any library.", 59 | } 60 | ); 61 | 62 | // Register Context7 tools 63 | server.tool( 64 | "resolve-library-id", 65 | `Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries. 66 | 67 | 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. 68 | 69 | Selection Process: 70 | 1. Analyze the query to understand what library/package the user is looking for 71 | 2. Return the most relevant match based on: 72 | - Name similarity to the query (exact matches prioritized) 73 | - Description relevance to the query's intent 74 | - Documentation coverage (prioritize libraries with higher Code Snippet counts) 75 | - Trust score (consider libraries with scores of 7-10 more authoritative) 76 | 77 | Response Format: 78 | - Return the selected library ID in a clearly marked section 79 | - Provide a brief explanation for why this library was chosen 80 | - If multiple good matches exist, acknowledge this but proceed with the most relevant one 81 | - If no good matches exist, clearly state this and suggest query refinements 82 | 83 | For ambiguous queries, request clarification before proceeding with a best-guess match.`, 84 | { 85 | libraryName: z 86 | .string() 87 | .describe("Library name to search for and retrieve a Context7-compatible library ID."), 88 | }, 89 | async ({ libraryName }) => { 90 | const searchResponse: SearchResponse = await searchLibraries(libraryName); 91 | 92 | if (!searchResponse.results || searchResponse.results.length === 0) { 93 | return { 94 | content: [ 95 | { 96 | type: "text", 97 | text: searchResponse.error 98 | ? searchResponse.error 99 | : "Failed to retrieve library documentation data from Context7", 100 | }, 101 | ], 102 | }; 103 | } 104 | 105 | const resultsText = formatSearchResults(searchResponse); 106 | 107 | return { 108 | content: [ 109 | { 110 | type: "text", 111 | text: `Available Libraries (top matches): 112 | 113 | Each result includes: 114 | - Library ID: Context7-compatible identifier (format: /org/project) 115 | - Name: Library or package name 116 | - Description: Short summary 117 | - Code Snippets: Number of available code examples 118 | - Trust Score: Authority indicator 119 | - Versions: List of versions if available. Use one of those versions if and only if the user explicitly provides a version in their query. 120 | 121 | For best results, select libraries based on name match, trust score, snippet coverage, and relevance to your use case. 122 | 123 | ---------- 124 | 125 | ${resultsText}`, 126 | }, 127 | ], 128 | }; 129 | } 130 | ); 131 | 132 | server.tool( 133 | "get-library-docs", 134 | "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.", 135 | { 136 | context7CompatibleLibraryID: z 137 | .string() 138 | .describe( 139 | "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'." 140 | ), 141 | topic: z 142 | .string() 143 | .optional() 144 | .describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."), 145 | tokens: z 146 | .preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number()) 147 | .transform((val) => (val < DEFAULT_MINIMUM_TOKENS ? DEFAULT_MINIMUM_TOKENS : val)) 148 | .optional() 149 | .describe( 150 | `Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.` 151 | ), 152 | }, 153 | async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => { 154 | const fetchDocsResponse = await fetchLibraryDocumentation(context7CompatibleLibraryID, { 155 | tokens, 156 | topic, 157 | }); 158 | 159 | if (!fetchDocsResponse) { 160 | return { 161 | content: [ 162 | { 163 | type: "text", 164 | text: "Documentation not found or not finalized for this library. This might have happened because you used an invalid Context7-compatible library ID. To get a valid Context7-compatible library ID, use the 'resolve-library-id' with the package name you wish to retrieve documentation for.", 165 | }, 166 | ], 167 | }; 168 | } 169 | 170 | return { 171 | content: [ 172 | { 173 | type: "text", 174 | text: fetchDocsResponse, 175 | }, 176 | ], 177 | }; 178 | } 179 | ); 180 | 181 | return server; 182 | } 183 | 184 | async function main() { 185 | const transportType = TRANSPORT_TYPE; 186 | 187 | if (transportType === "http" || transportType === "sse") { 188 | // Get initial port from environment or use default 189 | const initialPort = CLI_PORT ?? 3000; 190 | // Keep track of which port we end up using 191 | let actualPort = initialPort; 192 | const httpServer = createServer(async (req, res) => { 193 | const url = new URL(req.url || "", `http://${req.headers.host}`).pathname; 194 | 195 | // Set CORS headers for all responses 196 | res.setHeader("Access-Control-Allow-Origin", "*"); 197 | res.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,DELETE"); 198 | res.setHeader("Access-Control-Allow-Headers", "Content-Type, MCP-Session-Id, mcp-session-id"); 199 | 200 | // Handle preflight OPTIONS requests 201 | if (req.method === "OPTIONS") { 202 | res.writeHead(200); 203 | res.end(); 204 | return; 205 | } 206 | 207 | try { 208 | // Create new server instance for each request 209 | const requestServer = createServerInstance(); 210 | 211 | if (url === "/mcp") { 212 | const transport = new StreamableHTTPServerTransport({ 213 | sessionIdGenerator: undefined, 214 | }); 215 | await requestServer.connect(transport); 216 | await transport.handleRequest(req, res); 217 | } else if (url === "/sse" && req.method === "GET") { 218 | // Create new SSE transport for GET request 219 | const sseTransport = new SSEServerTransport("/messages", res); 220 | // Store the transport by session ID 221 | sseTransports[sseTransport.sessionId] = sseTransport; 222 | // Clean up transport when connection closes 223 | res.on("close", () => { 224 | delete sseTransports[sseTransport.sessionId]; 225 | }); 226 | await requestServer.connect(sseTransport); 227 | } else if (url === "/messages" && req.method === "POST") { 228 | // Get session ID from query parameters 229 | const sessionId = 230 | new URL(req.url || "", `http://${req.headers.host}`).searchParams.get("sessionId") ?? 231 | ""; 232 | 233 | if (!sessionId) { 234 | res.writeHead(400); 235 | res.end("Missing sessionId parameter"); 236 | return; 237 | } 238 | 239 | // Get existing transport for this session 240 | const sseTransport = sseTransports[sessionId]; 241 | if (!sseTransport) { 242 | res.writeHead(400); 243 | res.end(`No transport found for sessionId: ${sessionId}`); 244 | return; 245 | } 246 | 247 | // Handle the POST message with the existing transport 248 | await sseTransport.handlePostMessage(req, res); 249 | } else if (url === "/ping") { 250 | res.writeHead(200, { "Content-Type": "text/plain" }); 251 | res.end("pong"); 252 | } else { 253 | res.writeHead(404); 254 | res.end("Not found"); 255 | } 256 | } catch (error) { 257 | console.error("Error handling request:", error); 258 | if (!res.headersSent) { 259 | res.writeHead(500); 260 | res.end("Internal Server Error"); 261 | } 262 | } 263 | }); 264 | 265 | // Function to attempt server listen with port fallback 266 | const startServer = (port: number, maxAttempts = 10) => { 267 | httpServer.once("error", (err: NodeJS.ErrnoException) => { 268 | if (err.code === "EADDRINUSE" && port < initialPort + maxAttempts) { 269 | console.warn(`Port ${port} is in use, trying port ${port + 1}...`); 270 | startServer(port + 1, maxAttempts); 271 | } else { 272 | console.error(`Failed to start server: ${err.message}`); 273 | process.exit(1); 274 | } 275 | }); 276 | 277 | httpServer.listen(port, () => { 278 | actualPort = port; 279 | console.error( 280 | `Context7 Documentation MCP Server running on ${transportType.toUpperCase()} at http://localhost:${actualPort}/mcp and legacy SSE at /sse` 281 | ); 282 | }); 283 | }; 284 | 285 | // Start the server with initial port 286 | startServer(initialPort); 287 | } else { 288 | // Stdio transport - this is already stateless by nature 289 | const server = createServerInstance(); 290 | const transport = new StdioServerTransport(); 291 | await server.connect(transport); 292 | console.error("Context7 Documentation MCP Server running on stdio"); 293 | } 294 | } 295 | 296 | main().catch((error) => { 297 | console.error("Fatal error in main():", error); 298 | process.exit(1); 299 | }); 300 | -------------------------------------------------------------------------------- /src/lib/api.ts: -------------------------------------------------------------------------------- 1 | import { SearchResponse } from "./types.js"; 2 | 3 | const CONTEXT7_API_BASE_URL = "https://context7.com/api"; 4 | const DEFAULT_TYPE = "txt"; 5 | 6 | /** 7 | * Searches for libraries matching the given query 8 | * @param query The search query 9 | * @returns Search results or null if the request fails 10 | */ 11 | export async function searchLibraries(query: string): Promise<SearchResponse> { 12 | try { 13 | const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/search`); 14 | url.searchParams.set("query", query); 15 | const response = await fetch(url); 16 | if (!response.ok) { 17 | const errorCode = response.status; 18 | if (errorCode === 429) { 19 | console.error(`Rate limited due to too many requests. Please try again later.`); 20 | return { 21 | results: [], 22 | error: `Rate limited due to too many requests. Please try again later.`, 23 | } as SearchResponse; 24 | } 25 | console.error(`Failed to search libraries. Please try again later. Error code: ${errorCode}`); 26 | return { 27 | results: [], 28 | error: `Failed to search libraries. Please try again later. Error code: ${errorCode}`, 29 | } as SearchResponse; 30 | } 31 | return await response.json(); 32 | } catch (error) { 33 | console.error("Error searching libraries:", error); 34 | return { results: [], error: `Error searching libraries: ${error}` } as SearchResponse; 35 | } 36 | } 37 | 38 | /** 39 | * Fetches documentation context for a specific library 40 | * @param libraryId The library ID to fetch documentation for 41 | * @param options Options for the request 42 | * @returns The documentation text or null if the request fails 43 | */ 44 | export async function fetchLibraryDocumentation( 45 | libraryId: string, 46 | options: { 47 | tokens?: number; 48 | topic?: string; 49 | } = {} 50 | ): Promise<string | null> { 51 | try { 52 | if (libraryId.startsWith("/")) { 53 | libraryId = libraryId.slice(1); 54 | } 55 | const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/${libraryId}`); 56 | if (options.tokens) url.searchParams.set("tokens", options.tokens.toString()); 57 | if (options.topic) url.searchParams.set("topic", options.topic); 58 | url.searchParams.set("type", DEFAULT_TYPE); 59 | const response = await fetch(url, { 60 | headers: { 61 | "X-Context7-Source": "mcp-server", 62 | }, 63 | }); 64 | if (!response.ok) { 65 | const errorCode = response.status; 66 | if (errorCode === 429) { 67 | const errorMessage = `Rate limited due to too many requests. Please try again later.`; 68 | console.error(errorMessage); 69 | return errorMessage; 70 | } 71 | const errorMessage = `Failed to fetch documentation. Please try again later. Error code: ${errorCode}`; 72 | console.error(errorMessage); 73 | return errorMessage; 74 | } 75 | const text = await response.text(); 76 | if (!text || text === "No content available" || text === "No context data available") { 77 | return null; 78 | } 79 | return text; 80 | } catch (error) { 81 | const errorMessage = `Error fetching library documentation. Please try again later. ${error}`; 82 | console.error(errorMessage); 83 | return errorMessage; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/lib/types.ts: -------------------------------------------------------------------------------- 1 | export interface SearchResult { 2 | id: string; 3 | title: string; 4 | description: string; 5 | branch: string; 6 | lastUpdateDate: string; 7 | state: DocumentState; 8 | totalTokens: number; 9 | totalSnippets: number; 10 | totalPages: number; 11 | stars?: number; 12 | trustScore?: number; 13 | versions?: string[]; 14 | } 15 | 16 | export interface SearchResponse { 17 | error?: string; 18 | results: SearchResult[]; 19 | } 20 | 21 | // Version state is still needed for validating search results 22 | export type DocumentState = "initial" | "finalized" | "error" | "delete"; 23 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { SearchResponse, SearchResult } from "./types.js"; 2 | 3 | /** 4 | * Formats a search result into a human-readable string representation. 5 | * Only shows code snippet count and GitHub stars when available (not equal to -1). 6 | * 7 | * @param result The SearchResult object to format 8 | * @returns A formatted string with library information 9 | */ 10 | export function formatSearchResult(result: SearchResult): string { 11 | // Always include these basic details 12 | const formattedResult = [ 13 | `- Title: ${result.title}`, 14 | `- Context7-compatible library ID: ${result.id}`, 15 | `- Description: ${result.description}`, 16 | ]; 17 | 18 | // Only add code snippets count if it's a valid value 19 | if (result.totalSnippets !== -1 && result.totalSnippets !== undefined) { 20 | formattedResult.push(`- Code Snippets: ${result.totalSnippets}`); 21 | } 22 | 23 | // Only add trust score if it's a valid value 24 | if (result.trustScore !== -1 && result.trustScore !== undefined) { 25 | formattedResult.push(`- Trust Score: ${result.trustScore}`); 26 | } 27 | 28 | // Only add versions if it's a valid value 29 | if (result.versions !== undefined && result.versions.length > 0) { 30 | formattedResult.push(`- Versions: ${result.versions.join(", ")}`); 31 | } 32 | 33 | // Join all parts with newlines 34 | return formattedResult.join("\n"); 35 | } 36 | 37 | /** 38 | * Formats a search response into a human-readable string representation. 39 | * Each result is formatted using formatSearchResult. 40 | * 41 | * @param searchResponse The SearchResponse object to format 42 | * @returns A formatted string with search results 43 | */ 44 | export function formatSearchResults(searchResponse: SearchResponse): string { 45 | if (!searchResponse.results || searchResponse.results.length === 0) { 46 | return "No documentation libraries found matching your query."; 47 | } 48 | 49 | const formattedResults = searchResponse.results.map(formatSearchResult); 50 | return formattedResults.join("\n----------\n"); 51 | } 52 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "Node16", 5 | "moduleResolution": "Node16", 6 | "outDir": "./dist", 7 | "rootDir": "./src", 8 | "strict": true, 9 | "esModuleInterop": true, 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["src/**/*"], 14 | "exclude": ["node_modules"] 15 | } 16 | --------------------------------------------------------------------------------