mirror of
https://github.com/upstash/context7.git
synced 2025-07-08 17:43:55 +00:00
Compare commits
No commits in common. "master" and "v1.0.7" have entirely different histories.
44
.github/workflows/check.yaml
vendored
44
.github/workflows/check.yaml
vendored
@ -1,44 +0,0 @@
|
|||||||
name: Build Check
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: latest
|
|
||||||
|
|
||||||
- name: Cache dependencies
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.bun/install/cache
|
|
||||||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-bun-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Run linter
|
|
||||||
run: bun run lint:check
|
|
||||||
|
|
||||||
- name: Check formatting
|
|
||||||
run: bun run format --check
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: bun run build
|
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -14,11 +14,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set env
|
- name: Set env
|
||||||
run: |
|
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
VERSION="${GITHUB_REF##refs/*/}"
|
|
||||||
# Remove 'v' prefix if it exists
|
|
||||||
VERSION="${VERSION#v}"
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -173,4 +173,3 @@ dist
|
|||||||
|
|
||||||
# Finder (MacOS) folder config
|
# Finder (MacOS) folder config
|
||||||
.DS_Store
|
.DS_Store
|
||||||
package-lock.json
|
|
||||||
|
@ -25,8 +25,7 @@ COPY package.json ./
|
|||||||
# Install only production dependencies
|
# Install only production dependencies
|
||||||
RUN npm install --production --ignore-scripts
|
RUN npm install --production --ignore-scripts
|
||||||
|
|
||||||
# Expose HTTP port
|
# Expose no ports (stdio only)
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
# Default command using CLI flags
|
# Default command
|
||||||
CMD ["node", "dist/index.js", "--transport", "http", "--port", "8080"]
|
CMD ["node", "dist/index.js"]
|
||||||
|
21
bun.lock
21
bun.lock
@ -4,8 +4,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "context7-mcp",
|
"name": "context7-mcp",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
"@modelcontextprotocol/sdk": "^1.8.0",
|
||||||
"commander": "^14.0.0",
|
|
||||||
"zod": "^3.24.2",
|
"zod": "^3.24.2",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -48,7 +47,7 @@
|
|||||||
|
|
||||||
"@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.2", "", {}, "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ=="],
|
"@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.2", "", {}, "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ=="],
|
||||||
|
|
||||||
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.12.1", "", { "dependencies": { "ajv": "^6.12.6", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-KG1CZhZfWg+u8pxeM/mByJDScJSrjjxLc8fwQqbsS8xCjBmQfMNEBTotYdNanKekepnfRI85GtgQlctLFpcYPw=="],
|
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.8.0", "", { "dependencies": { "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.3", "eventsource": "^3.0.2", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^4.1.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-e06W7SwrontJDHwCawNO5SGxG+nU9AAx+jpHHZqGl/WrDBdWOpvirC+s58VpJTB5QemI4jTRcjWT4Pt3Q1NPQQ=="],
|
||||||
|
|
||||||
"@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],
|
"@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],
|
||||||
|
|
||||||
@ -114,8 +113,6 @@
|
|||||||
|
|
||||||
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
||||||
|
|
||||||
"commander": ["commander@14.0.0", "", {}, "sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA=="],
|
|
||||||
|
|
||||||
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
|
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
|
||||||
|
|
||||||
"content-disposition": ["content-disposition@1.0.0", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg=="],
|
"content-disposition": ["content-disposition@1.0.0", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg=="],
|
||||||
@ -320,7 +317,7 @@
|
|||||||
|
|
||||||
"picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
"picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||||
|
|
||||||
"pkce-challenge": ["pkce-challenge@5.0.0", "", {}, "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ=="],
|
"pkce-challenge": ["pkce-challenge@4.1.0", "", {}, "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ=="],
|
||||||
|
|
||||||
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
|
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
|
||||||
|
|
||||||
@ -420,16 +417,28 @@
|
|||||||
|
|
||||||
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
||||||
|
|
||||||
|
"@eslint/config-array/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||||
|
|
||||||
|
"@eslint/eslintrc/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||||
|
|
||||||
"@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="],
|
"@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="],
|
||||||
|
|
||||||
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
||||||
|
|
||||||
|
"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
|
||||||
|
|
||||||
"body-parser/qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
|
"body-parser/qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
|
||||||
|
|
||||||
|
"espree/eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
|
||||||
|
|
||||||
"express/debug": ["debug@4.3.6", "", { "dependencies": { "ms": "2.1.2" } }, "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg=="],
|
"express/debug": ["debug@4.3.6", "", { "dependencies": { "ms": "2.1.2" } }, "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg=="],
|
||||||
|
|
||||||
"fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
"fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
||||||
|
|
||||||
|
"@eslint/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
|
||||||
|
|
||||||
|
"@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
|
||||||
|
|
||||||
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
|
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
|
||||||
|
|
||||||
"express/debug/ms": ["ms@2.1.2", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],
|
"express/debug/ms": ["ms@2.1.2", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],
|
||||||
|
@ -1,321 +0,0 @@
|
|||||||
# Context7 MCP - توثيق أكواد محدث لأي أمر برمجي
|
|
||||||
|
|
||||||
[](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)
|
|
||||||
|
|
||||||
## ❌ بدون Context7
|
|
||||||
|
|
||||||
تعتمد النماذج اللغوية الكبيرة على معلومات قديمة أو عامة حول المكتبات التي تستخدمها. مما يؤدي إلى:
|
|
||||||
|
|
||||||
- ❌ أمثلة أكواد قديمة مبنية على بيانات تدريب مضى عليها وقت طويل
|
|
||||||
- ❌ واجهات برمجة تطبيقات وهمية غير موجودة
|
|
||||||
- ❌ إجابات عامة لنسخ قديمة من الحزم
|
|
||||||
|
|
||||||
## ✅ مع Context7
|
|
||||||
|
|
||||||
يستخرج Context7 MCP التوثيق والأمثلة البرمجية المحدثة مباشرة من المصدر — ويضعها في طلبك للنموذج.
|
|
||||||
|
|
||||||
أضف `use context7` إلى طلبك في Cursor:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
أنشئ مشروع Next.js بسيط باستخدام app router. use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
```txt
|
|
||||||
أنشئ سكربت لحذف الصفوف التي تكون فيها المدينة فارغة "" باستخدام بيانات اعتماد PostgreSQL. use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
يقوم Context7 بجلب الأمثلة المحدثة والتوثيق المناسب مباشرة إلى السياق.
|
|
||||||
|
|
||||||
- 1️⃣ اكتب طلبك بشكل طبيعي
|
|
||||||
- 2️⃣ أخبر النموذج بـ `use context7`
|
|
||||||
- 3️⃣ احصل على أكواد تعمل مباشرة
|
|
||||||
|
|
||||||
لا حاجة للتنقل بين التبويبات، لا واجهات برمجة تطبيقات وهمية، لا أكواد قديمة.
|
|
||||||
|
|
||||||
## 🛠️ البدء
|
|
||||||
|
|
||||||
### المتطلبات
|
|
||||||
|
|
||||||
- Node.js إصدار 18.0.0 أو أعلى
|
|
||||||
- Cursor، Windsurf، Claude Desktop أو أي عميل MCP آخر
|
|
||||||
|
|
||||||
### التثبيت عبر Smithery
|
|
||||||
|
|
||||||
لتثبيت Context7 MCP Server تلقائيًا لـ Claude Desktop:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في Cursor
|
|
||||||
|
|
||||||
اذهب إلى: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
|
|
||||||
|
|
||||||
أو أضف هذا إلى ملف `~/.cursor/mcp.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت باستخدام Bun
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت باستخدام Deno
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "deno",
|
|
||||||
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في Windsurf
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في VS Code
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"servers": {
|
|
||||||
"Context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في Zed
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"context_servers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": {
|
|
||||||
"path": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
},
|
|
||||||
"settings": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في Claude Code
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في Claude Desktop
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في BoltAI
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### باستخدام Docker
|
|
||||||
|
|
||||||
**Dockerfile:**
|
|
||||||
|
|
||||||
```Dockerfile
|
|
||||||
FROM node:18-alpine
|
|
||||||
WORKDIR /app
|
|
||||||
RUN npm install -g @upstash/context7-mcp@latest
|
|
||||||
CMD ["context7-mcp"]
|
|
||||||
```
|
|
||||||
|
|
||||||
**بناء الصورة:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t context7-mcp .
|
|
||||||
```
|
|
||||||
|
|
||||||
**التهيئة داخل العميل:**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": "docker",
|
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
|
||||||
"transportType": "stdio"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### التثبيت في Windows
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### المتغيرات البيئية
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"env": {
|
|
||||||
"DEFAULT_MINIMUM_TOKENS": "10000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### الأدوات المتوفرة
|
|
||||||
|
|
||||||
- `resolve-library-id`: يحول اسم مكتبة عام إلى معرف متوافق مع Context7.
|
|
||||||
- `get-library-docs`: يستخرج التوثيق حسب المعرف.
|
|
||||||
|
|
||||||
- `context7CompatibleLibraryID`: مطلوب
|
|
||||||
- `topic`: موضوع معين مثل "routing"
|
|
||||||
- `tokens`: الحد الأعلى لعدد الرموز
|
|
||||||
|
|
||||||
## التطوير
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun i
|
|
||||||
bun run build
|
|
||||||
```
|
|
||||||
|
|
||||||
**التهيئة المحلية:**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**الاختبار باستخدام MCP Inspector:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## استكشاف الأخطاء
|
|
||||||
|
|
||||||
### ERR_MODULE_NOT_FOUND
|
|
||||||
|
|
||||||
استخدم `bunx` بدلاً من `npx`.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### مشاكل في ESM
|
|
||||||
|
|
||||||
جرّب إضافة:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### أخطاء عميل MCP
|
|
||||||
|
|
||||||
1. أزل `@latest`
|
|
||||||
2. جرّب `bunx`
|
|
||||||
3. جرّب `deno`
|
|
||||||
4. تأكد أنك تستخدم Node v18 أو أحدث
|
|
||||||
|
|
||||||
## إخلاء مسؤولية
|
|
||||||
|
|
||||||
المشاريع المدرجة في Context7 مساهم بها من المجتمع، ولا يمكن ضمان دقتها أو أمانها بشكل كامل. الرجاء الإبلاغ عن أي محتوى مريب باستخدام زر "الإبلاغ".
|
|
||||||
|
|
||||||
## Context7 في الإعلام
|
|
||||||
|
|
||||||
- [Better Stack: "أداة مجانية تجعل Cursor أذكى 10x"](https://youtu.be/52FC3qObp9E)
|
|
||||||
- [Cole Medin: "أفضل MCP Server لمساعدين الذكاء الاصطناعي البرمجيين"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
|
||||||
- [Context7 + SequentialThinking: هل هذا AGI؟](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
|
||||||
- [تحديث جديد من Context7 MCP](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
|
||||||
- [إعداد Context7 في VS Code](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
|
||||||
- [Context7: MCP جديد سيغير البرمجة](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
|
||||||
- [Cline & RooCode + Context7: قوة مضاعفة](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [أفضل 5 MCP Servers لتجربة برمجة ساحرة](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## سجل النجوم
|
|
||||||
|
|
||||||
[](https://www.star-history.com/#upstash/context7&Date)
|
|
||||||
|
|
||||||
## الترخيص
|
|
||||||
|
|
||||||
MIT
|
|
@ -209,15 +209,15 @@ Wenn du den MCP-Server lieber in einem Docker-Container ausführen möchtest:
|
|||||||
|
|
||||||
Aktualisiere die Konfiguration deines MCP-Clients, um den Docker-Befehl zu verwenden.
|
Aktualisiere die Konfiguration deines MCP-Clients, um den Docker-Befehl zu verwenden.
|
||||||
|
|
||||||
_Beispiel für eine cline_mcp_settings.json:_
|
*Beispiel für eine cline_mcp_settings.json:*
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Сontext7": {
|
"Сontext7": {
|
||||||
"autoApprove": [],
|
"autoApprove": [],
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"command": "docker",
|
"command": "docker",
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
"args": ["run", "-i", "--rm", "context7-mcp"],
|
||||||
"transportType": "stdio"
|
"transportType": "stdio"
|
||||||
@ -225,8 +225,7 @@ Wenn du den MCP-Server lieber in einem Docker-Container ausführen möchtest:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
*Hinweis: Dies ist eine Beispielkonfiguration. Bitte beziehe dich auf die spezifischen Beispiele für deinen MCP-Client (wie Cursor, VS Code usw.), die weiter oben in dieser README beschrieben sind, um die Struktur anzupassen (z.B. `mcpServers` vs `servers`). Stelle außerdem sicher, dass der Bildname in `args` mit dem beim `docker build`-Befehl verwendeten Tag übereinstimmt.*
|
||||||
_Hinweis: Dies ist eine Beispielkonfiguration. Bitte beziehe dich auf die spezifischen Beispiele für deinen MCP-Client (wie Cursor, VS Code usw.), die weiter oben in dieser README beschrieben sind, um die Struktur anzupassen (z.B. `mcpServers` vs `servers`). Stelle außerdem sicher, dass der Bildname in `args` mit dem beim `docker build`-Befehl verwendeten Tag übereinstimmt._
|
|
||||||
|
|
||||||
### Verfügbare Tools
|
### Verfügbare Tools
|
||||||
|
|
||||||
@ -298,7 +297,11 @@ Wenn du einen Fehler wie `Error: Cannot find module 'uriTemplate.js'` bekommst,
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--node-options=--experimental-vm-modules",
|
||||||
|
"@upstash/context7-mcp@1.0.6"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,7 +318,6 @@ Wenn du einen Fehler wie `Error: Cannot find module 'uriTemplate.js'` bekommst,
|
|||||||
4. Stelle sicher, dass du Node v18 oder höher verwendest, um native Fetch-Unterstützung mit `npx` zu haben.
|
4. Stelle sicher, dass du Node v18 oder höher verwendest, um native Fetch-Unterstützung mit `npx` zu haben.
|
||||||
|
|
||||||
## Haftungsausschluss
|
## Haftungsausschluss
|
||||||
|
|
||||||
Context7-Projekte werden von der Community beigetragen, und obwohl wir uns bemühen, eine hohe Qualität aufrechtzuerhalten, können wir die Genauigkeit, Vollständigkeit oder Sicherheit aller Bibliotheksdokumentationen nicht garantieren. Die in Context7 aufgeführten Projekte werden von ihren jeweiligen Eigentümern entwickelt und gepflegt, nicht von Context7. Wenn du auf verdächtige, unangemessene oder potenziell schädliche Inhalte stößt, verwende bitte die Schaltfläche "Melden" auf der Projektseite, um uns sofort zu benachrichtigen. Wir nehmen alle Berichte ernst und werden gemeldete Inhalte umgehend überprüfen, um die Integrität und Sicherheit unserer Plattform zu gewährleisten. Durch die Nutzung von Context7 erkennst du an, dass du dies nach eigenem Ermessen und auf eigenes Risiko tust.
|
Context7-Projekte werden von der Community beigetragen, und obwohl wir uns bemühen, eine hohe Qualität aufrechtzuerhalten, können wir die Genauigkeit, Vollständigkeit oder Sicherheit aller Bibliotheksdokumentationen nicht garantieren. Die in Context7 aufgeführten Projekte werden von ihren jeweiligen Eigentümern entwickelt und gepflegt, nicht von Context7. Wenn du auf verdächtige, unangemessene oder potenziell schädliche Inhalte stößt, verwende bitte die Schaltfläche "Melden" auf der Projektseite, um uns sofort zu benachrichtigen. Wir nehmen alle Berichte ernst und werden gemeldete Inhalte umgehend überprüfen, um die Integrität und Sicherheit unserer Plattform zu gewährleisten. Durch die Nutzung von Context7 erkennst du an, dass du dies nach eigenem Ermessen und auf eigenes Risiko tust.
|
||||||
|
|
||||||
## Context7 in den Medien
|
## Context7 in den Medien
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Context7 MCP - Documentation à jour pour vos prompts
|
# Context7 MCP - Documentation à jour pour vos prompts
|
||||||
|
|
||||||
[](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)
|
[](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%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)
|
||||||
|
|
||||||
## ❌ Sans Context7
|
## ❌ Sans Context7
|
||||||
|
|
||||||
@ -113,10 +113,10 @@ Ajoutez ceci à votre fichier de configuration MCP Windsurf. Voir la [documentat
|
|||||||
|
|
||||||
### Installation dans VS Code
|
### Installation dans VS Code
|
||||||
|
|
||||||
[<img alt="Installer dans VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
[<img alt="Installation dans VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
|
||||||
[<img alt="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)
|
[<img alt="Installation dans VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Installer%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
|
||||||
|
|
||||||
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.
|
Ajoutez ceci à votre fichier de configuration MCP VS Code. Voir la [documentation VS Code MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) pour plus d’informations.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -171,23 +171,6 @@ Ajoutez ceci à votre fichier `claude_desktop_config.json`. Voir la [documentati
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installation dans BoltAI
|
|
||||||
|
|
||||||
Ouvrez la page "Settings" de l'application, naviguez jusqu'à "Plugins", et entrez le JSON suivant :
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Une fois enregistré, saisissez dans le chat `get-library-docs` suivi de votre ID de documentation Context7 (par exemple, `get-library-docs /nuxt/ui`). Plus d'informations sont disponibles sur le [site de documentation BoltAI](https://docs.boltai.com/docs/plugins/mcp-servers). Pour BoltAI sur iOS, [consultez ce guide](https://docs.boltai.com/docs/boltai-mobile/mcp-servers).
|
|
||||||
|
|
||||||
### Utilisation avec Docker
|
### Utilisation avec Docker
|
||||||
|
|
||||||
Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
|
Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
|
||||||
@ -226,15 +209,15 @@ Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
|
|||||||
|
|
||||||
Mettez à jour la configuration de votre client MCP pour utiliser la commande Docker.
|
Mettez à jour la configuration de votre client MCP pour utiliser la commande Docker.
|
||||||
|
|
||||||
_Exemple pour un fichier cline_mcp_settings.json :_
|
*Exemple pour un fichier cline_mcp_settings.json :*
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Сontext7": {
|
"Сontext7": {
|
||||||
"autoApprove": [],
|
"autoApprove": [],
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"command": "docker",
|
"command": "docker",
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
"args": ["run", "-i", "--rm", "context7-mcp"],
|
||||||
"transportType": "stdio"
|
"transportType": "stdio"
|
||||||
@ -242,45 +225,7 @@ Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
*Note : Ceci est un exemple. Adaptez la structure selon votre client MCP (voir plus haut dans ce README). Assurez-vous que le nom de l’image dans `args` correspond au tag utilisé lors du build.*
|
||||||
_Note : Ceci est un exemple. Adaptez la structure selon votre client MCP (voir plus haut dans ce README). Assurez-vous que le nom de l’image dans `args` correspond au tag utilisé lors du build._
|
|
||||||
|
|
||||||
### Installation sous Windows
|
|
||||||
|
|
||||||
La configuration sous Windows est légèrement différente par rapport à Linux ou macOS (_`Cline` est utilisé dans l'exemple_). Le même principe s'applique à d'autres éditeurs; référez-vous à la configuration de `command` et `args`.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Variables d'environnement
|
|
||||||
|
|
||||||
- `DEFAULT_MINIMUM_TOKENS`: Définissez le nombre minimum de tokens pour la récupération de documentation (par défaut: 10000).
|
|
||||||
|
|
||||||
Exemples:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"env": {
|
|
||||||
"DEFAULT_MINIMUM_TOKENS": "10000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Outils disponibles
|
### Outils disponibles
|
||||||
|
|
||||||
@ -343,31 +288,11 @@ Si vous voyez cette erreur, essayez d’utiliser `bunx` à la place de `npx`.
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### Problèmes de résolution ESM
|
|
||||||
|
|
||||||
Si vous rencontrez une erreur comme : `Error: Cannot find module 'uriTemplate.js'` essayez d'exécuter avec le drapeau `--experimental-vm-modules` :
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Erreurs client MCP
|
### Erreurs client MCP
|
||||||
|
|
||||||
1. Essayez de retirer `@latest` du nom du package.
|
1. Essayez de retirer `@latest` du nom du package.
|
||||||
2. Essayez d'utiliser `bunx` comme alternative.
|
2. Essayez d’utiliser `bunx` comme alternative.
|
||||||
3. Essayez d'utiliser `deno` comme alternative.
|
3. Essayez d’utiliser `deno` comme alternative.
|
||||||
4. Assurez-vous d'utiliser Node v18 ou supérieur pour avoir le support natif de fetch avec `npx`.
|
|
||||||
|
|
||||||
## Clause de non-responsabilité
|
|
||||||
|
|
||||||
Les projets Context7 sont des contributions de la communauté, et bien que nous nous efforcions de maintenir une haute qualité, nous ne pouvons garantir l'exactitude, l'exhaustivité ou la sécurité de toute la documentation des bibliothèques. Les projets listés dans Context7 sont développés et maintenus par leurs propriétaires respectifs, et non par Context7. Si vous rencontrez un contenu suspect, inapproprié ou potentiellement nuisible, veuillez utiliser le bouton "Signaler" sur la page du projet pour nous le faire savoir immédiatement. Nous prenons tous les signalements au sérieux et examinerons rapidement les contenus signalés pour maintenir l'intégrité et la sécurité de notre plateforme. En utilisant Context7, vous reconnaissez que vous le faites à votre propre discrétion et à vos risques et périls.
|
|
||||||
|
|
||||||
## Context7 dans les médias
|
## Context7 dans les médias
|
||||||
|
|
||||||
@ -377,8 +302,6 @@ Les projets Context7 sont des contributions de la communauté, et bien que nous
|
|||||||
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
||||||
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||||
- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||||
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## Historique des stars
|
## Historique des stars
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
# Context7 MCP - Dokumentasi Ter-Update Untuk Setiap Prompt
|
# Context7 MCP - Dokumentasi Ter-Update Untuk Setiap Prompt
|
||||||
|
|
||||||
[](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)
|
[](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)
|
||||||
|
|
||||||
[](./README.zh-CN.md) [](./README.ko.md) [](./README.es.md) [](./README.fr.md) [-purple>)](./README.pt-BR.md) [](./README.id-ID.md)
|
[](./README.zh-CN.md) [](./README.ko.md) [](./README.es.md) [](./README.fr.md) [-purple)](./README.pt-BR.md) [](./README.id-ID.md)
|
||||||
|
|
||||||
## ❌ Tanpa Context7
|
## ❌ Tanpa Context7
|
||||||
|
|
||||||
LLM mengandalkan informasi yang sudah lama atau umum tentang library yang Anda gunakan, bukan yang terbaru.
|
LLM mengandalkan informasi yang sudah lama atau umum tentang library yang Anda gunakan, bukan yang terbaru.
|
||||||
|
|
||||||
Hasilnya anda akan mendapatkan:
|
Hasilnya anda akan mendapatkan:
|
||||||
|
|
||||||
- ❌ Contoh kode sudah usang dan berdasarkan data pelatihan yang sudah lama
|
- ❌ Contoh kode sudah usang dan berdasarkan data pelatihan yang sudah lama
|
||||||
- ❌ API yang dikarang yang sebetulnya tidak ada sama sekali
|
- ❌ API yang dikarang yang sebetulnya tidak ada sama sekali
|
||||||
- ❌ Jawaban umum untuk versi paket lama
|
- ❌ Jawaban umum untuk versi paket lama
|
||||||
@ -213,15 +213,15 @@ Jika Anda lebih suka menjalankan server MCP dalam kontainer Docker:
|
|||||||
|
|
||||||
Perbarui konfigurasi MCP client Anda untuk menggunakan perintah Docker.
|
Perbarui konfigurasi MCP client Anda untuk menggunakan perintah Docker.
|
||||||
|
|
||||||
_Contoh untuk cline_mcp_settings.json:_
|
*Contoh untuk cline_mcp_settings.json:*
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Сontext7": {
|
"Сontext7": {
|
||||||
"autoApprove": [],
|
"autoApprove": [],
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"command": "docker",
|
"command": "docker",
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
"args": ["run", "-i", "--rm", "context7-mcp"],
|
||||||
"transportType": "stdio"
|
"transportType": "stdio"
|
||||||
@ -229,8 +229,7 @@ Jika Anda lebih suka menjalankan server MCP dalam kontainer Docker:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
*Catatan: Ini adalah contoh konfigurasi. Silakan merujuk ke contoh spesifik untuk MCP client Anda (seperti Cursor, VS Code, dll.) sebelumnya dalam README ini untuk menyesuaikan struktur (misalnya, `mcpServers` vs `servers`). Juga, pastikan nama image di `args` cocok dengan tag yang digunakan selama perintah `docker build`.*
|
||||||
_Catatan: Ini adalah contoh konfigurasi. Silakan merujuk ke contoh spesifik untuk MCP client Anda (seperti Cursor, VS Code, dll.) sebelumnya dalam README ini untuk menyesuaikan struktur (misalnya, `mcpServers` vs `servers`). Juga, pastikan nama image di `args` cocok dengan tag yang digunakan selama perintah `docker build`._
|
|
||||||
|
|
||||||
### Alat yang Tersedia
|
### Alat yang Tersedia
|
||||||
|
|
||||||
@ -302,7 +301,11 @@ Jika Anda mengalami kesalahan seperti: `Error: Cannot find module 'uriTemplate.j
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--node-options=--experimental-vm-modules",
|
||||||
|
"@upstash/context7-mcp@1.0.6"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +322,6 @@ Jika Anda mengalami kesalahan seperti: `Error: Cannot find module 'uriTemplate.j
|
|||||||
4. Pastikan Anda menggunakan Node v18 atau lebih tinggi untuk memiliki dukungan fetch native dengan `npx`.
|
4. Pastikan Anda menggunakan Node v18 atau lebih tinggi untuk memiliki dukungan fetch native dengan `npx`.
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mempertahankan kualitas tinggi, kami tidak dapat menjamin keakuratan, kelengkapan, atau keamanan semua dokumentasi library. Proyek yang terdaftar di Context7 dikembangkan dan dikelola oleh pemiliknya masing-masing, bukan oleh Context7. Jika Anda menemukan konten yang mencurigakan, tidak pantas, atau berpotensi berbahaya, silakan gunakan tombol "Report" di halaman proyek untuk memberi tahu kami segera. Kami menganggap semua laporan dengan serius dan akan meninjau konten yang ditandai segera untuk menjaga integritas dan keamanan platform kami. Dengan menggunakan Context7, Anda mengakui bahwa Anda melakukannya atas kebijaksanaan dan risiko Anda sendiri.
|
Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mempertahankan kualitas tinggi, kami tidak dapat menjamin keakuratan, kelengkapan, atau keamanan semua dokumentasi library. Proyek yang terdaftar di Context7 dikembangkan dan dikelola oleh pemiliknya masing-masing, bukan oleh Context7. Jika Anda menemukan konten yang mencurigakan, tidak pantas, atau berpotensi berbahaya, silakan gunakan tombol "Report" di halaman proyek untuk memberi tahu kami segera. Kami menganggap semua laporan dengan serius dan akan meninjau konten yang ditandai segera untuk menjaga integritas dan keamanan platform kami. Dengan menggunakan Context7, Anda mengakui bahwa Anda melakukannya atas kebijaksanaan dan risiko Anda sendiri.
|
||||||
|
|
||||||
## Context7 Di Media
|
## Context7 Di Media
|
||||||
@ -338,3 +340,4 @@ Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mem
|
|||||||
## Lisensi
|
## Lisensi
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
[](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)
|
[](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)
|
||||||
|
|
||||||
[](./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.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)
|
||||||
|
|
||||||
|
|
||||||
## ❌ Senza Context7
|
## ❌ Senza Context7
|
||||||
|
|
||||||
@ -211,15 +212,15 @@ Se preferisci eseguire il server MCP in un contenitore Docker:
|
|||||||
|
|
||||||
Aggiorna la configurazione del tuo client MCP per utilizzare il comando Docker.
|
Aggiorna la configurazione del tuo client MCP per utilizzare il comando Docker.
|
||||||
|
|
||||||
_Esempio per un file cline_mcp_settings.json:_
|
*Esempio per un file cline_mcp_settings.json:*
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Сontext7": {
|
"Сontext7": {
|
||||||
"autoApprove": [],
|
"autoApprove": [],
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"command": "docker",
|
"command": "docker",
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
"args": ["run", "-i", "--rm", "context7-mcp"],
|
||||||
"transportType": "stdio"
|
"transportType": "stdio"
|
||||||
@ -227,8 +228,7 @@ Se preferisci eseguire il server MCP in un contenitore Docker:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
*Nota: Questa è una configurazione di esempio. Consulta gli esempi specifici per il tuo client MCP (come Cursor, VS Code, ecc.) precedentemente in questo README per adattare la struttura (ad es., `mcpServers` vs `servers`). Inoltre, assicurati che il nome dell'immagine in `args` corrisponda al tag utilizzato durante il comando `docker build`.*
|
||||||
_Nota: Questa è una configurazione di esempio. Consulta gli esempi specifici per il tuo client MCP (come Cursor, VS Code, ecc.) precedentemente in questo README per adattare la struttura (ad es., `mcpServers` vs `servers`). Inoltre, assicurati che il nome dell'immagine in `args` corrisponda al tag utilizzato durante il comando `docker build`._
|
|
||||||
|
|
||||||
### Strumenti Disponibili
|
### Strumenti Disponibili
|
||||||
|
|
||||||
@ -252,7 +252,6 @@ Compila:
|
|||||||
```bash
|
```bash
|
||||||
bun run build
|
bun run build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Esempio di Configurazione Locale
|
### Esempio di Configurazione Locale
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -300,7 +299,11 @@ Se riscontri un errore come: `Error: Cannot find module 'uriTemplate.js'` prova
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--node-options=--experimental-vm-modules",
|
||||||
|
"@upstash/context7-mcp@1.0.6"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +320,6 @@ Se riscontri un errore come: `Error: Cannot find module 'uriTemplate.js'` prova
|
|||||||
4. Assicurati di utilizzare Node v18 o superiore per avere il supporto nativo di fetch con `npx`.
|
4. Assicurati di utilizzare Node v18 o superiore per avere il supporto nativo di fetch con `npx`.
|
||||||
|
|
||||||
## Dichiarazione di non responsabilità
|
## Dichiarazione di non responsabilità
|
||||||
|
|
||||||
I progetti Context7 sono contributi della comunità e, sebbene ci impegniamo a mantenere un'alta qualità, non possiamo garantire l'accuratezza, la completezza o la sicurezza di tutta la documentazione delle librerie. I progetti elencati in Context7 sono sviluppati e gestiti dai rispettivi proprietari, non da Context7. Se riscontri contenuti sospetti, inappropriati o potenzialmente dannosi, utilizza il pulsante "Segnala" sulla pagina del progetto per informarci immediatamente. Prendiamo sul serio tutte le segnalazioni e esamineremo prontamente i contenuti segnalati per mantenere l'integrità e la sicurezza della nostra piattaforma. Utilizzando Context7, riconosci di farlo a tua discrezione e a tuo rischio.
|
I progetti Context7 sono contributi della comunità e, sebbene ci impegniamo a mantenere un'alta qualità, non possiamo garantire l'accuratezza, la completezza o la sicurezza di tutta la documentazione delle librerie. I progetti elencati in Context7 sono sviluppati e gestiti dai rispettivi proprietari, non da Context7. Se riscontri contenuti sospetti, inappropriati o potenzialmente dannosi, utilizza il pulsante "Segnala" sulla pagina del progetto per informarci immediatamente. Prendiamo sul serio tutte le segnalazioni e esamineremo prontamente i contenuti segnalati per mantenere l'integrità e la sicurezza della nostra piattaforma. Utilizzando Context7, riconosci di farlo a tua discrezione e a tuo rischio.
|
||||||
|
|
||||||
## Context7 nei Media
|
## Context7 nei Media
|
||||||
|
@ -1,690 +0,0 @@
|
|||||||
# Context7 MCP - どんなプロンプトにも最新のコードドキュメントで応える
|
|
||||||
|
|
||||||
[](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)
|
|
||||||
|
|
||||||
[](./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)
|
|
||||||
|
|
||||||
## ❌ Context7 を使わないと
|
|
||||||
|
|
||||||
LLM は使用しているライブラリに関する古い情報や一般的な情報に依存しています。その結果:
|
|
||||||
|
|
||||||
- ❌ コード例が古く、1 年前のトレーニングデータに基づいている
|
|
||||||
- ❌ 存在しない API をハルシネーションして生成する
|
|
||||||
- ❌ 古いパッケージバージョンに対する一般的な回答しか得られない
|
|
||||||
|
|
||||||
## ✅ Context7 を使うと
|
|
||||||
|
|
||||||
Context7 MCP は最新のバージョン固有のドキュメントとコード例をソースから直接取得し、プロンプトに直接配置します。
|
|
||||||
|
|
||||||
Cursor のプロンプトに `use context7` を追加するだけ:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Create a basic Next.js project with app router. use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
Context7 は最新のコード例とドキュメントを直接 LLM のコンテキストに取得します。
|
|
||||||
|
|
||||||
- 1️⃣ 普段通りにプロンプトを書く
|
|
||||||
- 2️⃣ LLM に `use context7` と指示する
|
|
||||||
- 3️⃣ 動作するコードの回答を得る
|
|
||||||
|
|
||||||
タブの切り替えも、存在しない API のハルシネーションも、古いコード生成もありません。
|
|
||||||
|
|
||||||
## 📚 プロジェクトの追加
|
|
||||||
|
|
||||||
[プロジェクト追加ガイド](./docs/adding-projects.md) をチェックして、お気に入りのライブラリを Context7 に追加(または更新)する方法を学びましょう。
|
|
||||||
|
|
||||||
## 🛠️ インストール
|
|
||||||
|
|
||||||
### 必須要件
|
|
||||||
|
|
||||||
- Node.js >= v18.0.0
|
|
||||||
- Cursor、Windsurf、Claude Desktop またはその他の MCP クライアント
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Smithery 経由でのインストール</b></summary>
|
|
||||||
|
|
||||||
[Smithery](https://smithery.ai/server/@upstash/context7-mcp) 経由で任意のクライアントに Context7 MCP サーバーを自動的にインストールするには:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
|
|
||||||
```
|
|
||||||
|
|
||||||
Smithery キーは [Smithery.ai Web ページ](https://smithery.ai/server/@upstash/context7-mcp) で確認できます。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Cursor へのインストール</b></summary>
|
|
||||||
|
|
||||||
`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server` に移動します
|
|
||||||
|
|
||||||
以下の設定を Cursor の `~/.cursor/mcp.json` ファイルに貼り付けることが推奨されます。プロジェクトフォルダに `.cursor/mcp.json` を作成することで、特定のプロジェクトにインストールすることもできます。詳細は [Cursor MCP ドキュメント](https://docs.cursor.com/context/model-context-protocol) を参照してください。
|
|
||||||
|
|
||||||
> Cursor 1.0 以降、下のインストールボタンをクリックすることで、ワンクリックで即座にインストールできます。
|
|
||||||
|
|
||||||
#### Cursor リモートサーバー接続
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Cursor ローカルサーバー接続
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>代替方法:Bun を使用</summary>
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>代替方法:Deno を使用</summary>
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "deno",
|
|
||||||
"args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Windsurf へのインストール</b></summary>
|
|
||||||
|
|
||||||
これを Windsurf MCP 設定ファイルに追加します。詳細は [Windsurf MCP ドキュメント](https://docs.windsurf.com/windsurf/mcp) を参照してください。
|
|
||||||
|
|
||||||
#### Windsurf リモートサーバー接続
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"serverUrl": "https://mcp.context7.com/sse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Windsurf ローカルサーバー接続
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>VS Code へのインストール</b></summary>
|
|
||||||
|
|
||||||
[<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
[<img alt="Install in VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
|
|
||||||
これを VS Code MCP 設定ファイルに追加します。詳細は [VS Code MCP ドキュメント](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) を参照してください。
|
|
||||||
|
|
||||||
#### VS Code リモートサーバー接続
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### VS Code ローカルサーバー接続
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Visual Studio 2022 へのインストール</b></summary>
|
|
||||||
|
|
||||||
[Visual Studio MCP サーバードキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) に従って、Visual Studio 2022 で Context7 MCP を設定できます。
|
|
||||||
|
|
||||||
これを Visual Studio MCP 設定ファイルに追加します(詳細は [Visual Studio ドキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) を参照):
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
または、ローカルサーバーの場合:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
詳細情報とトラブルシューティングについては、[Visual Studio MCP サーバードキュメント](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) を参照してください。
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Zed へのインストール</b></summary>
|
|
||||||
|
|
||||||
[Zed Extensions](https://zed.dev/extensions?query=Context7) 経由でインストールできるか、Zed の `settings.json` にこれを追加できます。詳細は [Zed Context Server ドキュメント](https://zed.dev/docs/assistant/context-servers) を参照してください。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"context_servers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": {
|
|
||||||
"path": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
},
|
|
||||||
"settings": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Claude Code へのインストール</b></summary>
|
|
||||||
|
|
||||||
このコマンドを実行します。詳細は [Claude Code MCP ドキュメント](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) を参照してください。
|
|
||||||
|
|
||||||
#### Claude Code リモートサーバー接続
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add --transport sse context7 https://mcp.context7.com/sse
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Claude Code ローカルサーバー接続
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Claude Desktop へのインストール</b></summary>
|
|
||||||
|
|
||||||
これを Claude Desktop の `claude_desktop_config.json` ファイルに追加します。詳細は [Claude Desktop MCP ドキュメント](https://modelcontextprotocol.io/quickstart/user) を参照してください。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>BoltAI へのインストール</b></summary>
|
|
||||||
|
|
||||||
アプリの "Settings" ページを開き、"Plugins" に移動し、以下の JSON を入力します:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
保存後、チャットで `get-library-docs` の後に Context7 ドキュメント ID を入力します(例:`get-library-docs /nuxt/ui`)。詳細情報は [BoltAI ドキュメンテーションサイト](https://docs.boltai.com/docs/plugins/mcp-servers) で利用可能です。iOS 版 BoltAI については、[このガイドを参照してください](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Docker を使用</b></summary>
|
|
||||||
|
|
||||||
MCP サーバーを Docker コンテナで実行したい場合:
|
|
||||||
|
|
||||||
1. **Docker イメージのビルド:**
|
|
||||||
|
|
||||||
まず、プロジェクトルート(または希望の場所)に `Dockerfile` を作成します:
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Dockerfile の内容を表示</summary>
|
|
||||||
|
|
||||||
```Dockerfile
|
|
||||||
FROM node:18-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# 最新バージョンをグローバルにインストール
|
|
||||||
RUN npm install -g @upstash/context7-mcp
|
|
||||||
|
|
||||||
# 必要に応じてデフォルトポートを公開(任意、MCP クライアントの相互作用に依存)
|
|
||||||
# EXPOSE 3000
|
|
||||||
|
|
||||||
# サーバーを実行するデフォルトコマンド
|
|
||||||
CMD ["context7-mcp"]
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
次に、タグ(例:`context7-mcp`)を使用してイメージをビルドします。**Docker Desktop(または Docker デーモン)が実行中であることを確認してください。** `Dockerfile` を保存した同じディレクトリで次のコマンドを実行します:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t context7-mcp .
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **MCP クライアントの設定:**
|
|
||||||
|
|
||||||
MCP クライアントの設定を更新して Docker コマンドを使用するようにします。
|
|
||||||
|
|
||||||
_cline_mcp_settings.json の例:_
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Сontext7": {
|
|
||||||
"autoApprove": [],
|
|
||||||
"disabled": false,
|
|
||||||
"timeout": 60,
|
|
||||||
"command": "docker",
|
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
|
||||||
"transportType": "stdio"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
_注:これは設定例です。この README の前半で MCP クライアント(Cursor、VS Code など)の具体的な例を参照して、構造(例:`mcpServers` 対 `servers`)を適応させてください。また、`args` 内のイメージ名が `docker build` コマンドで使用したタグと一致していることを確認してください。_
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Windows へのインストール</b></summary>
|
|
||||||
|
|
||||||
Windows での設定は Linux や macOS と比べて少し異なります(_例では `Cline` を使用_)。同じ原則が他のエディタにも適用されます。`command` と `args` の設定を参照してください。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Augment Code へのインストール</b></summary>
|
|
||||||
|
|
||||||
Augment Code で Context7 MCP を設定するには、グラフィカルインターフェースまたは手動設定のいずれかを使用できます。
|
|
||||||
|
|
||||||
### **A. Augment Code UI を使用する場合**
|
|
||||||
|
|
||||||
1. ハンバーガーメニューをクリックします。
|
|
||||||
2. **Settings** を選択します。
|
|
||||||
3. **Tools** セクションに移動します。
|
|
||||||
4. **+ Add MCP** ボタンをクリックします。
|
|
||||||
5. 以下のコマンドを入力します:
|
|
||||||
|
|
||||||
```
|
|
||||||
npx -y @upstash/context7-mcp@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
6. MCP に **Context7** と名前を付けます。
|
|
||||||
7. **Add** ボタンをクリックします。
|
|
||||||
|
|
||||||
MCP サーバーが追加されたら、Augment Code 内で Context7 の最新コードドキュメンテーション機能を直接使用できます。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **B. 手動設定**
|
|
||||||
|
|
||||||
1. Cmd/Ctrl Shift P を押すか、Augment パネルのハンバーガーメニューに移動します
|
|
||||||
2. Edit Settings を選択します
|
|
||||||
3. Advanced の下で、Edit in settings.json をクリックします
|
|
||||||
4. `augment.advanced` オブジェクト内の `mcpServers` 配列にサーバー設定を追加します
|
|
||||||
|
|
||||||
"augment.advanced": {
|
|
||||||
"mcpServers": [
|
|
||||||
{
|
|
||||||
"name": "context7",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
MCP サーバーが追加されたら、エディタを再起動します。エラーが発生した場合は、構文をチェックして、閉じ括弧やカンマが欠けていないことを確認してください。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Roo Code へのインストール</b></summary>
|
|
||||||
|
|
||||||
これを Roo Code MCP 設定ファイルに追加します。詳細は [Roo Code MCP ドキュメント](https://docs.roocode.com/features/mcp/using-mcp-in-roo) を参照してください。
|
|
||||||
|
|
||||||
#### Roo Code リモートサーバー接続
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "streamable-http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Roo Code ローカルサーバー接続
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Zencoder へのインストール</b></summary>
|
|
||||||
|
|
||||||
Zencoder で Context7 MCP を設定するには、以下の手順に従います:
|
|
||||||
|
|
||||||
1. Zencoder メニュー (...) に移動します
|
|
||||||
2. ドロップダウンメニューから Agent tools を選択します
|
|
||||||
3. Add custom MCP をクリックします
|
|
||||||
4. 以下から名前とサーバー設定を追加し、Install ボタンを必ず押してください
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"command": "npx",
|
|
||||||
"args": [
|
|
||||||
"-y",
|
|
||||||
"@upstash/context7-mcp@latest"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
MCP サーバーが追加されたら、簡単に使用を続けることができます。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Amazon Q Developer CLI へのインストール</b></summary>
|
|
||||||
|
|
||||||
これを Amazon Q Developer CLI 設定ファイルに追加します。詳細は [Amazon Q Developer CLI ドキュメント](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) を参照してください。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## 🔨 利用可能なツール
|
|
||||||
|
|
||||||
Context7 MCP は LLM が使用できる以下のツールを提供します:
|
|
||||||
|
|
||||||
- `resolve-library-id`:一般的なライブラリ名を Context7 互換のライブラリ ID に変換します。
|
|
||||||
|
|
||||||
- `libraryName`(必須):検索するライブラリの名前
|
|
||||||
|
|
||||||
- `get-library-docs`:Context7 互換のライブラリ ID を使用してライブラリのドキュメントを取得します。
|
|
||||||
- `context7CompatibleLibraryID`(必須):正確な Context7 互換のライブラリ ID(例:`/mongodb/docs`、`/vercel/next.js`)
|
|
||||||
- `topic`(任意):ドキュメントの特定のトピックに焦点を当てます(例:"routing"、"hooks")
|
|
||||||
- `tokens`(任意、デフォルト 10000):返すトークンの最大数。デフォルト値 10000 未満の値は自動的に 10000 に増加されます。
|
|
||||||
|
|
||||||
## 💻 開発
|
|
||||||
|
|
||||||
プロジェクトをクローンして依存関係をインストールします:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun i
|
|
||||||
```
|
|
||||||
|
|
||||||
ビルド:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run build
|
|
||||||
```
|
|
||||||
|
|
||||||
サーバーを実行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run dist/index.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### CLI 引数
|
|
||||||
|
|
||||||
`context7-mcp` は以下の CLI フラグを受け付けます:
|
|
||||||
|
|
||||||
- `--transport <stdio|http|sse>` – 使用するトランスポート(デフォルトは `stdio`)。
|
|
||||||
- `--port <number>` – `http` または `sse` トランスポート使用時にリッスンするポート(デフォルト `3000`)。
|
|
||||||
|
|
||||||
http トランスポートとポート 8080 の例:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run dist/index.js --transport http --port 8080
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>ローカル設定例</b></summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>MCP Inspector でのテスト</b></summary>
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## 🚨 トラブルシューティング
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>モジュールが見つからないエラー</b></summary>
|
|
||||||
|
|
||||||
`ERR_MODULE_NOT_FOUND` が発生した場合は、`npx` の代わりに `bunx` を使用してみてください:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
これにより、`npx` がパッケージを正しくインストールまたは解決できない環境でのモジュール解決の問題が解決されることがあります。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>ESM 解決の問題</b></summary>
|
|
||||||
|
|
||||||
`Error: Cannot find module 'uriTemplate.js'` のようなエラーの場合は、`--experimental-vm-modules` フラグを試してください:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>TLS/証明書の問題</b></summary>
|
|
||||||
|
|
||||||
TLS 関連の問題を回避するには、`--experimental-fetch` フラグを使用します:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>一般的な MCP クライアントエラー</b></summary>
|
|
||||||
|
|
||||||
1. パッケージ名に `@latest` を追加してみる
|
|
||||||
2. `npx` の代替として `bunx` を使用する
|
|
||||||
3. 別の代替方法として `deno` の使用を検討する
|
|
||||||
4. ネイティブ fetch サポートのために Node.js v18 以上を使用していることを確認する
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## ⚠️ 免責事項
|
|
||||||
|
|
||||||
Context7 プロジェクトはコミュニティが貢献しているもので、高品質を維持するよう努めていますが、すべてのライブラリドキュメントの正確性、完全性、セキュリティを保証することはできません。Context7 にリストされているプロジェクトは、Context7 ではなく、それぞれの所有者によって開発および保守されています。疑わしい、不適切な、または潜在的に有害なコンテンツを発見した場合は、プロジェクトページの「報告」ボタンを使用して、すぐにお知らせください。私たちはすべての報告を真剣に受け止め、プラットフォームの整合性と安全性を維持するために、フラグが付けられたコンテンツを迅速にレビューします。Context7 を使用することにより、あなたは自己の裁量とリスクで使用することを認めます。
|
|
||||||
|
|
||||||
## 🤝 私たちとつながる
|
|
||||||
|
|
||||||
最新情報を入手し、コミュニティに参加しましょう:
|
|
||||||
|
|
||||||
- 📢 最新ニュースとアップデートのために [X](https://x.com/contextai) でフォローしてください
|
|
||||||
- 🌐 [Web サイト](https://context7.com) を訪問してください
|
|
||||||
- 💬 [Discord コミュニティ](https://upstash.com/discord) に参加してください
|
|
||||||
|
|
||||||
## 📺 メディアでの Context7
|
|
||||||
|
|
||||||
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
|
|
||||||
- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
|
||||||
- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
|
||||||
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
|
||||||
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
|
||||||
- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
|
||||||
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## ⭐ スター履歴
|
|
||||||
|
|
||||||
[](https://www.star-history.com/#upstash/context7&Date)
|
|
||||||
|
|
||||||
## 📄 ライセンス
|
|
||||||
|
|
||||||
MIT
|
|
@ -1,8 +1,4 @@
|
|||||||
# Context7 MCP - 모든 프롬프트를 위한 최신 코드 문서
|
# Context7 MCP - 모든 프롬프트를 위한 최신 문서
|
||||||
|
|
||||||
[](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)
|
|
||||||
|
|
||||||
[](./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)
|
|
||||||
|
|
||||||
## ❌ Context7 없이
|
## ❌ Context7 없이
|
||||||
|
|
||||||
@ -14,16 +10,16 @@ LLM은 사용하는 라이브러리에 대한 오래되거나 일반적인 정
|
|||||||
|
|
||||||
## ✅ Context7 사용 시
|
## ✅ Context7 사용 시
|
||||||
|
|
||||||
Context7 MCP는 최신 버전별 문서와 코드 예제를 소스에서 직접 가져와 프롬프트에 즉시 적용합니다.
|
Context7 MCP는 소스에서 직접 최신 버전별 문서와 코드 예제를 가져와 프롬프트에 즉시 적용합니다.
|
||||||
|
|
||||||
Cursor에서 프롬프트에 `use context7`을 추가하세요:
|
Cursor에서 프롬프트에 `use context7`만 추가하세요:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
쿠키에서 유효한 JWT를 확인하고 인증되지 않은 사용자를 /login으로 리디렉션하는 Next.js 미들웨어를 만들어주세요. use context7
|
app router를 사용하는 기본 Next.js 프로젝트를 만들어주세요. use context7
|
||||||
```
|
```
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
JSON API 응답을 5분 동안 캐시하도록 Cloudflare Worker 스크립트를 구성해주세요. use context7
|
PostgreSQL 연결 정보를 사용하여 city 필드가 빈 문자열("")인 행을 삭제하는 스크립트를 만들어주세요. use context7
|
||||||
```
|
```
|
||||||
|
|
||||||
Context7은 최신 코드 예제와 문서를 LLM의 컨텍스트에 즉시 가져옵니다.
|
Context7은 최신 코드 예제와 문서를 LLM의 컨텍스트에 즉시 가져옵니다.
|
||||||
@ -34,10 +30,6 @@ Context7은 최신 코드 예제와 문서를 LLM의 컨텍스트에 즉시 가
|
|||||||
|
|
||||||
탭 전환도, 존재하지 않는 API도, 오래된 코드 생성도 없습니다.
|
탭 전환도, 존재하지 않는 API도, 오래된 코드 생성도 없습니다.
|
||||||
|
|
||||||
## 📚 프로젝트 추가하기
|
|
||||||
|
|
||||||
Context7에 여러분이 좋아하는 라이브러리를 추가(또는 업데이트)하는 방법을 알아보려면 [프로젝트 추가 가이드](./docs/adding-projects.md)를 확인하세요.
|
|
||||||
|
|
||||||
## 🛠️ 시작하기
|
## 🛠️ 시작하기
|
||||||
|
|
||||||
### 요구사항
|
### 요구사항
|
||||||
@ -45,546 +37,19 @@ Context7에 여러분이 좋아하는 라이브러리를 추가(또는 업데이
|
|||||||
- Node.js >= v18.0.0
|
- Node.js >= v18.0.0
|
||||||
- Cursor, Windsurf, Claude Desktop 또는 다른 MCP 클라이언트
|
- Cursor, Windsurf, Claude Desktop 또는 다른 MCP 클라이언트
|
||||||
|
|
||||||
<details>
|
### Smithery를 통한 설치
|
||||||
<summary><b>Smithery를 통한 설치</b></summary>
|
|
||||||
|
|
||||||
[Smithery](https://smithery.ai/server/@upstash/context7-mcp)를 통해 모든 클라이언트에 Context7 MCP 서버를 자동으로 설치하려면:
|
[Smithery](https://smithery.ai/server/@upstash/context7-mcp)를 통해 Claude Desktop용 Context7 MCP 서버를 자동으로 설치하려면:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
|
npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
||||||
```
|
```
|
||||||
|
|
||||||
Smithery 키는 [Smithery.ai 웹페이지](https://smithery.ai/server/@upstash/context7-mcp)에서 찾을 수 있습니다.
|
### Cursor에 설치
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Cursor에 설치</b></summary>
|
|
||||||
|
|
||||||
다음으로 이동: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
|
다음으로 이동: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
|
||||||
|
|
||||||
다음 설정을 Cursor의 `~/.cursor/mcp.json` 파일에 붙여넣는 것이 권장됩니다. 프로젝트 폴더에 `.cursor/mcp.json`을 생성하여 특정 프로젝트에 설치할 수도 있습니다. 자세한 내용은 [Cursor MCP 문서](https://docs.cursor.com/context/model-context-protocol)를 참조하세요.
|
다음 설정을 Cursor의 `~/.cursor/mcp.json` 파일에 붙여넣는 것이 권장됩니다. 자세한 내용은 [Cursor MCP 문서](https://docs.cursor.com/context/model-context-protocol)를 참조하세요.
|
||||||
|
|
||||||
> Cursor 1.0부터는 아래 설치 버튼으로 한 번에 설치할 수 있습니다.
|
|
||||||
|
|
||||||
#### Cursor 원격 서버 연결
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Cursor 로컬 서버 연결
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>대안: Bun 사용</summary>
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>대안: Deno 사용</summary>
|
|
||||||
|
|
||||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "deno",
|
|
||||||
"args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Windsurf에 설치</b></summary>
|
|
||||||
|
|
||||||
Windsurf MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [Windsurf MCP 문서](https://docs.windsurf.com/windsurf/mcp)를 참조하세요.
|
|
||||||
|
|
||||||
#### Windsurf 원격 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"serverUrl": "https://mcp.context7.com/sse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Windsurf 로컬 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Trae에 설치</b></summary>
|
|
||||||
|
|
||||||
수동 추가 기능을 사용하여 해당 MCP 서버의 JSON 설정 정보를 입력하세요.
|
|
||||||
자세한 내용은 [Trae 문서](https://docs.trae.ai/ide/model-context-protocol?_lang=en)를 참조하세요.
|
|
||||||
|
|
||||||
#### Trae 원격 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Trae 로컬 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": [
|
|
||||||
"-y",
|
|
||||||
"@upstash/context7-mcp"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>VS Code에 설치</b></summary>
|
|
||||||
|
|
||||||
[<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
[<img alt="Install in VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
|
|
||||||
VS Code MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [VS Code MCP 문서](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)를 참조하세요.
|
|
||||||
|
|
||||||
#### VS Code 원격 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### VS Code 로컬 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Visual Studio 2022에 설치</b></summary>
|
|
||||||
|
|
||||||
[Visual Studio MCP 서버 문서](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)에 따라 Visual Studio 2022에서 Context7 MCP를 설정할 수 있습니다.
|
|
||||||
|
|
||||||
Visual Studio MCP 설정 파일에 다음을 추가하세요(자세한 내용은 [Visual Studio 문서](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) 참조):
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
또는 로컬 서버의 경우:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
자세한 정보 및 문제 해결은 [Visual Studio MCP 서버 문서](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)를 참조하세요.
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Zed에 설치</b></summary>
|
|
||||||
|
|
||||||
[Zed 확장 프로그램](https://zed.dev/extensions?query=Context7)을 통해 설치하거나 Zed `settings.json`에 다음을 추가할 수 있습니다. 자세한 내용은 [Zed 컨텍스트 서버 문서](https://zed.dev/docs/assistant/context-servers)를 참조하세요.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"context_servers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": {
|
|
||||||
"path": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
},
|
|
||||||
"settings": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Gemini CLI에 설치</b></summary>
|
|
||||||
|
|
||||||
자세한 내용은 [Gemini CLI 설정](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md)을 참조하세요.
|
|
||||||
|
|
||||||
1. Gemini CLI 설정 파일을 엽니다. 위치는 `~/.gemini/settings.json`입니다 (`~`는 홈 디렉토리).
|
|
||||||
2. `settings.json` 파일의 `mcpServers` 객체에 다음을 추가합니다:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`mcpServers` 객체가 없으면 새로 만드세요.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Claude Code에 설치</b></summary>
|
|
||||||
|
|
||||||
이 명령을 실행하세요. 자세한 내용은 [Claude Code MCP 문서](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)를 참조하세요.
|
|
||||||
|
|
||||||
#### Claude Code 원격 서버 연결
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add --transport http context7 https://mcp.context7.com/mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
또는 SSE 전송 사용:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add --transport sse context7 https://mcp.context7.com/sse
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Claude Code 로컬 서버 연결
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Claude Desktop에 설치</b></summary>
|
|
||||||
|
|
||||||
Claude Desktop의 `claude_desktop_config.json` 파일에 다음을 추가하세요. 자세한 내용은 [Claude Desktop MCP 문서](https://modelcontextprotocol.io/quickstart/user)를 참조하세요.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>
|
|
||||||
<b>Cline에 설치</b>
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
다음 지침에 따라 [Cline MCP 서버 마켓플레이스](https://cline.bot/mcp-marketplace)를 통해 Context7을 쉽게 설치할 수 있습니다:
|
|
||||||
|
|
||||||
1. **Cline**을 엽니다.
|
|
||||||
2. 햄버거 메뉴 아이콘(☰)을 클릭하여 **MCP 서버** 섹션으로 들어갑니다.
|
|
||||||
3. **마켓플레이스** 탭 내의 검색창을 사용하여 *Context7*을 찾습니다.
|
|
||||||
4. **설치** 버튼을 클릭합니다.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>BoltAI에 설치</b></summary>
|
|
||||||
|
|
||||||
앱의 "설정" 페이지를 열고 "플러그인"으로 이동한 후 다음 JSON을 입력합니다:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
저장되면 채팅에 `get-library-docs`를 입력한 다음 Context7 문서 ID(예: `get-library-docs /nuxt/ui`)를 입력합니다. 자세한 정보는 [BoltAI 문서 사이트](https://docs.boltai.com/docs/plugins/mcp-servers)에서 확인할 수 있습니다. iOS용 BoltAI의 경우 [이 가이드](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)를 참조하세요.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Docker 사용하기</b></summary>
|
|
||||||
|
|
||||||
MCP 서버를 Docker 컨테이너에서 실행하려면:
|
|
||||||
|
|
||||||
1. **Docker 이미지 빌드:**
|
|
||||||
|
|
||||||
먼저 프로젝트 루트(또는 원하는 위치)에 `Dockerfile`을 만듭니다:
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Dockerfile 내용 보기</summary>
|
|
||||||
|
|
||||||
```Dockerfile
|
|
||||||
FROM node:18-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# 최신 버전 전역 설치
|
|
||||||
RUN npm install -g @upstash/context7-mcp
|
|
||||||
|
|
||||||
# 필요한 경우 기본 포트 노출 (선택 사항, MCP 클라이언트 상호 작용에 따라 다름)
|
|
||||||
# EXPOSE 3000
|
|
||||||
|
|
||||||
# 서버 실행 기본 명령어
|
|
||||||
CMD ["context7-mcp"]
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
그런 다음 태그(예: `context7-mcp`)를 사용하여 이미지를 빌드합니다. **Docker Desktop (또는 Docker 데몬)이 실행 중인지 확인하세요.** `Dockerfile`을 저장한 디렉토리에서 다음 명령을 실행합니다:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t context7-mcp .
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **MCP 클라이언트 설정:**
|
|
||||||
|
|
||||||
MCP 클라이언트 설정을 업데이트하여 Docker 명령을 사용하도록 합니다.
|
|
||||||
|
|
||||||
_cline_mcp_settings.json 예시:_
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Сontext7": {
|
|
||||||
"autoApprove": [],
|
|
||||||
"disabled": false,
|
|
||||||
"timeout": 60,
|
|
||||||
"command": "docker",
|
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
|
||||||
"transportType": "stdio"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
_참고: 이것은 예시 설정입니다. 이 README의 앞부분에 있는 특정 MCP 클라이언트(Cursor, VS Code 등) 예시를 참조하여 구조를 조정하세요(예: `mcpServers` 대 `servers`). 또한 `args`의 이미지 이름이 `docker build` 명령 중 사용된 태그와 일치하는지 확인하세요._
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Windows에 설치</b></summary>
|
|
||||||
|
|
||||||
Windows에서의 설정은 Linux나 macOS와 약간 다릅니다 (_예시에서는 `Cline` 사용_). 다른 편집기에도 동일한 원칙이 적용됩니다. `command`와 `args` 설정을 참조하세요.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Augment Code에 설치</b></summary>
|
|
||||||
|
|
||||||
Augment Code에서 Context7 MCP를 설정하려면 그래픽 인터페이스 또는 수동 설정을 사용할 수 있습니다.
|
|
||||||
|
|
||||||
### **A. Augment Code UI 사용**
|
|
||||||
|
|
||||||
1. 햄버거 메뉴를 클릭합니다.
|
|
||||||
2. **설정**을 선택합니다.
|
|
||||||
3. **도구** 섹션으로 이동합니다.
|
|
||||||
4. **+ MCP 추가** 버튼을 클릭합니다.
|
|
||||||
5. 다음 명령을 입력합니다:
|
|
||||||
|
|
||||||
```
|
|
||||||
npx -y @upstash/context7-mcp@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
6. MCP 이름을 **Context7**으로 지정합니다.
|
|
||||||
7. **추가** 버튼을 클릭합니다.
|
|
||||||
|
|
||||||
MCP 서버가 추가되면 Augment Code 내에서 직접 Context7의 최신 코드 문서 기능을 사용할 수 있습니다.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **B. 수동 설정**
|
|
||||||
|
|
||||||
1. Cmd/Ctrl Shift P를 누르거나 Augment 패널의 햄버거 메뉴로 이동합니다.
|
|
||||||
2. 설정 편집을 선택합니다.
|
|
||||||
3. 고급 아래에서 settings.json에서 편집을 클릭합니다.
|
|
||||||
4. `augment.advanced` 객체의 `mcpServers` 배열에 서버 설정을 추가합니다.
|
|
||||||
|
|
||||||
"augment.advanced": {
|
|
||||||
"mcpServers": [
|
|
||||||
{
|
|
||||||
"name": "context7",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
MCP 서버가 추가되면 편집기를 다시 시작하세요. 오류가 발생하면 닫는 괄호나 쉼표가 누락되지 않았는지 구문을 확인하세요.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Roo Code에 설치</b></summary>
|
|
||||||
|
|
||||||
Roo Code MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [Roo Code MCP 문서](https://docs.roocode.com/features/mcp/using-mcp-in-roo)를 참조하세요.
|
|
||||||
|
|
||||||
#### Roo Code 원격 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "streamable-http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Roo Code 로컬 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Zencoder에 설치</b></summary>
|
|
||||||
|
|
||||||
Zencoder에서 Context7 MCP를 설정하려면 다음 단계를 따르세요:
|
|
||||||
|
|
||||||
1. Zencoder 메뉴(...)로 이동합니다.
|
|
||||||
2. 드롭다운 메뉴에서 에이전트 도구를 선택합니다.
|
|
||||||
3. 사용자 지정 MCP 추가를 클릭합니다.
|
|
||||||
4. 아래에서 이름과 서버 설정을 추가하고 설치 버튼을 누릅니다.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"command": "npx",
|
|
||||||
"args": [
|
|
||||||
"-y",
|
|
||||||
"@upstash/context7-mcp@latest"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
MCP 서버가 추가되면 쉽게 계속 사용할 수 있습니다.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Amazon Q Developer CLI에 설치</b></summary>
|
|
||||||
|
|
||||||
Amazon Q Developer CLI 설정 파일에 다음을 추가하세요. 자세한 내용은 [Amazon Q Developer CLI 문서](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html)를 참조하세요.
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -596,152 +61,106 @@ Amazon Q Developer CLI 설정 파일에 다음을 추가하세요. 자세한 내
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Qodo Gen에 설치</b></summary>
|
<summary>대안: Bun 사용</summary>
|
||||||
|
|
||||||
자세한 내용은 [Qodo Gen 문서](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps)를 참조하세요.
|
|
||||||
|
|
||||||
1. VSCode 또는 IntelliJ에서 Qodo Gen 채팅 패널을 엽니다.
|
|
||||||
2. 더 많은 도구 연결을 클릭합니다.
|
|
||||||
3. + 새 MCP 추가를 클릭합니다.
|
|
||||||
4. 다음 설정을 추가합니다:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"url": "https://mcp.context7.com/mcp"
|
"command": "bunx",
|
||||||
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>JetBrains AI Assistant에 설치</b></summary>
|
<summary>대안: Deno 사용</summary>
|
||||||
|
|
||||||
자세한 내용은 [JetBrains AI Assistant 문서](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html)를 참조하세요.
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"context7": {
|
||||||
|
"command": "deno",
|
||||||
|
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
1. JetBrains IDE에서 `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`로 이동합니다.
|
</details>
|
||||||
2. `+ 추가`를 클릭합니다.
|
|
||||||
3. 대화 상자 왼쪽 상단의 `Command`를 클릭하고 목록에서 JSON으로 옵션을 선택합니다.
|
### Windsurf에 설치
|
||||||
4. 이 설정을 추가하고 `OK`를 클릭합니다.
|
|
||||||
|
Windsurf MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [Windsurf MCP 문서](https://docs.windsurf.com/windsurf/mcp)를 참조하세요.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
5. `Apply`를 클릭하여 변경 사항을 저장합니다.
|
### VSCode에 설치
|
||||||
|
|
||||||
</details>
|
VSCode MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [VSCode MCP 문서](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)를 참조하세요.
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Warp에 설치</b></summary>
|
|
||||||
|
|
||||||
자세한 내용은 [Warp 모델 컨텍스트 프로토콜 문서](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server)를 참조하세요.
|
|
||||||
|
|
||||||
1. `Settings` > `AI` > `Manage MCP servers`로 이동합니다.
|
|
||||||
2. `+ Add` 버튼을 클릭하여 새 MCP 서버를 추가합니다.
|
|
||||||
3. 아래 주어진 설정을 붙여넣습니다:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"Context7": {
|
"servers": {
|
||||||
"command": "npx",
|
"Context7": {
|
||||||
"args": [
|
"type": "stdio",
|
||||||
"-y",
|
"command": "npx",
|
||||||
"@upstash/context7-mcp"
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
],
|
|
||||||
"env": {},
|
|
||||||
"working_directory": null,
|
|
||||||
"start_on_launch": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
4. `Save`를 클릭하여 변경 사항을 적용합니다.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Opencode에 설치</b></summary>
|
|
||||||
|
|
||||||
Opencode 설정 파일에 다음을 추가하세요. 자세한 내용은 [Opencode MCP 문서](https://opencode.ai/docs/mcp-servers)를 참조하세요.
|
|
||||||
|
|
||||||
#### Opencode 원격 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"context7": {
|
|
||||||
"type": "remote",
|
|
||||||
"url": "https://mcp.context7.com/mcp",
|
|
||||||
"enabled": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Opencode 로컬 서버 연결
|
|
||||||
|
|
||||||
```json
|
|
||||||
|
|
||||||
{
|
|
||||||
"mcp": {
|
|
||||||
"context7": {
|
|
||||||
"type": "local",
|
|
||||||
"command": ["npx", "-y", "@upstash/context7-mcp"],
|
|
||||||
"enabled": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
### Claude Code에 설치
|
||||||
|
|
||||||
## 🔨 사용 가능한 도구
|
다음 명령을 실행하세요. 자세한 내용은 [Claude Code MCP 문서](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)를 참조하세요.
|
||||||
|
|
||||||
Context7 MCP는 LLM이 사용할 수 있는 다음 도구들을 제공합니다:
|
```sh
|
||||||
|
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Claude Desktop에 설치
|
||||||
|
|
||||||
|
Claude Desktop의 `claude_desktop_config.json` 파일에 다음을 추가하세요. 자세한 내용은 [Claude Desktop MCP 문서](https://modelcontextprotocol.io/quickstart/user)를 참조하세요.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"Context7": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 사용 가능한 도구
|
||||||
|
|
||||||
- `resolve-library-id`: 일반적인 라이브러리 이름을 Context7이 인식할 수 있는 라이브러리 ID로 변환합니다.
|
- `resolve-library-id`: 일반적인 라이브러리 이름을 Context7이 인식할 수 있는 라이브러리 ID로 변환합니다.
|
||||||
|
- `libraryName` (필수): 검색하고자 하는 라이브러리 이름
|
||||||
- `libraryName` (필수): 검색할 라이브러리의 이름
|
|
||||||
|
|
||||||
- `get-library-docs`: Context7이 인식하는 라이브러리 ID를 사용하여 해당 라이브러리의 문서를 가져옵니다.
|
- `get-library-docs`: Context7이 인식하는 라이브러리 ID를 사용하여 해당 라이브러리의 문서를 가져옵니다.
|
||||||
- `context7CompatibleLibraryID` (필수): 정확한 Context7 호환 라이브러리 ID (예: `/mongodb/docs`, `/vercel/next.js`)
|
- `context7CompatibleLibraryID` (필수)
|
||||||
- `topic` (선택): 특정 주제에 대한 문서에 집중합니다 (예: "routing", "hooks")
|
- `topic` (선택): 특정 주제의 문서만 가져오기 (예: "routing", "hooks")
|
||||||
- `tokens` (선택, 기본값 10000): 가져올 문서의 최대 토큰 수. 기본값인 10000보다 작은 값은 자동으로 10000으로 증가합니다.
|
- `tokens` (선택, 기본값 10000): 가져올 문서의 최대 토큰 수. 10000 미만으로 설정하면 자동으로 10000으로 조정됨
|
||||||
|
|
||||||
## 🛟 팁
|
## 개발
|
||||||
|
|
||||||
### 규칙 추가
|
프로젝트를 클론하고 의존성을 설치하세요:
|
||||||
> 모든 프롬프트에 `use context7`을 추가하고 싶지 않다면, Windsurf의 `.windsurfrules` 파일이나 Cursor의 `Cursor Settings > Rules` 섹션(또는 사용 중인 MCP 클라이언트의 해당 기능)에서 간단한 규칙을 정의하여 코드 관련 질문에 Context7을 자동으로 호출할 수 있습니다:
|
|
||||||
> ```toml
|
|
||||||
> [[calls]]
|
|
||||||
> match = "when the user requests code examples, setup or configuration steps, or library/API documentation"
|
|
||||||
> tool = "context7"
|
|
||||||
> ```
|
|
||||||
> 그러면 추가 입력 없이도 관련 대화에서 Context7의 문서를 얻을 수 있습니다. match 부분에 여러분의 사용 사례를 추가할 수 있습니다.
|
|
||||||
|
|
||||||
### 라이브러리 ID 사용
|
|
||||||
> 사용하려는 라이브러리를 이미 정확히 알고 있다면, 프롬프트에 해당 라이브러리의 Context7 ID를 추가하세요. 이렇게 하면 Context7 MCP 서버가 라이브러리 매칭 단계를 건너뛰고 바로 문서 검색을 진행할 수 있습니다.
|
|
||||||
> ```txt
|
|
||||||
> supabase로 기본 인증을 구현해줘. API와 문서는 /supabase/supabase 라이브러리를 사용해줘
|
|
||||||
> ```
|
|
||||||
> 슬래시 구문은 MCP 도구에게 어떤 라이브러리의 문서를 로드할지 정확히 알려줍니다.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 💻 개발
|
|
||||||
|
|
||||||
프로젝트를 복제하고 의존성을 설치하세요:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun i
|
bun i
|
||||||
@ -753,27 +172,7 @@ bun i
|
|||||||
bun run build
|
bun run build
|
||||||
```
|
```
|
||||||
|
|
||||||
서버 실행:
|
### 로컬 설정 예시
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run dist/index.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### CLI 인수
|
|
||||||
|
|
||||||
`context7-mcp`는 다음 CLI 플래그를 지원합니다:
|
|
||||||
|
|
||||||
- `--transport <stdio|http|sse>` – 사용할 전송 방식 (`stdio`가 기본값).
|
|
||||||
- `--port <number>` – `http` 또는 `sse` 전송 방식 사용 시 수신 대기할 포트 (기본값 `3000`).
|
|
||||||
|
|
||||||
http 전송과 포트 8080을 사용하는 예시:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run dist/index.js --transport http --port 8080
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>로컬 설정 예시</b></summary>
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -786,109 +185,49 @@ bun run dist/index.js --transport http --port 8080
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
### MCP Inspector로 테스트
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>MCP Inspector로 테스트</b></summary>
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
## 문제 해결
|
||||||
|
|
||||||
## 🚨 문제 해결
|
### ERR_MODULE_NOT_FOUND
|
||||||
|
|
||||||
<details>
|
이 오류가 발생하면 `npx` 대신 `bunx`를 사용해보세요.
|
||||||
<summary><b>Module Not Found Errors</b></summary>
|
|
||||||
|
|
||||||
`ERR_MODULE_NOT_FOUND` 오류가 발생하면 `npx` 대신 `bunx`를 사용해 보세요:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "bunx",
|
"command": "bunx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
이 방법은 `npx`가 패키지를 제대로 설치하거나 확인하지 못하는 환경에서 모듈 확인 문제를 해결하는 경우가 많습니다.
|
이 방법은 `npx`가 패키지를 제대로 설치 또는 찾지 못하는 환경에서 문제를 해결하는 경우가 많습니다.
|
||||||
|
|
||||||
</details>
|
### MCP 클라이언트 오류
|
||||||
|
|
||||||
<details>
|
1. 패키지 이름에서 `@latest`를 제거해보세요.
|
||||||
<summary><b>ESM Resolution 문제</b></summary>
|
|
||||||
|
|
||||||
`Error: Cannot find module 'uriTemplate.js'`와 같은 오류의 경우 `--experimental-vm-modules` 플래그를 사용해 보세요:
|
2. 대안으로 `bunx`를 사용해보세요.
|
||||||
|
|
||||||
```json
|
3. 대안으로 `deno`를 사용해보세요.
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
## Context7 관련 미디어 자료
|
||||||
|
|
||||||
<details>
|
- [Better Stack: "무료 도구로 Cursor를 10배 더 스마트하게 만들기"](https://youtu.be/52FC3qObp9E)
|
||||||
<summary><b>TLS/인증서 문제</b></summary>
|
- [Cole Medin: "AI 코딩 어시스턴트를 위한 최고의 MCP 서버"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
||||||
|
- [Income stream surfers: "Context7 + SequentialThinking MCPs: 이것이 AGI인가?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
||||||
|
- [Julian Goldie SEO: "Context7: 새로운 MCP AI 에이전트 업데이트"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
||||||
|
- [JeredBlu: "Context 7 MCP: 즉시 문서 가져오기 + VS Code 설정"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||||
|
- [Income stream surfers: "Context7: AI 코딩을 변화시킬 새로운 MCP 서버"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||||
|
|
||||||
`--experimental-fetch` 플래그를 사용하여 TLS 관련 문제를 우회하세요:
|
## Star 기록
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>일반적인 MCP 클라이언트 오류</b></summary>
|
|
||||||
|
|
||||||
1. 패키지 이름에 `@latest`를 추가해 보세요.
|
|
||||||
2. `npx` 대신 `bunx`를 사용해 보세요.
|
|
||||||
3. 또 다른 대안으로 `deno` 사용을 고려해 보세요.
|
|
||||||
4. 네이티브 fetch 지원을 위해 Node.js v18 이상을 사용하고 있는지 확인하세요.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## ⚠️ 면책 조항
|
|
||||||
|
|
||||||
Context7 프로젝트는 커뮤니티 기여로 이루어지며, 높은 품질을 유지하기 위해 노력하지만 모든 라이브러리 문서의 정확성, 완전성 또는 보안을 보장할 수는 없습니다. Context7에 등록된 프로젝트는 Context7이 아닌 각 소유자에 의해 개발되고 유지 관리됩니다. 의심스럽거나, 부적절하거나, 잠재적으로 유해한 콘텐츠를 발견하면 프로젝트 페이지의 "신고" 버튼을 사용하여 즉시 저희에게 알려주십시오. 저희는 모든 신고를 심각하게 받아들이고 플랫폼의 무결성과 안전을 유지하기 위해 신고된 콘텐츠를 신속하게 검토할 것입니다. Context7을 사용함으로써 귀하는 자신의 재량과 책임 하에 사용함을 인정하는 것입니다.
|
|
||||||
|
|
||||||
## 🤝 소통하기
|
|
||||||
|
|
||||||
최신 정보를 받고 커뮤니티에 참여하세요:
|
|
||||||
|
|
||||||
- 📢 [X](https://x.com/contextai)에서 저희를 팔로우하고 최신 소식과 업데이트를 받아보세요.
|
|
||||||
- 🌐 저희 [웹사이트](https://context7.com)를 방문하세요.
|
|
||||||
- 💬 저희 [디스코드 커뮤니티](https://upstash.com/discord)에 참여하세요.
|
|
||||||
|
|
||||||
## 📺 미디어 속 Context7
|
|
||||||
|
|
||||||
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
|
|
||||||
- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
|
||||||
- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
|
||||||
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
|
||||||
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
|
||||||
- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
|
||||||
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## ⭐ Star History
|
|
||||||
|
|
||||||
[](https://www.star-history.com/#upstash/context7&Date)
|
[](https://www.star-history.com/#upstash/context7&Date)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "bunx",
|
"command": "bunx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "deno",
|
"command": "deno",
|
||||||
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
|
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
"Context7": {
|
"Context7": {
|
||||||
"type": "stdio",
|
"type": "stdio",
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
"Context7": {
|
"Context7": {
|
||||||
"command": {
|
"command": {
|
||||||
"path": "npx",
|
"path": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
},
|
},
|
||||||
"settings": {}
|
"settings": {}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|||||||
Запустите следующую команду для установки. Смотрите [документацию Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) для получения дополнительной информации.
|
Запустите следующую команду для установки. Смотрите [документацию Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) для получения дополнительной информации.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Установка в Claude Desktop
|
### Установка в Claude Desktop
|
||||||
@ -165,22 +165,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Context7": {
|
"Context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Установка в BoltAI
|
|
||||||
|
|
||||||
Откройте страницу "Settings", перейдите в "Plugins" и добавьте следующие JSON-строки:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"],
|
|
||||||
"command": "npx"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,88 +175,69 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|||||||
|
|
||||||
Если вы предпочитаете запускать MCP сервер в Docker контейнере:
|
Если вы предпочитаете запускать MCP сервер в Docker контейнере:
|
||||||
|
|
||||||
1. **Создайте образ Docker:**
|
1. **Создайте образ Docker:**
|
||||||
|
|
||||||
Во-первых, создайте `Dockerfile` в корне вашего проекта (или в любом другом месте):
|
Во-первых, создайте `Dockerfile` в корне вашего проекта (или в любом другом месте):
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Нажмите, чтобы просмотреть содержимое файла Dockerfile</summary>
|
<summary>Нажмите, чтобы просмотреть содержимое файла Dockerfile</summary>
|
||||||
|
|
||||||
```Dockerfile
|
```Dockerfile
|
||||||
FROM node:18-alpine
|
FROM node:18-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Установите последнюю версию пакета глобально
|
# Установите последнюю версию пакета глобально
|
||||||
RUN npm install -g @upstash/context7-mcp
|
RUN npm install -g @upstash/context7-mcp@latest
|
||||||
|
|
||||||
# Откройте стандартный порт, если это необходимо (необязательно, это зависит от взаимодействия с MCP клиентом)
|
# Откройте стандартный порт, если это необходимо (необязательно, это зависит от взаимодействия с MCP клиентом)
|
||||||
# EXPOSE 3000
|
# EXPOSE 3000
|
||||||
|
|
||||||
# Стандартная команда для запуска сервера
|
# Стандартная команда для запуска сервера
|
||||||
CMD ["context7-mcp"]
|
CMD ["context7-mcp"]
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
Затем, соберите образ, используя тег (например, `context7-mcp`). **Убедитесь, что Docker Desktop (или демон Docker) работает.** Запустите следующую команду в этой же директории, где сохранён `Dockerfile`:
|
Затем, соберите образ, используя тег (например, `context7-mcp`). **Убедитесь, что Docker Desktop (или демон Docker) работает.** Запустите следующую команду в этой же директории, где сохранён `Dockerfile`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t context7-mcp .
|
docker build -t context7-mcp .
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Настройте ваш MCP клиент:**
|
2. **Настройте ваш MCP клиент:**
|
||||||
|
|
||||||
Обновите вашу конфигурацию MCP клиента, чтобы использовать Docker команду.
|
Обновите вашу конфигурацию MCP клиента, чтобы использовать Docker команду.
|
||||||
|
|
||||||
_Пример для cline_mcp_settings.json:_
|
*Пример для cline_mcp_settings.json:*
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Сontext7": {
|
"Сontext7": {
|
||||||
"autoApprove": [],
|
"autoApprove": [],
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"command": "docker",
|
"command": "docker",
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
"args": ["run", "-i", "--rm", "context7-mcp"],
|
||||||
"transportType": "stdio"
|
"transportType": "stdio"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
_Примечение: это пример конфигурации. Обратитесь к конкретным примерам для вашего MCP-клиента (например, Cursor, VS Code и т.д.), в предыдущих разделах этого README, чтобы адаптировать структуру (например, `mcpServers` вместо `servers`). Также убедитесь, что имя образа в `args` соответствует тегу, использованному при выполнении команды `docker build`._
|
|
||||||
|
|
||||||
### Установка в Windows
|
|
||||||
|
|
||||||
Конфигурация в Windows немного отличается от Linux или macOS (_в качестве примера используется `Cline`_). Однако, эти же же принципы применимы и к другим редакторам. В случае необходимости обратитесь к настройкам `command` и `args`.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
}
|
||||||
}
|
```
|
||||||
}
|
*Примечение: это пример конфигурации. Обратитесь к конкретным примерам для вашего MCP-клиента (например, Cursor, VS Code и т.д.), в предыдущих разделах этого README, чтобы адаптировать структуру (например, `mcpServers` вместо `servers`). Также убедитесь, что имя образа в `args` соответствует тегу, использованному при выполнении команды `docker build`.*
|
||||||
```
|
|
||||||
|
|
||||||
### Переменные окружения
|
### Переменные окружения
|
||||||
|
|
||||||
- `DEFAULT_MINIMUM_TOKENS`: минимальное количество токенов, необходимое для получения документации (по умолчанию: 10000).
|
- `DEFAULT_MINIMUM_TOKENS`: минимальное количество токенов, необходимое для получения документации (по умолчанию: 5000).
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"],
|
"args": ["-y", "@upstash/context7-mcp@latest"],
|
||||||
"env": {
|
"env": {
|
||||||
"DEFAULT_MINIMUM_TOKENS": "10000"
|
"DEFAULT_MINIMUM_TOKENS": "10000"
|
||||||
}
|
}
|
||||||
@ -287,7 +253,7 @@ Examples:
|
|||||||
- `get-library-docs`: получает документацию по библиотеке по совместимому с Context7 идентификатору.
|
- `get-library-docs`: получает документацию по библиотеке по совместимому с Context7 идентификатору.
|
||||||
- `context7CompatibleLibraryID` (обязательно)
|
- `context7CompatibleLibraryID` (обязательно)
|
||||||
- `topic` (необязательно): фокусирует документацию на определённой теме (например, "routing", "hooks")
|
- `topic` (необязательно): фокусирует документацию на определённой теме (например, "routing", "hooks")
|
||||||
- `tokens` (необязательно, по умолчанию 10000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него.
|
- `tokens` (необязательно, по умолчанию 5000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него.
|
||||||
|
|
||||||
## Разработка
|
## Разработка
|
||||||
|
|
||||||
@ -319,7 +285,7 @@ bun run build
|
|||||||
### Тестирование с помощью инспектора MCP
|
### Тестирование с помощью инспектора MCP
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## Решение проблем
|
## Решение проблем
|
||||||
@ -333,7 +299,7 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "bunx",
|
"command": "bunx",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -350,22 +316,11 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp"]
|
"args": [
|
||||||
}
|
"-y",
|
||||||
}
|
"--node-options=--experimental-vm-modules",
|
||||||
}
|
"@upstash/context7-mcp@1.0.6"
|
||||||
```
|
]
|
||||||
|
|
||||||
### Проблемы с TLS/сертификатами
|
|
||||||
|
|
||||||
Используйте флаг `--experimental-fetch` c `npx`, чтобы избежать ошибки, связанные с TLS:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,7 +328,7 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|||||||
|
|
||||||
### Ошибки MCP клиента
|
### Ошибки MCP клиента
|
||||||
|
|
||||||
1. Попробуйте добавить тег `@latest` в имя пакета.
|
1. Попробуйте убрать тег `@latest` из имени пакета.
|
||||||
|
|
||||||
2. Попробуйте использовать `bunx` как альтернативу `npx`.
|
2. Попробуйте использовать `bunx` как альтернативу `npx`.
|
||||||
|
|
||||||
@ -382,22 +337,13 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|||||||
4. Убедитесь, что используете версию Node v18 или выше, чтобы `npx` поддерживал встроенный `fetch`.
|
4. Убедитесь, что используете версию Node v18 или выше, чтобы `npx` поддерживал встроенный `fetch`.
|
||||||
|
|
||||||
## Отказ от ответственности
|
## Отказ от ответственности
|
||||||
|
|
||||||
Проекты Context7 создаются сообществом. Мы стремимся поддерживать высокое качество, однако не можем гарантировать точность, полноту или безопасность всей документации по библиотекам. Проекты, представленные в Context7, разрабатываются и поддерживаются их авторами, а не командой Context7.
|
Проекты Context7 создаются сообществом. Мы стремимся поддерживать высокое качество, однако не можем гарантировать точность, полноту или безопасность всей документации по библиотекам. Проекты, представленные в Context7, разрабатываются и поддерживаются их авторами, а не командой Context7.
|
||||||
|
|
||||||
Если вы столкнётесь с подозрительным, неуместным или потенциально вредоносным контентом, пожалуйста, воспользуйтесь кнопкой "Report" на странице проекта, чтобы немедленно сообщить нам. Мы внимательно относимся ко всем обращениям и оперативно проверяем помеченные материалы, чтобы обеспечить надёжность и безопасность платформы.
|
Если вы столкнётесь с подозрительным, неуместным или потенциально вредоносным контентом, пожалуйста, воспользуйтесь кнопкой "Report" на странице проекта, чтобы немедленно сообщить нам. Мы внимательно относимся ко всем обращениям и оперативно проверяем помеченные материалы, чтобы обеспечить надёжность и безопасность платформы.
|
||||||
|
|
||||||
Используя Context7, вы признаёте, что делаете это по собственному усмотрению и на свой страх и риск.
|
Используя Context7, вы признаёте, что делаете это по собственному усмотрению и на свой страх и риск.
|
||||||
|
|
||||||
## Оставайтесь с нами на связи
|
## Context7 In Media
|
||||||
|
|
||||||
Будьте в курсе последних новостей на наших платформах:
|
|
||||||
|
|
||||||
- 📢 Следите за нашими новостями на [X](https://x.com/contextai), чтобы быть в курсе последних новостей
|
|
||||||
- 🌐 Загляните на наш [сайт](https://context7.com)
|
|
||||||
- 💬 При желании присоединяйтесь к нашему [сообществу в Discord](https://upstash.com/discord)
|
|
||||||
|
|
||||||
## Context7 в СМИ
|
|
||||||
|
|
||||||
- [Better Stack: "Бесплатный инструмент делает Cursor в 10 раз умнее"](https://youtu.be/52FC3qObp9E)
|
- [Better Stack: "Бесплатный инструмент делает Cursor в 10 раз умнее"](https://youtu.be/52FC3qObp9E)
|
||||||
- [Cole Medin: "Это, без сомнения, ЛУЧШИЙ MCP-сервер для AI-помощников в коде"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
- [Cole Medin: "Это, без сомнения, ЛУЧШИЙ MCP-сервер для AI-помощников в коде"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
||||||
@ -405,8 +351,6 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|||||||
- [Julian Goldie SEO: "Context7: обновление MCP-агента"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
- [Julian Goldie SEO: "Context7: обновление MCP-агента"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
||||||
- [JeredBlu: "Context 7 MCP: мгновенный доступ к документации + настройка для VS Code"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
- [JeredBlu: "Context 7 MCP: мгновенный доступ к документации + настройка для VS Code"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||||
- [Income stream surfers: "Context7: новый MCP-сервер, который изменит кодинг с ИИ"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
- [Income stream surfers: "Context7: новый MCP-сервер, который изменит кодинг с ИИ"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||||
- [AICodeKing: "Context7 + Cline & RooCode: Этот MCP сервер делает CLINE в 100 раз ЭФФЕКТИВНЕЕ!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [Sean Kochel: "5 MCP серверов для стремительного вайб-программирования (Подключи и Работай)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## История звёзд на GitHub
|
## История звёзд на GitHub
|
||||||
|
|
||||||
|
@ -1,360 +0,0 @@
|
|||||||
# Context7 MCP - Herhangi Bir Prompt İçin Güncel Kod Belgeleri
|
|
||||||
|
|
||||||
[](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)
|
|
||||||
|
|
||||||
[](./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)
|
|
||||||
|
|
||||||
## ❌ Context7 Olmadan
|
|
||||||
|
|
||||||
LLM'ler, kullandığınız kütüphaneler hakkında güncel olmayan veya genel bilgilere güvenir. Karşılaştığınız sorunlar:
|
|
||||||
|
|
||||||
- ❌ Kod örnekleri eskidir ve bir yıllık eğitim verilerine dayanır
|
|
||||||
- ❌ Halüsinasyon yapılan API'ler gerçekte mevcut değildir
|
|
||||||
- ❌ Eski paket sürümleri için genel cevaplar alırsınız
|
|
||||||
|
|
||||||
## ✅ Context7 İle
|
|
||||||
|
|
||||||
Context7 MCP, güncel ve sürüme özel belgeleri ve kod örneklerini doğrudan kaynağından çeker ve doğrudan prompt'unuza yerleştirir.
|
|
||||||
|
|
||||||
Cursor'da prompt'unuza `use context7` ekleyin:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Next.js ile app router kullanan basit bir proje oluştur. use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
```txt
|
|
||||||
PostgreSQL kimlik bilgileriyle şehir değeri "" olan satırları silmek için bir betik oluştur. use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
Context7, güncel kod örneklerini ve belgelerini doğrudan LLM'inizin içeriğine getirir.
|
|
||||||
|
|
||||||
- 1️⃣ Prompt'unuzu doğal bir şekilde yazın
|
|
||||||
- 2️⃣ LLM'e `use context7` kullanmasını söyleyin
|
|
||||||
- 3️⃣ Çalışan kod cevapları alın
|
|
||||||
|
|
||||||
Sekme değiştirme, var olmayan halüsinasyon API'ler, güncel olmayan kod üretimleri yok.
|
|
||||||
|
|
||||||
## 🛠️ Başlangıç
|
|
||||||
|
|
||||||
### Gereksinimler
|
|
||||||
|
|
||||||
- Node.js >= v18.0.0
|
|
||||||
- Cursor, Windsurf, Claude Desktop veya başka bir MCP İstemcisi
|
|
||||||
|
|
||||||
### Smithery aracılığıyla kurulum
|
|
||||||
|
|
||||||
Context7 MCP Server'ı Claude Desktop için [Smithery](https://smithery.ai/server/@upstash/context7-mcp) aracılığıyla otomatik olarak kurmak için:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cursor'da Kurulum
|
|
||||||
|
|
||||||
Şu yolu izleyin: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
|
|
||||||
|
|
||||||
Aşağıdaki yapılandırmayı Cursor `~/.cursor/mcp.json` dosyanıza yapıştırmanız önerilen yaklaşımdır. Ayrıca, proje klasörünüzde `.cursor/mcp.json` oluşturarak belirli bir projeye de kurabilirsiniz. Daha fazla bilgi için [Cursor MCP belgelerine](https://docs.cursor.com/context/model-context-protocol) bakabilirsiniz.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Alternatif: Bun Kullanın</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Alternatif: Deno Kullanın</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "deno",
|
|
||||||
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Windsurf'te Kurulum
|
|
||||||
|
|
||||||
Bunu Windsurf MCP yapılandırma dosyanıza ekleyin. Daha fazla bilgi için [Windsurf MCP belgelerine](https://docs.windsurf.com/windsurf/mcp) bakabilirsiniz.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### VS Code'da Kurulum
|
|
||||||
|
|
||||||
[<img alt="VS Code'da Yükle (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Context7%20MCP%20Y%C3%BCkle&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
[<img alt="VS Code Insiders'da Yükle (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Context7%20MCP%20Y%C3%BCkle&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
|
|
||||||
Bunu VS Code MCP yapılandırma dosyanıza ekleyin. Daha fazla bilgi için [VS Code MCP belgelerine](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) bakabilirsiniz.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"servers": {
|
|
||||||
"Context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Zed'de Kurulum
|
|
||||||
|
|
||||||
[Zed Uzantıları](https://zed.dev/extensions?query=Context7) aracılığıyla kurulabilir veya Zed `settings.json` dosyanıza ekleyebilirsiniz. Daha fazla bilgi için [Zed Context Server belgelerine](https://zed.dev/docs/assistant/context-servers) bakabilirsiniz.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"context_servers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": {
|
|
||||||
"path": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
},
|
|
||||||
"settings": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Claude Code'da Kurulum
|
|
||||||
|
|
||||||
Bu komutu çalıştırın. Daha fazla bilgi için [Claude Code MCP belgelerine](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) bakabilirsiniz.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
### Claude Desktop'ta Kurulum
|
|
||||||
|
|
||||||
Bunu Claude Desktop `claude_desktop_config.json` dosyanıza ekleyin. Daha fazla bilgi için [Claude Desktop MCP belgelerine](https://modelcontextprotocol.io/quickstart/user) bakabilirsiniz.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker Kullanımı
|
|
||||||
|
|
||||||
MCP sunucusunu bir Docker konteynerinde çalıştırmayı tercih ederseniz:
|
|
||||||
|
|
||||||
1. **Docker Görüntüsü Oluşturun:**
|
|
||||||
|
|
||||||
Önce, proje kökünde (veya tercih ettiğiniz herhangi bir yerde) bir `Dockerfile` oluşturun:
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Dockerfile içeriğini görmek için tıklayın</summary>
|
|
||||||
|
|
||||||
```Dockerfile
|
|
||||||
FROM node:18-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# En son sürümü global olarak yükleyin
|
|
||||||
RUN npm install -g @upstash/context7-mcp@latest
|
|
||||||
|
|
||||||
# Gerekirse varsayılan portu açın (isteğe bağlı, MCP istemci etkileşimine bağlıdır)
|
|
||||||
# EXPOSE 3000
|
|
||||||
|
|
||||||
# Sunucuyu çalıştırmak için varsayılan komut
|
|
||||||
CMD ["context7-mcp"]
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
Ardından, bir etiket (örneğin, `context7-mcp`) kullanarak görüntüyü oluşturun. **Docker Desktop'un (veya Docker daemon'un) çalıştığından emin olun.** `Dockerfile`'ı kaydettiğiniz dizinde aşağıdaki komutu çalıştırın:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t context7-mcp .
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **MCP İstemcinizi Yapılandırın:**
|
|
||||||
|
|
||||||
MCP istemcinizin yapılandırmasını Docker komutunu kullanacak şekilde güncelleyin.
|
|
||||||
|
|
||||||
_cline_mcp_settings.json için örnek:_
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Сontext7": {
|
|
||||||
"autoApprove": [],
|
|
||||||
"disabled": false,
|
|
||||||
"timeout": 60,
|
|
||||||
"command": "docker",
|
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
|
||||||
"transportType": "stdio"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
_Not: Bu bir örnek yapılandırmadır. Yapıyı uyarlamak için MCP istemcinize (Cursor, VS Code vb.) özel örneklere bakın (örneğin, `mcpServers` ve `servers` farkı). Ayrıca, `args` içindeki görüntü adının `docker build` komutu sırasında kullanılan etiketle eşleştiğinden emin olun._
|
|
||||||
|
|
||||||
### Çevre Değişkenleri
|
|
||||||
|
|
||||||
- `DEFAULT_MINIMUM_TOKENS`: Belge alımı için minimum token sayısını ayarlayın (varsayılan: 10000).
|
|
||||||
|
|
||||||
Örnekler:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"env": {
|
|
||||||
"DEFAULT_MINIMUM_TOKENS": "10000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Kullanılabilir Araçlar
|
|
||||||
|
|
||||||
- `resolve-library-id`: Genel bir kütüphane adını Context7 uyumlu bir kütüphane ID'sine dönüştürür.
|
|
||||||
- `libraryName` (gerekli)
|
|
||||||
- `get-library-docs`: Context7 uyumlu bir kütüphane ID'si kullanarak bir kütüphane için belgeleri getirir.
|
|
||||||
- `context7CompatibleLibraryID` (gerekli)
|
|
||||||
- `topic` (isteğe bağlı): Belgeleri belirli bir konuya odaklayın (örn. "routing", "hooks")
|
|
||||||
- `tokens` (isteğe bağlı, varsayılan 10000): Döndürülecek maksimum token sayısı. Yapılandırılmış `DEFAULT_MINIMUM_TOKENS` değerinden veya varsayılan 10000 değerinden düşük değerler otomatik olarak o değere yükseltilir.
|
|
||||||
|
|
||||||
## Geliştirme
|
|
||||||
|
|
||||||
Projeyi klonlayın ve bağımlılıkları yükleyin:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun i
|
|
||||||
```
|
|
||||||
|
|
||||||
Derleyin:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Yerel Yapılandırma Örneği
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### MCP Inspector ile Test Etme
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Sorun Giderme
|
|
||||||
|
|
||||||
### ERR_MODULE_NOT_FOUND
|
|
||||||
|
|
||||||
Bu hatayı görürseniz, `npx` yerine `bunx` kullanmayı deneyin.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Bu, özellikle `npx`'in paketleri düzgün şekilde yüklemediği veya çözemediği ortamlarda modül çözümleme sorunlarını genellikle çözer.
|
|
||||||
|
|
||||||
### ESM Çözümleme Sorunları
|
|
||||||
|
|
||||||
`Error: Cannot find module 'uriTemplate.js'` gibi bir hatayla karşılaşırsanız, `--experimental-vm-modules` bayrağıyla çalıştırmayı deneyin:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### MCP İstemci Hataları
|
|
||||||
|
|
||||||
1. Paket adından `@latest` ifadesini kaldırmayı deneyin.
|
|
||||||
|
|
||||||
2. Alternatif olarak `bunx` kullanmayı deneyin.
|
|
||||||
|
|
||||||
3. Alternatif olarak `deno` kullanmayı deneyin.
|
|
||||||
|
|
||||||
4. `npx` ile yerel fetch desteğine sahip olmak için Node v18 veya daha yüksek bir sürüm kullandığınızdan emin olun.
|
|
||||||
|
|
||||||
## Sorumluluk Reddi
|
|
||||||
|
|
||||||
Context7 projeleri topluluk katkılıdır ve yüksek kaliteyi korumaya çalışsak da, tüm kütüphane belgelerinin doğruluğunu, eksiksizliğini veya güvenliğini garanti edemeyiz. Context7'de listelenen projeler, Context7 tarafından değil, ilgili sahipleri tarafından geliştirilmekte ve sürdürülmektedir. Şüpheli, uygunsuz veya potansiyel olarak zararlı içerikle karşılaşırsanız, lütfen bizi hemen bilgilendirmek için proje sayfasındaki "Bildir" düğmesini kullanın. Tüm bildirimleri ciddiye alıyoruz ve platformumuzun bütünlüğünü ve güvenliğini korumak için işaretlenen içeriği hızla inceleyeceğiz. Context7'yi kullanarak, bunu kendi takdirinizle ve riskinizle yaptığınızı kabul etmiş olursunuz.
|
|
||||||
|
|
||||||
## Context7 Medyada
|
|
||||||
|
|
||||||
- [Better Stack: "Ücretsiz Araç Cursor'u 10 Kat Daha Akıllı Yapıyor"](https://youtu.be/52FC3qObp9E)
|
|
||||||
- [Cole Medin: "Bu, Tartışmasız AI Kodlama Asistanları İçin EN İYİ MCP Sunucusudur"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
|
||||||
- [Income stream surfers: "Context7 + SequentialThinking MCP'leri: Bu AGI mi?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
|
||||||
- [Julian Goldie SEO: "Context7: Yeni MCP AI Aracı Güncellemesi"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
|
||||||
- [JeredBlu: "Context 7 MCP: Belgeleri Anında Alın + VS Code Kurulumu"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
|
||||||
- [Income stream surfers: "Context7: AI Kodlamayı DEĞİŞTİRECEK Yeni MCP Sunucusu"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
|
||||||
- [AICodeKing: "Context7 + Cline & RooCode: Bu MCP Sunucusu CLINE'ı 100 KAT DAHA ETKİLİ YAPIYOR!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [Sean Kochel: "Vibe Kodlama İhtişamı İçin 5 MCP Sunucusu (Tak ve Çalıştır)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## Yıldız Geçmişi
|
|
||||||
|
|
||||||
[](https://www.star-history.com/#upstash/context7&Date)
|
|
||||||
|
|
||||||
## Lisans
|
|
||||||
|
|
||||||
MIT
|
|
@ -187,15 +187,15 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
|||||||
|
|
||||||
更新MCP客户端配置以使用Docker命令。
|
更新MCP客户端配置以使用Docker命令。
|
||||||
|
|
||||||
_cline_mcp_settings.json配置示例:_
|
*cline_mcp_settings.json配置示例:*
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"Сontext7": {
|
"Сontext7": {
|
||||||
"autoApprove": [],
|
"autoApprove": [],
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"command": "docker",
|
"command": "docker",
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
"args": ["run", "-i", "--rm", "context7-mcp"],
|
||||||
"transportType": "stdio"
|
"transportType": "stdio"
|
||||||
@ -203,30 +203,11 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
*注意事项:*
|
||||||
_注意事项:_
|
|
||||||
<em>
|
<em>
|
||||||
|
|
||||||
- 此为示例配置。请参考前面README中针对具体MCP客户端(如Cursor、VS Code等)的示例来调整结构(如`mcpServers`与`servers`)。同时确保`args`中的镜像名称与`docker build`命令使用的标签一致。
|
- 此为示例配置。请参考前面README中针对具体MCP客户端(如Cursor、VS Code等)的示例来调整结构(如`mcpServers`与`servers`)。同时确保`args`中的镜像名称与`docker build`命令使用的标签一致。
|
||||||
- 当前Cursor版本(0.49.5), 请不要使用本方式启动MCP server,详情:[Cursor官方说明](https://docs.cursor.com/context/model-context-protocol#remote-development)
|
- 当前Cursor版本(0.49.5), 请不要使用本方式启动MCP server,详情:[Cursor官方说明](https://docs.cursor.com/context/model-context-protocol#remote-development)
|
||||||
</em>
|
</em>
|
||||||
|
|
||||||
### 在Windows上安装
|
|
||||||
|
|
||||||
在windows上的配置相对于linux或macos来说有些许不同,(_示例使用的`Cline`_), 其它编辑器同理, 参考`command`和`args`的配置即可
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 可用工具
|
### 可用工具
|
||||||
|
|
||||||
@ -270,6 +251,7 @@ bun run build
|
|||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## 故障排除
|
## 故障排除
|
||||||
|
|
||||||
### ERR_MODULE_NOT_FOUND
|
### ERR_MODULE_NOT_FOUND
|
||||||
|
@ -1,549 +0,0 @@
|
|||||||
# Context7 MCP - 即時更新的程式碼文件,適用於任何提示
|
|
||||||
|
|
||||||
[](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)
|
|
||||||
|
|
||||||
## ❌ 沒有 Context7
|
|
||||||
|
|
||||||
大型語言模型(LLM)依賴過時或通用的函式庫資訊。你會遇到:
|
|
||||||
|
|
||||||
- ❌ 程式碼範例過時,僅根據一年前的訓練資料
|
|
||||||
- ❌ 產生不存在的 API
|
|
||||||
- ❌ 舊版套件的通用答案
|
|
||||||
|
|
||||||
## ✅ 有了 Context7
|
|
||||||
|
|
||||||
Context7 MCP 直接從來源拉取即時、特定版本的文件與程式碼範例,並直接放入你的提示中。
|
|
||||||
|
|
||||||
在 Cursor 的提示中加入 `use context7`:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
建立一個使用 app router 的基本 Next.js 專案。use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
```txt
|
|
||||||
根據 PostgreSQL 資訊,建立一個刪除 city 為 "" 的資料列的腳本。use context7
|
|
||||||
```
|
|
||||||
|
|
||||||
Context7 會將即時的程式碼範例與文件直接帶入你的 LLM 上下文。
|
|
||||||
|
|
||||||
- 1️⃣ 自然地撰寫你的提示
|
|
||||||
- 2️⃣ 告訴 LLM `use context7`
|
|
||||||
- 3️⃣ 取得可執行的程式碼解答
|
|
||||||
|
|
||||||
不需切換分頁、不會產生不存在的 API、不會有過時的程式碼。
|
|
||||||
|
|
||||||
## 📚 新增專案
|
|
||||||
|
|
||||||
請參考我們的[專案新增指南](./docs/adding-projects.md),學習如何將你喜愛的函式庫加入 Context7 或更新其內容。
|
|
||||||
|
|
||||||
## 🛠️ 安裝
|
|
||||||
|
|
||||||
### 系統需求
|
|
||||||
|
|
||||||
- Node.js >= v18.0.0
|
|
||||||
- Cursor、Windsurf、Claude Desktop 或其他 MCP 客戶端
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>透過 Smithery 安裝</b></summary>
|
|
||||||
|
|
||||||
要透過 [Smithery](https://smithery.ai/server/@upstash/context7-mcp) 自動安裝 Context7 MCP Server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
|
|
||||||
```
|
|
||||||
|
|
||||||
你的 Smithery 金鑰可在 [Smithery.ai 網頁](https://smithery.ai/server/@upstash/context7-mcp) 取得。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Cursor 安裝</b></summary>
|
|
||||||
|
|
||||||
前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
|
|
||||||
|
|
||||||
建議將下列設定貼到你的 Cursor `~/.cursor/mcp.json` 檔案。你也可以在專案資料夾建立 `.cursor/mcp.json` 進行專案安裝。詳見 [Cursor MCP 文件](https://docs.cursor.com/context/model-context-protocol)。
|
|
||||||
|
|
||||||
#### Cursor 遠端伺服器連線
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Cursor 本地伺服器連線
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>替代方案:使用 Bun</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>替代方案:使用 Deno</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "deno",
|
|
||||||
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Windsurf 安裝</b></summary>
|
|
||||||
|
|
||||||
將下列內容加入 Windsurf MCP 設定檔。詳見 [Windsurf MCP 文件](https://docs.windsurf.com/windsurf/mcp)。
|
|
||||||
|
|
||||||
#### Windsurf 遠端伺服器連線
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"serverUrl": "https://mcp.context7.com/sse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Windsurf 本地伺服器連線
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 VS Code 安裝</b></summary>
|
|
||||||
|
|
||||||
[<img alt="在 VS Code 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=安裝Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
[<img alt="在 VS Code Insiders 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=安裝Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
||||||
|
|
||||||
將下列內容加入 VS Code MCP 設定檔。詳見 [VS Code MCP 文件](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。
|
|
||||||
|
|
||||||
#### VS Code 遠端伺服器連線
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "http",
|
|
||||||
"url": "https://mcp.context7.com/mcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### VS Code 本地伺服器連線
|
|
||||||
|
|
||||||
```json
|
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
|
||||||
"context7": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Zed 安裝</b></summary>
|
|
||||||
|
|
||||||
可透過 [Zed 擴充套件](https://zed.dev/extensions?query=Context7) 安裝,或將下列內容加入 Zed `settings.json`。詳見 [Zed Context Server 文件](https://zed.dev/docs/assistant/context-servers)。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"context_servers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": {
|
|
||||||
"path": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
},
|
|
||||||
"settings": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Claude Code 安裝</b></summary>
|
|
||||||
|
|
||||||
執行下列指令。詳見 [Claude Code MCP 文件](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)。
|
|
||||||
|
|
||||||
#### Claude Code 遠端伺服器連線
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add --transport sse context7 https://mcp.context7.com/sse
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Claude Code 本地伺服器連線
|
|
||||||
|
|
||||||
```sh
|
|
||||||
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Claude Desktop 安裝</b></summary>
|
|
||||||
|
|
||||||
將下列內容加入 Claude Desktop `claude_desktop_config.json`。詳見 [Claude Desktop MCP 文件](https://modelcontextprotocol.io/quickstart/user)。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 BoltAI 安裝</b></summary>
|
|
||||||
|
|
||||||
打開應用程式的「Settings」頁面,前往「Plugins」,並輸入下列 JSON:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
儲存後,在聊天中輸入 `get-library-docs` 並接上你的 Context7 文件 ID(例如 `get-library-docs /nuxt/ui`)。更多資訊請參考 [BoltAI 文件網站](https://docs.boltai.com/docs/plugins/mcp-servers)。如在 iOS 上使用 BoltAI,請參考[此指南](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>使用 Docker</b></summary>
|
|
||||||
|
|
||||||
若你偏好在 Docker 容器中執行 MCP 伺服器:
|
|
||||||
|
|
||||||
1. **建立 Docker 映像檔:**
|
|
||||||
|
|
||||||
先在專案根目錄(或任意位置)建立 `Dockerfile`:
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>點擊查看 Dockerfile 內容</summary>
|
|
||||||
|
|
||||||
```Dockerfile
|
|
||||||
FROM node:18-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# 全域安裝最新版
|
|
||||||
RUN npm install -g @upstash/context7-mcp
|
|
||||||
|
|
||||||
# 如有需要可開放預設埠(視 MCP 客戶端互動而定)
|
|
||||||
# EXPOSE 3000
|
|
||||||
|
|
||||||
# 預設啟動指令
|
|
||||||
CMD ["context7-mcp"]
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
然後使用標籤(如 `context7-mcp`)建構映像檔。**請確保 Docker Desktop(或 Docker daemon)已啟動。**在存有 `Dockerfile` 的目錄執行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t context7-mcp .
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **設定 MCP 客戶端:**
|
|
||||||
|
|
||||||
更新 MCP 客戶端設定以使用 Docker 指令。
|
|
||||||
|
|
||||||
_cline_mcp_settings.json 範例:_
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"Сontext7": {
|
|
||||||
"autoApprove": [],
|
|
||||||
"disabled": false,
|
|
||||||
"timeout": 60,
|
|
||||||
"command": "docker",
|
|
||||||
"args": ["run", "-i", "--rm", "context7-mcp"],
|
|
||||||
"transportType": "stdio"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
_注意:這是範例設定。請參考前述各 MCP 客戶端(如 Cursor、VS Code 等)的範例調整結構(如 `mcpServers` 與 `servers`)。同時確保 `args` 中的映像名稱與 `docker build` 使用的標籤一致。_
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Windows 安裝</b></summary>
|
|
||||||
|
|
||||||
Windows 的設定與 Linux 或 macOS 略有不同(*範例以 Cline 為例*)。其他編輯器同理,請參考 `command` 與 `args` 設定。
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"github.com/upstash/context7-mcp": {
|
|
||||||
"command": "cmd",
|
|
||||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
|
||||||
"disabled": false,
|
|
||||||
"autoApprove": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>在 Augment Code 安裝</b></summary>
|
|
||||||
|
|
||||||
在 Augment Code 設定 Context7 MCP,請依下列步驟:
|
|
||||||
|
|
||||||
1. 按 Cmd/Ctrl Shift P 或於 Augment 面板的漢堡選單中選擇
|
|
||||||
2. 選擇 Edit Settings
|
|
||||||
3. 於 Advanced 下點選 Edit in settings.json
|
|
||||||
4. 將伺服器設定加入 `augment.advanced` 物件的 `mcpServers` 陣列
|
|
||||||
|
|
||||||
```json
|
|
||||||
"augment.advanced": {
|
|
||||||
"mcpServers": [
|
|
||||||
{
|
|
||||||
"name": "context7",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
加入 MCP 伺服器後,請重啟編輯器。如遇錯誤,請檢查語法是否有遺漏括號或逗號。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## 🔧 環境變數
|
|
||||||
|
|
||||||
Context7 MCP 伺服器支援下列環境變數:
|
|
||||||
|
|
||||||
- `DEFAULT_MINIMUM_TOKENS`:設定文件擷取的最小 token 數(預設:10000)
|
|
||||||
|
|
||||||
範例設定:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"],
|
|
||||||
"env": {
|
|
||||||
"DEFAULT_MINIMUM_TOKENS": "6000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🔨 可用工具
|
|
||||||
|
|
||||||
Context7 MCP 提供下列工具供 LLM 使用:
|
|
||||||
|
|
||||||
- `resolve-library-id`:將一般函式庫名稱解析為 Context7 相容的函式庫 ID。
|
|
||||||
|
|
||||||
- `libraryName`(必填):要查詢的函式庫名稱
|
|
||||||
|
|
||||||
- `get-library-docs`:根據 Context7 相容的函式庫 ID 取得文件。
|
|
||||||
- `context7CompatibleLibraryID`(必填):Context7 相容的函式庫 ID(如 `/mongodb/docs`, `/vercel/next.js`)
|
|
||||||
- `topic`(選填):聚焦於特定主題(如 "routing", "hooks")
|
|
||||||
- `tokens`(選填,預設 10000):最大回傳 token 數。小於預設或 `DEFAULT_MINIMUM_TOKENS` 的值會自動提升。
|
|
||||||
|
|
||||||
## 💻 開發
|
|
||||||
|
|
||||||
複製專案並安裝依賴:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun i
|
|
||||||
```
|
|
||||||
|
|
||||||
建置:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run build
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>本地設定範例</b></summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>使用 MCP Inspector 測試</b></summary>
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## 🚨 疑難排解
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>找不到模組錯誤</b></summary>
|
|
||||||
|
|
||||||
若遇到 `ERR_MODULE_NOT_FOUND`,請嘗試用 `bunx` 取代 `npx`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "bunx",
|
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
這通常能解決 `npx` 無法正確安裝或解析套件的問題。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>ESM 解析問題</b></summary>
|
|
||||||
|
|
||||||
若出現 `Error: Cannot find module 'uriTemplate.js'`,請嘗試加上 `--experimental-vm-modules` 參數:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>TLS/憑證問題</b></summary>
|
|
||||||
|
|
||||||
可加上 `--experimental-fetch` 參數繞過 TLS 問題:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"context7": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>一般 MCP 客戶端錯誤</b></summary>
|
|
||||||
|
|
||||||
1. 嘗試加上 `@latest` 於套件名稱
|
|
||||||
2. 改用 `bunx` 取代 `npx`
|
|
||||||
3. 或改用 `deno`
|
|
||||||
4. 請確認 Node.js 版本為 v18 或以上,以支援原生 fetch
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## ⚠️ 免責聲明
|
|
||||||
|
|
||||||
Context7 專案由社群貢獻,雖然我們致力於維持高品質,但無法保證所有函式庫文件的正確性、完整性或安全性。Context7 上的專案由各自擁有者開發與維護,非 Context7 官方。若發現可疑、不當或潛在有害內容,請於專案頁面點選「檢舉」按鈕通知我們。我們會嚴肅處理所有檢舉,並盡快審查標記內容,以維護平台的完整性與安全。使用 Context7 即表示你同意自行承擔風險。
|
|
||||||
|
|
||||||
## 🤝 與我們聯繫
|
|
||||||
|
|
||||||
歡迎追蹤與加入社群:
|
|
||||||
|
|
||||||
- 📢 追蹤我們的 [X](https://x.com/contextai) 以獲取最新消息
|
|
||||||
- 🌐 造訪我們的 [官方網站](https://context7.com)
|
|
||||||
- 💬 加入我們的 [Discord 社群](https://upstash.com/discord)
|
|
||||||
|
|
||||||
## 📺 Context7 媒體報導
|
|
||||||
|
|
||||||
- [Better Stack:「免費工具讓 Cursor 智慧提升 10 倍」](https://youtu.be/52FC3qObp9E)
|
|
||||||
- [Cole Medin:「這絕對是 AI 程式助理最強 MCP 伺服器」](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
|
||||||
- [Income Stream Surfers:「Context7 + SequentialThinking MCPs:這是 AGI 嗎?」](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
|
||||||
- [Julian Goldie SEO:「Context7:全新 MCP AI 代理更新」](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
|
||||||
- [JeredBlu:「Context 7 MCP:即時獲取文件 + VS Code 設定」](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
|
||||||
- [Income Stream Surfers:「Context7:將改變 AI 程式開發的新 MCP 伺服器」](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
|
||||||
- [AICodeKing:「Context7 + Cline & RooCode:這個 MCP 伺服器讓 CLINE 效率提升 100 倍!」](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
|
||||||
- [Sean Kochel:「5 個 MCP 伺服器讓你程式開發如虎添翼(即插即用)」](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
|
||||||
|
|
||||||
## ⭐ 星標歷史
|
|
||||||
|
|
||||||
[](https://www.star-history.com/#upstash/context7&Date)
|
|
||||||
|
|
||||||
## 📄 授權
|
|
||||||
|
|
||||||
MIT
|
|
@ -1,118 +0,0 @@
|
|||||||
# Adding Projects to Context7
|
|
||||||
|
|
||||||
Context7 allows you to add your favorite libraries and frameworks to help developers get up-to-date documentation directly in their coding environment.
|
|
||||||
|
|
||||||
## Quick Submission
|
|
||||||
|
|
||||||
The easiest way to add a library is through our web interface:
|
|
||||||
|
|
||||||
**[Submit a Library →](https://context7.com/add-library?tab=github)**
|
|
||||||
|
|
||||||
Simply provide the GitHub repository URL and Context7 will automatically parse and index the project's documentation.
|
|
||||||
|
|
||||||
## Advanced Configuration with `context7.json`
|
|
||||||
|
|
||||||
For more control over how Context7 parses and presents your library, you can add a `context7.json` file to the root of your repository. This file works similar to `robots.txt` and tells Context7 how to handle your project.
|
|
||||||
|
|
||||||
### Configuration Fields
|
|
||||||
|
|
||||||
Here's an example `context7.json` file with all available options:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"$schema": "https://context7.com/schema/context7.json",
|
|
||||||
"projectTitle": "Upstash Ratelimit",
|
|
||||||
"description": "Ratelimiting library based on Upstash Redis",
|
|
||||||
"folders": [],
|
|
||||||
"excludeFolders": ["src"],
|
|
||||||
"excludeFiles": [],
|
|
||||||
"rules": ["Use Upstash Redis as a database", "Use single region set up"],
|
|
||||||
"previousVersions": [
|
|
||||||
{
|
|
||||||
"tag": "v1.2.1",
|
|
||||||
"title": "version 1.2.1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
> **💡 Pro Tip**: Including the `$schema` field enables autocomplete, validation, and helpful tooltips in modern code editors like VS Code, making it easier to create and maintain your configuration.
|
|
||||||
|
|
||||||
#### Field Descriptions
|
|
||||||
|
|
||||||
- **`projectTitle`** (string): The display name for your project in Context7. This overrides the default repository name.
|
|
||||||
|
|
||||||
- **`description`** (string): A brief description of what your library does. This helps coding agents understand the purpose of your project.
|
|
||||||
|
|
||||||
- **`folders`** (array): Specific folder paths to include when parsing documentation. If empty, Context7 will scan the entire repository for relevant documentation files. Supports regex patterns and requires full paths.
|
|
||||||
|
|
||||||
- **`excludeFolders`** (array): Folder paths to exclude from documentation parsing. Useful for excluding source code directories, build folders, or other non-documentation content. Supports regex patterns and requires full paths.
|
|
||||||
|
|
||||||
- **`excludeFiles`** (array): Specific file names to exclude from documentation parsing. Only include the filename (not the path). Useful for excluding files like `CHANGELOG.md`, license files, or other non-documentation content that might not be relevant for coding agents. Regex patterns are not supported.
|
|
||||||
|
|
||||||
- **`rules`** (array): Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context provided to coding agents.
|
|
||||||
|
|
||||||
- **`previousVersions`** (array): Information about previous versions of your library that should also be available in Context7.
|
|
||||||
- **`tag`**: The Git tag or version identifier
|
|
||||||
- **`title`**: Human-readable version name
|
|
||||||
|
|
||||||
### Default Exclusions
|
|
||||||
|
|
||||||
If you don't specify `excludeFiles` or `excludeFolders` in your `context7.json`, Context7 uses these default patterns:
|
|
||||||
|
|
||||||
#### Default Excluded Files
|
|
||||||
|
|
||||||
```
|
|
||||||
CHANGELOG.md, changelog.md, CHANGELOG.mdx, changelog.mdx
|
|
||||||
LICENSE.md, license.md
|
|
||||||
CODE_OF_CONDUCT.md, code_of_conduct.md
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Default Excluded Folders
|
|
||||||
|
|
||||||
```
|
|
||||||
*archive*, *archived*, old, docs/old, *deprecated*, *legacy*
|
|
||||||
*previous*, *outdated*, *superseded*
|
|
||||||
i18n/zh*, i18n/es*, i18n/fr*, i18n/de*, i18n/ja*, i18n/ko*
|
|
||||||
i18n/ru*, i18n/pt*, i18n/it*, i18n/ar*, i18n/hi*, i18n/tr*
|
|
||||||
i18n/nl*, i18n/pl*, i18n/sv*, i18n/vi*, i18n/th*
|
|
||||||
zh-cn, zh-tw, zh-hk, zh-mo, zh-sg
|
|
||||||
```
|
|
||||||
|
|
||||||
These defaults help ensure that coding agents receive relevant, current documentation without outdated or non-technical content.
|
|
||||||
|
|
||||||
## Who Can Add Configuration?
|
|
||||||
|
|
||||||
- **Library authors**: Add `context7.json` directly to your repository
|
|
||||||
- **Contributors**: Submit pull requests to add or update the configuration
|
|
||||||
- **Community members**: Propose improvements to how popular libraries are parsed
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
1. **Keep descriptions concise**: Aim for one clear sentence that explains your library's purpose to coding agents
|
|
||||||
2. **Exclude irrelevant folders**: Use `excludeFolders` to avoid indexing source code, tests, or build artifacts
|
|
||||||
3. **Add helpful rules**: Include common gotchas or best practices that coding agents should know when generating code
|
|
||||||
4. **Maintain version history**: Keep important previous versions accessible for projects that need older APIs
|
|
||||||
|
|
||||||
## Adding a Version
|
|
||||||
|
|
||||||
To add a new version to your existing library:
|
|
||||||
|
|
||||||
1. **Add version to the `context7.json` file**: Update the `previousVersions` array with your new version:
|
|
||||||
|
|
||||||
```json
|
|
||||||
"previousVersions": [
|
|
||||||
{
|
|
||||||
"tag": "v2.0.0",
|
|
||||||
"title": "version 2.0.0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Note**: The `tag` value must exactly match an existing Git tag in your GitHub repository.
|
|
||||||
|
|
||||||
2. **Refresh your library**: Go to your library page on Context7 and trigger a refresh to index the new version.
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
If you encounter issues or need assistance adding your project, please [report an issue](https://context7.com/add-library?tab=github) or reach out to our community.
|
|
10
package.json
10
package.json
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@upstash/context7-mcp",
|
"name": "@upstash/context7-mcp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.6",
|
||||||
"description": "MCP server for Context7",
|
"description": "MCP server for Context7",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "tsc && chmod 755 dist/index.js",
|
"build": "tsc && chmod 755 dist/index.js",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix"
|
||||||
"lint:check": "eslint \"**/*.{js,ts,tsx}\"",
|
|
||||||
"start": "node dist/index.js --transport http"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -33,8 +31,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/upstash/context7#readme",
|
"homepage": "https://github.com/upstash/context7#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
"@modelcontextprotocol/sdk": "^1.8.0",
|
||||||
"commander": "^14.0.0",
|
"dotenv": "^16.5.0",
|
||||||
"zod": "^3.24.2"
|
"zod": "^3.24.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"$id": "https://context7.com/schema/context7.json",
|
|
||||||
"title": "Context7 Configuration Schema",
|
|
||||||
"description": "Configuration file for Context7 project parsing and documentation generation",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"projectTitle": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The display name for your project in Context7. This overrides the default repository name.",
|
|
||||||
"minLength": 1,
|
|
||||||
"maxLength": 100,
|
|
||||||
"examples": ["Upstash Ratelimit", "Next.js", "React Query"]
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "A brief description of what your library does. This helps coding agents understand the purpose of your project.",
|
|
||||||
"minLength": 10,
|
|
||||||
"maxLength": 200,
|
|
||||||
"examples": [
|
|
||||||
"Ratelimiting library based on Upstash Redis",
|
|
||||||
"The React Framework for Production",
|
|
||||||
"Powerful data synchronization for React"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"folders": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Specific folder paths to include when parsing documentation. If empty, Context7 will scan the entire repository. Supports regex patterns and requires full paths.",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1
|
|
||||||
},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": [],
|
|
||||||
"examples": [
|
|
||||||
["docs", "guides", "examples"],
|
|
||||||
["documentation/**"],
|
|
||||||
["api-reference", "tutorials/*"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"excludeFolders": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Folder paths to exclude from documentation parsing. Supports regex patterns and requires full paths.",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1
|
|
||||||
},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": [],
|
|
||||||
"examples": [
|
|
||||||
["src", "build", "node_modules"],
|
|
||||||
["**/test/**", "**/tests/**"],
|
|
||||||
["legacy/*", "archive"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"excludeFiles": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Specific file names to exclude from documentation parsing. Only include the filename (not the path). Regex patterns are not supported.",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1,
|
|
||||||
"pattern": "^[^/\\\\]+$"
|
|
||||||
},
|
|
||||||
"uniqueItems": true,
|
|
||||||
"default": [],
|
|
||||||
"examples": [
|
|
||||||
["CHANGELOG.md", "LICENSE"],
|
|
||||||
["README-dev.md", "CONTRIBUTING.md"],
|
|
||||||
["package.json", "tsconfig.json"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context.",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 5,
|
|
||||||
"maxLength": 200
|
|
||||||
},
|
|
||||||
"default": [],
|
|
||||||
"examples": [
|
|
||||||
["Always use TypeScript for better type safety"],
|
|
||||||
["Use Upstash Redis as a database", "Use single region set up"],
|
|
||||||
["Import components from the main package", "Follow the naming conventions"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"previousVersions": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Information about previous versions of your library that should also be available in Context7.",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"tag": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The Git tag or version identifier",
|
|
||||||
"pattern": "^v?\\d+\\.\\d+\\.\\d+",
|
|
||||||
"examples": ["v1.2.1", "2.0.0", "v3.1.0-beta.1"]
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Human-readable version name",
|
|
||||||
"minLength": 1,
|
|
||||||
"maxLength": 50,
|
|
||||||
"examples": ["version 1.2.1", "Legacy Version", "Beta Release"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": ["tag", "title"],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"default": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false,
|
|
||||||
"examples": [
|
|
||||||
{
|
|
||||||
"projectTitle": "Upstash Ratelimit",
|
|
||||||
"description": "Ratelimiting library based on Upstash Redis",
|
|
||||||
"folders": [],
|
|
||||||
"excludeFolders": ["src"],
|
|
||||||
"excludeFiles": [],
|
|
||||||
"rules": ["Use Upstash Redis as a database", "Use single region set up"],
|
|
||||||
"previousVersions": [
|
|
||||||
{
|
|
||||||
"tag": "v1.2.1",
|
|
||||||
"title": "version 1.2.1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,9 +1,13 @@
|
|||||||
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
|
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
|
||||||
|
|
||||||
startCommand:
|
startCommand:
|
||||||
type: http
|
type: stdio
|
||||||
configSchema:
|
configSchema:
|
||||||
# JSON Schema defining the configuration options for the MCP.
|
# JSON Schema defining the configuration options for the MCP.
|
||||||
type: object
|
type: object
|
||||||
description: No configuration required
|
description: Empty configuration
|
||||||
|
commandFunction:
|
||||||
|
# A JS function that produces the CLI command based on the given config to start the MCP on stdio.
|
||||||
|
|-
|
||||||
|
(config) => ({ command: 'node', args: ['dist/index.js'] })
|
||||||
exampleConfig: {}
|
exampleConfig: {}
|
||||||
|
377
src/index.ts
377
src/index.ts
@ -5,292 +5,169 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { searchLibraries, fetchLibraryDocumentation } from "./lib/api.js";
|
import { searchLibraries, fetchLibraryDocumentation } from "./lib/api.js";
|
||||||
import { formatSearchResults } from "./lib/utils.js";
|
import { formatSearchResults } from "./lib/utils.js";
|
||||||
import { SearchResponse } from "./lib/types.js";
|
import dotenv from "dotenv";
|
||||||
import { createServer } from "http";
|
|
||||||
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
||||||
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
||||||
import { Command } from "commander";
|
|
||||||
|
|
||||||
const DEFAULT_MINIMUM_TOKENS = 10000;
|
// Load environment variables from .env file if present
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
// Parse CLI arguments using commander
|
// Get DEFAULT_MINIMUM_TOKENS from environment variable or use default
|
||||||
const program = new Command()
|
let DEFAULT_MINIMUM_TOKENS = 10000;
|
||||||
.option("--transport <stdio|http|sse>", "transport type", "stdio")
|
if (process.env.DEFAULT_MINIMUM_TOKENS) {
|
||||||
.option("--port <number>", "port for HTTP/SSE transport", "3000")
|
const parsedValue = parseInt(process.env.DEFAULT_MINIMUM_TOKENS, 10);
|
||||||
.allowUnknownOption() // let MCP Inspector / other wrappers pass through extra flags
|
if (!isNaN(parsedValue) && parsedValue > 0) {
|
||||||
.parse(process.argv);
|
DEFAULT_MINIMUM_TOKENS = parsedValue;
|
||||||
|
} else {
|
||||||
const cliOptions = program.opts<{
|
console.warn(
|
||||||
transport: string;
|
`Warning: Invalid DEFAULT_MINIMUM_TOKENS value provided in environment variable. Using default value of 10000`
|
||||||
port: string;
|
);
|
||||||
}>();
|
}
|
||||||
|
|
||||||
// Validate transport option
|
|
||||||
const allowedTransports = ["stdio", "http", "sse"];
|
|
||||||
if (!allowedTransports.includes(cliOptions.transport)) {
|
|
||||||
console.error(
|
|
||||||
`Invalid --transport value: '${cliOptions.transport}'. Must be one of: stdio, http, sse.`
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transport configuration
|
// Create server instance
|
||||||
const TRANSPORT_TYPE = (cliOptions.transport || "stdio") as "stdio" | "http" | "sse";
|
const server = new McpServer({
|
||||||
|
name: "Context7",
|
||||||
|
description: "Retrieves up-to-date documentation and code examples for any library.",
|
||||||
|
version: "1.0.6",
|
||||||
|
capabilities: {
|
||||||
|
resources: {},
|
||||||
|
tools: {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// HTTP/SSE port configuration
|
// Register Context7 tools
|
||||||
const CLI_PORT = (() => {
|
server.tool(
|
||||||
const parsed = parseInt(cliOptions.port, 10);
|
"resolve-library-id",
|
||||||
return isNaN(parsed) ? undefined : parsed;
|
`Resolves a package name to a Context7-compatible library ID and returns a list of matching libraries.
|
||||||
})();
|
|
||||||
|
|
||||||
// Store SSE transports by session ID
|
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID.
|
||||||
const sseTransports: Record<string, SSEServerTransport> = {};
|
|
||||||
|
|
||||||
// Function to create a new server instance with all tools registered
|
When selecting the best match, consider:
|
||||||
function createServerInstance() {
|
- Name similarity to the query
|
||||||
const server = new McpServer(
|
- Description relevance
|
||||||
{
|
- Code Snippet count (documentation coverage)
|
||||||
name: "Context7",
|
- GitHub Stars (popularity)
|
||||||
version: "1.0.13",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
instructions:
|
|
||||||
"Use this server to retrieve up-to-date documentation and code examples for any library.",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Register Context7 tools
|
Return the selected library ID and explain your choice. If there are multiple good matches, mention this but proceed with the most relevant one.`,
|
||||||
server.tool(
|
{
|
||||||
"resolve-library-id",
|
libraryName: z
|
||||||
`Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.
|
.string()
|
||||||
|
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
|
||||||
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
|
},
|
||||||
|
async ({ libraryName }) => {
|
||||||
Selection Process:
|
const searchResponse = await searchLibraries(libraryName);
|
||||||
1. Analyze the query to understand what library/package the user is looking for
|
|
||||||
2. Return the most relevant match based on:
|
|
||||||
- Name similarity to the query (exact matches prioritized)
|
|
||||||
- Description relevance to the query's intent
|
|
||||||
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
|
|
||||||
- Trust score (consider libraries with scores of 7-10 more authoritative)
|
|
||||||
|
|
||||||
Response Format:
|
|
||||||
- Return the selected library ID in a clearly marked section
|
|
||||||
- Provide a brief explanation for why this library was chosen
|
|
||||||
- If multiple good matches exist, acknowledge this but proceed with the most relevant one
|
|
||||||
- If no good matches exist, clearly state this and suggest query refinements
|
|
||||||
|
|
||||||
For ambiguous queries, request clarification before proceeding with a best-guess match.`,
|
|
||||||
{
|
|
||||||
libraryName: z
|
|
||||||
.string()
|
|
||||||
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
|
|
||||||
},
|
|
||||||
async ({ libraryName }) => {
|
|
||||||
const searchResponse: SearchResponse = await searchLibraries(libraryName);
|
|
||||||
|
|
||||||
if (!searchResponse.results || searchResponse.results.length === 0) {
|
|
||||||
return {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: searchResponse.error
|
|
||||||
? searchResponse.error
|
|
||||||
: "Failed to retrieve library documentation data from Context7",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const resultsText = formatSearchResults(searchResponse);
|
|
||||||
|
|
||||||
|
if (!searchResponse || !searchResponse.results) {
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: `Available Libraries (top matches):
|
text: "Failed to retrieve library documentation data from Context7",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchResponse.results.length === 0) {
|
||||||
|
return {
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: "No documentation libraries available",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const resultsText = formatSearchResults(searchResponse);
|
||||||
|
|
||||||
|
return {
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: `Available Libraries (top matches):
|
||||||
|
|
||||||
Each result includes:
|
Each result includes:
|
||||||
- Library ID: Context7-compatible identifier (format: /org/project)
|
- Library ID: Context7-compatible identifier (format: /org/repo)
|
||||||
- Name: Library or package name
|
- Name: Library or package name
|
||||||
- Description: Short summary
|
- Description: Short summary
|
||||||
- Code Snippets: Number of available code examples
|
- Code Snippets: Number of available code examples
|
||||||
- Trust Score: Authority indicator
|
- GitHub Stars: Popularity indicator
|
||||||
- Versions: List of versions if available. Use one of those versions if and only if the user explicitly provides a version in their query.
|
|
||||||
|
|
||||||
For best results, select libraries based on name match, trust score, snippet coverage, and relevance to your use case.
|
For best results, select libraries based on name match, popularity (stars), snippet coverage, and relevance to your use case.
|
||||||
|
|
||||||
----------
|
---
|
||||||
|
|
||||||
${resultsText}`,
|
${resultsText}`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
server.tool(
|
||||||
|
"get-library-docs",
|
||||||
|
"Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool.",
|
||||||
|
{
|
||||||
|
context7CompatibleLibraryID: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
"Exact Context7-compatible library ID (e.g., 'mongodb/docs', 'vercel/nextjs') retrieved from 'resolve-library-id'."
|
||||||
|
),
|
||||||
|
topic: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
|
||||||
|
tokens: z
|
||||||
|
.preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number())
|
||||||
|
.transform((val) => (val < DEFAULT_MINIMUM_TOKENS ? DEFAULT_MINIMUM_TOKENS : val))
|
||||||
|
.optional()
|
||||||
|
.describe(
|
||||||
|
`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`
|
||||||
|
),
|
||||||
|
},
|
||||||
|
async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
|
||||||
|
// Extract folders parameter if present in the ID
|
||||||
|
let folders = "";
|
||||||
|
let libraryId = context7CompatibleLibraryID;
|
||||||
|
|
||||||
|
if (context7CompatibleLibraryID.includes("?folders=")) {
|
||||||
|
const [id, foldersParam] = context7CompatibleLibraryID.split("?folders=");
|
||||||
|
libraryId = id;
|
||||||
|
folders = foldersParam;
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
server.tool(
|
const documentationText = await fetchLibraryDocumentation(libraryId, {
|
||||||
"get-library-docs",
|
tokens,
|
||||||
"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.",
|
topic,
|
||||||
{
|
folders,
|
||||||
context7CompatibleLibraryID: z
|
});
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
"Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'."
|
|
||||||
),
|
|
||||||
topic: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
|
|
||||||
tokens: z
|
|
||||||
.preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number())
|
|
||||||
.transform((val) => (val < DEFAULT_MINIMUM_TOKENS ? DEFAULT_MINIMUM_TOKENS : val))
|
|
||||||
.optional()
|
|
||||||
.describe(
|
|
||||||
`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`
|
|
||||||
),
|
|
||||||
},
|
|
||||||
async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
|
|
||||||
const fetchDocsResponse = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
|
|
||||||
tokens,
|
|
||||||
topic,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!fetchDocsResponse) {
|
|
||||||
return {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
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.",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!documentationText) {
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: fetchDocsResponse,
|
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.",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
return server;
|
return {
|
||||||
}
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: documentationText,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const transportType = TRANSPORT_TYPE;
|
const transport = new StdioServerTransport();
|
||||||
|
await server.connect(transport);
|
||||||
if (transportType === "http" || transportType === "sse") {
|
console.error("Context7 Documentation MCP Server running on stdio");
|
||||||
// Get initial port from environment or use default
|
|
||||||
const initialPort = CLI_PORT ?? 3000;
|
|
||||||
// Keep track of which port we end up using
|
|
||||||
let actualPort = initialPort;
|
|
||||||
const httpServer = createServer(async (req, res) => {
|
|
||||||
const url = new URL(req.url || "", `http://${req.headers.host}`).pathname;
|
|
||||||
|
|
||||||
// Set CORS headers for all responses
|
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
res.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,DELETE");
|
|
||||||
res.setHeader("Access-Control-Allow-Headers", "Content-Type, MCP-Session-Id, mcp-session-id");
|
|
||||||
|
|
||||||
// Handle preflight OPTIONS requests
|
|
||||||
if (req.method === "OPTIONS") {
|
|
||||||
res.writeHead(200);
|
|
||||||
res.end();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Create new server instance for each request
|
|
||||||
const requestServer = createServerInstance();
|
|
||||||
|
|
||||||
if (url === "/mcp") {
|
|
||||||
const transport = new StreamableHTTPServerTransport({
|
|
||||||
sessionIdGenerator: undefined,
|
|
||||||
});
|
|
||||||
await requestServer.connect(transport);
|
|
||||||
await transport.handleRequest(req, res);
|
|
||||||
} else if (url === "/sse" && req.method === "GET") {
|
|
||||||
// Create new SSE transport for GET request
|
|
||||||
const sseTransport = new SSEServerTransport("/messages", res);
|
|
||||||
// Store the transport by session ID
|
|
||||||
sseTransports[sseTransport.sessionId] = sseTransport;
|
|
||||||
// Clean up transport when connection closes
|
|
||||||
res.on("close", () => {
|
|
||||||
delete sseTransports[sseTransport.sessionId];
|
|
||||||
});
|
|
||||||
await requestServer.connect(sseTransport);
|
|
||||||
} else if (url === "/messages" && req.method === "POST") {
|
|
||||||
// Get session ID from query parameters
|
|
||||||
const sessionId =
|
|
||||||
new URL(req.url || "", `http://${req.headers.host}`).searchParams.get("sessionId") ??
|
|
||||||
"";
|
|
||||||
|
|
||||||
if (!sessionId) {
|
|
||||||
res.writeHead(400);
|
|
||||||
res.end("Missing sessionId parameter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get existing transport for this session
|
|
||||||
const sseTransport = sseTransports[sessionId];
|
|
||||||
if (!sseTransport) {
|
|
||||||
res.writeHead(400);
|
|
||||||
res.end(`No transport found for sessionId: ${sessionId}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the POST message with the existing transport
|
|
||||||
await sseTransport.handlePostMessage(req, res);
|
|
||||||
} else if (url === "/ping") {
|
|
||||||
res.writeHead(200, { "Content-Type": "text/plain" });
|
|
||||||
res.end("pong");
|
|
||||||
} else {
|
|
||||||
res.writeHead(404);
|
|
||||||
res.end("Not found");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error handling request:", error);
|
|
||||||
if (!res.headersSent) {
|
|
||||||
res.writeHead(500);
|
|
||||||
res.end("Internal Server Error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to attempt server listen with port fallback
|
|
||||||
const startServer = (port: number, maxAttempts = 10) => {
|
|
||||||
httpServer.once("error", (err: NodeJS.ErrnoException) => {
|
|
||||||
if (err.code === "EADDRINUSE" && port < initialPort + maxAttempts) {
|
|
||||||
console.warn(`Port ${port} is in use, trying port ${port + 1}...`);
|
|
||||||
startServer(port + 1, maxAttempts);
|
|
||||||
} else {
|
|
||||||
console.error(`Failed to start server: ${err.message}`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
httpServer.listen(port, () => {
|
|
||||||
actualPort = port;
|
|
||||||
console.error(
|
|
||||||
`Context7 Documentation MCP Server running on ${transportType.toUpperCase()} at http://localhost:${actualPort}/mcp and legacy SSE at /sse`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start the server with initial port
|
|
||||||
startServer(initialPort);
|
|
||||||
} else {
|
|
||||||
// Stdio transport - this is already stateless by nature
|
|
||||||
const server = createServerInstance();
|
|
||||||
const transport = new StdioServerTransport();
|
|
||||||
await server.connect(transport);
|
|
||||||
console.error("Context7 Documentation MCP Server running on stdio");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
main().catch((error) => {
|
||||||
|
@ -8,30 +8,19 @@ const DEFAULT_TYPE = "txt";
|
|||||||
* @param query The search query
|
* @param query The search query
|
||||||
* @returns Search results or null if the request fails
|
* @returns Search results or null if the request fails
|
||||||
*/
|
*/
|
||||||
export async function searchLibraries(query: string): Promise<SearchResponse> {
|
export async function searchLibraries(query: string): Promise<SearchResponse | null> {
|
||||||
try {
|
try {
|
||||||
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/search`);
|
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/search`);
|
||||||
url.searchParams.set("query", query);
|
url.searchParams.set("query", query);
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorCode = response.status;
|
console.error(`Failed to search libraries: ${response.status}`);
|
||||||
if (errorCode === 429) {
|
return null;
|
||||||
console.error(`Rate limited due to too many requests. Please try again later.`);
|
|
||||||
return {
|
|
||||||
results: [],
|
|
||||||
error: `Rate limited due to too many requests. Please try again later.`,
|
|
||||||
} as SearchResponse;
|
|
||||||
}
|
|
||||||
console.error(`Failed to search libraries. Please try again later. Error code: ${errorCode}`);
|
|
||||||
return {
|
|
||||||
results: [],
|
|
||||||
error: `Failed to search libraries. Please try again later. Error code: ${errorCode}`,
|
|
||||||
} as SearchResponse;
|
|
||||||
}
|
}
|
||||||
return await response.json();
|
return await response.json();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error searching libraries:", error);
|
console.error("Error searching libraries:", error);
|
||||||
return { results: [], error: `Error searching libraries: ${error}` } as SearchResponse;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +35,7 @@ export async function fetchLibraryDocumentation(
|
|||||||
options: {
|
options: {
|
||||||
tokens?: number;
|
tokens?: number;
|
||||||
topic?: string;
|
topic?: string;
|
||||||
|
folders?: string;
|
||||||
} = {}
|
} = {}
|
||||||
): Promise<string | null> {
|
): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
@ -55,6 +45,7 @@ export async function fetchLibraryDocumentation(
|
|||||||
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/${libraryId}`);
|
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/${libraryId}`);
|
||||||
if (options.tokens) url.searchParams.set("tokens", options.tokens.toString());
|
if (options.tokens) url.searchParams.set("tokens", options.tokens.toString());
|
||||||
if (options.topic) url.searchParams.set("topic", options.topic);
|
if (options.topic) url.searchParams.set("topic", options.topic);
|
||||||
|
if (options.folders) url.searchParams.set("folders", options.folders);
|
||||||
url.searchParams.set("type", DEFAULT_TYPE);
|
url.searchParams.set("type", DEFAULT_TYPE);
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
@ -62,15 +53,8 @@ export async function fetchLibraryDocumentation(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorCode = response.status;
|
console.error(`Failed to fetch documentation: ${response.status}`);
|
||||||
if (errorCode === 429) {
|
return null;
|
||||||
const errorMessage = `Rate limited due to too many requests. Please try again later.`;
|
|
||||||
console.error(errorMessage);
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
const errorMessage = `Failed to fetch documentation. Please try again later. Error code: ${errorCode}`;
|
|
||||||
console.error(errorMessage);
|
|
||||||
return errorMessage;
|
|
||||||
}
|
}
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
if (!text || text === "No content available" || text === "No context data available") {
|
if (!text || text === "No content available" || text === "No context data available") {
|
||||||
@ -78,8 +62,7 @@ export async function fetchLibraryDocumentation(
|
|||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMessage = `Error fetching library documentation. Please try again later. ${error}`;
|
console.error("Error fetching library documentation:", error);
|
||||||
console.error(errorMessage);
|
return null;
|
||||||
return errorMessage;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
export interface SearchResult {
|
export interface SearchResult {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description?: string;
|
||||||
branch: string;
|
branch: string;
|
||||||
lastUpdateDate: string;
|
lastUpdate: string;
|
||||||
state: DocumentState;
|
state: DocumentState;
|
||||||
totalTokens: number;
|
totalTokens: number;
|
||||||
totalSnippets: number;
|
totalSnippets: number;
|
||||||
totalPages: number;
|
totalPages: number;
|
||||||
stars?: number;
|
stars: number;
|
||||||
trustScore?: number;
|
|
||||||
versions?: string[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchResponse {
|
export interface SearchResponse {
|
||||||
error?: string;
|
|
||||||
results: SearchResult[];
|
results: SearchResult[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,45 +1,22 @@
|
|||||||
import { SearchResponse, SearchResult } from "./types.js";
|
import { SearchResponse, SearchResult } from "./types.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a search result into a human-readable string representation.
|
* Format a search result into a string representation
|
||||||
* Only shows code snippet count and GitHub stars when available (not equal to -1).
|
* @param result SearchResult to format
|
||||||
*
|
* @returns Formatted search result string
|
||||||
* @param result The SearchResult object to format
|
|
||||||
* @returns A formatted string with library information
|
|
||||||
*/
|
*/
|
||||||
export function formatSearchResult(result: SearchResult): string {
|
export function formatSearchResult(result: SearchResult): string {
|
||||||
// Always include these basic details
|
return `- Title: ${result.title}
|
||||||
const formattedResult = [
|
- Context7-compatible library ID: ${result.id}
|
||||||
`- Title: ${result.title}`,
|
- Description: ${result.description}
|
||||||
`- Context7-compatible library ID: ${result.id}`,
|
- Code Snippets: ${result.totalSnippets}
|
||||||
`- Description: ${result.description}`,
|
- GitHub Stars: ${result.stars}`;
|
||||||
];
|
|
||||||
|
|
||||||
// Only add code snippets count if it's a valid value
|
|
||||||
if (result.totalSnippets !== -1 && result.totalSnippets !== undefined) {
|
|
||||||
formattedResult.push(`- Code Snippets: ${result.totalSnippets}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only add trust score if it's a valid value
|
|
||||||
if (result.trustScore !== -1 && result.trustScore !== undefined) {
|
|
||||||
formattedResult.push(`- Trust Score: ${result.trustScore}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only add versions if it's a valid value
|
|
||||||
if (result.versions !== undefined && result.versions.length > 0) {
|
|
||||||
formattedResult.push(`- Versions: ${result.versions.join(", ")}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Join all parts with newlines
|
|
||||||
return formattedResult.join("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a search response into a human-readable string representation.
|
* Format search results into a string representation
|
||||||
* Each result is formatted using formatSearchResult.
|
* @param searchResponse The search response to format
|
||||||
*
|
* @returns Formatted search results string
|
||||||
* @param searchResponse The SearchResponse object to format
|
|
||||||
* @returns A formatted string with search results
|
|
||||||
*/
|
*/
|
||||||
export function formatSearchResults(searchResponse: SearchResponse): string {
|
export function formatSearchResults(searchResponse: SearchResponse): string {
|
||||||
if (!searchResponse.results || searchResponse.results.length === 0) {
|
if (!searchResponse.results || searchResponse.results.length === 0) {
|
||||||
@ -47,5 +24,5 @@ export function formatSearchResults(searchResponse: SearchResponse): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formattedResults = searchResponse.results.map(formatSearchResult);
|
const formattedResults = searchResponse.results.map(formatSearchResult);
|
||||||
return formattedResults.join("\n----------\n");
|
return formattedResults.join("\n---\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user