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
|
||||
|
||||
- name: Set env
|
||||
run: |
|
||||
VERSION="${GITHUB_REF##refs/*/}"
|
||||
# Remove 'v' prefix if it exists
|
||||
VERSION="${VERSION#v}"
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -173,4 +173,3 @@ dist
|
||||
|
||||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
package-lock.json
|
||||
|
@ -25,8 +25,7 @@ COPY package.json ./
|
||||
# Install only production dependencies
|
||||
RUN npm install --production --ignore-scripts
|
||||
|
||||
# Expose HTTP port
|
||||
EXPOSE 8080
|
||||
# Expose no ports (stdio only)
|
||||
|
||||
# Default command using CLI flags
|
||||
CMD ["node", "dist/index.js", "--transport", "http", "--port", "8080"]
|
||||
# Default command
|
||||
CMD ["node", "dist/index.js"]
|
||||
|
661
README.md
661
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
[](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)
|
||||
[](./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)
|
||||
|
||||
## ❌ Without Context7
|
||||
|
||||
@ -19,11 +19,11 @@ Context7 MCP pulls up-to-date, version-specific documentation and code examples
|
||||
Add `use context7` to your prompt in Cursor:
|
||||
|
||||
```txt
|
||||
Create a Next.js middleware that checks for a valid JWT in cookies and redirects unauthenticated users to `/login`. use context7
|
||||
Create a basic Next.js project with app router. use context7
|
||||
```
|
||||
|
||||
```txt
|
||||
Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7
|
||||
Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7
|
||||
```
|
||||
|
||||
Context7 fetches up-to-date code examples and documentation right into your LLM's context.
|
||||
@ -34,63 +34,33 @@ Context7 fetches up-to-date code examples and documentation right into your LLM'
|
||||
|
||||
No tab-switching, no hallucinated APIs that don't exist, no outdated code generations.
|
||||
|
||||
## 📚 Adding Projects
|
||||
|
||||
Check out our [project addition guide](./docs/adding-projects.md) to learn how to add (or update) your favorite libraries to Context7.
|
||||
|
||||
## 🛠️ Installation
|
||||
## 🛠️ Getting Started
|
||||
|
||||
### Requirements
|
||||
|
||||
- Node.js >= v18.0.0
|
||||
- Cursor, Windsurf, Claude Desktop or another MCP Client
|
||||
|
||||
<details>
|
||||
<summary><b>Installing via Smithery</b></summary>
|
||||
### Installing via Smithery
|
||||
|
||||
To install Context7 MCP Server for any client automatically via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
|
||||
To install Context7 MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
You can find your Smithery key in the [Smithery.ai webpage](https://smithery.ai/server/@upstash/context7-mcp).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Cursor</b></summary>
|
||||
### Install in Cursor
|
||||
|
||||
Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
|
||||
|
||||
Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file is the recommended approach. You may also install in a specific project by creating `.cursor/mcp.json` in your project folder. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
|
||||
|
||||
> Since Cursor 1.0, you can click the install button below for instant one-click installation.
|
||||
|
||||
#### Cursor Remote Server Connection
|
||||
|
||||
[](https://cursor.com/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Cursor Local Server Connection
|
||||
|
||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,14 +69,12 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
||||
<details>
|
||||
<summary>Alternative: Use Bun</summary>
|
||||
|
||||
[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D)
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "bunx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,14 +85,12 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
||||
<details>
|
||||
<summary>Alternative: Use 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"]
|
||||
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,154 +98,41 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
||||
|
||||
</details>
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Windsurf</b></summary>
|
||||
### Install in Windsurf
|
||||
|
||||
Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.windsurf.com/windsurf/mcp) for more info.
|
||||
|
||||
#### Windsurf Remote Server Connection
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"serverUrl": "https://mcp.context7.com/sse"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Windsurf Local Server Connection
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Trae</b></summary>
|
||||
|
||||
Use the Add manually feature and fill in the JSON configuration information for that MCP server.
|
||||
For more details, visit the [Trae documentation](https://docs.trae.ai/ide/model-context-protocol?_lang=en).
|
||||
|
||||
#### Trae Remote Server Connection
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Trae Local Server Connection
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@upstash/context7-mcp"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in VS Code</b></summary>
|
||||
### Install in VS Code
|
||||
|
||||
[<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
||||
[<img alt="Install in VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
||||
|
||||
Add this to your VS Code MCP config file. See [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more info.
|
||||
|
||||
#### VS Code Remote Server Connection
|
||||
|
||||
```json
|
||||
"mcp": {
|
||||
"servers": {
|
||||
"context7": {
|
||||
"type": "http",
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### VS Code Local Server Connection
|
||||
|
||||
```json
|
||||
"mcp": {
|
||||
"servers": {
|
||||
"context7": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Visual Studio 2022</b></summary>
|
||||
|
||||
You can configure Context7 MCP in Visual Studio 2022 by following the [Visual Studio MCP Servers documentation](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
|
||||
|
||||
Add this to your Visual Studio MCP config file (see the [Visual Studio docs](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) for details):
|
||||
|
||||
```json
|
||||
{
|
||||
"mcp": {
|
||||
"servers": {
|
||||
"context7": {
|
||||
"type": "http",
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or, for a local server:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcp": {
|
||||
"servers": {
|
||||
"context7": {
|
||||
"Context7": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information and troubleshooting, refer to the [Visual Studio MCP Servers documentation](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022).
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Zed</b></summary>
|
||||
### Install in Zed
|
||||
|
||||
It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Context7) or you can add this to your Zed `settings.json`. See [Zed Context Server docs](https://zed.dev/docs/assistant/context-servers) for more info.
|
||||
|
||||
@ -289,7 +142,7 @@ It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Contex
|
||||
"Context7": {
|
||||
"command": {
|
||||
"path": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
},
|
||||
"settings": {}
|
||||
}
|
||||
@ -297,58 +150,15 @@ It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Contex
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Gemini CLI</b></summary>
|
||||
|
||||
See [Gemini CLI Configuration](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md) for details.
|
||||
|
||||
1. Open the Gemini CLI settings file. The location is `~/.gemini/settings.json` (where `~` is your home directory).
|
||||
2. Add the following to the `mcpServers` object in your `settings.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If the `mcpServers` object does not exist, create it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Claude Code</b></summary>
|
||||
### Install in Claude Code
|
||||
|
||||
Run this command. See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) for more info.
|
||||
|
||||
#### Claude Code Remote Server Connection
|
||||
|
||||
```sh
|
||||
claude mcp add --transport http context7 https://mcp.context7.com/mcp
|
||||
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
Or using SSE transport:
|
||||
|
||||
```sh
|
||||
claude mcp add --transport sse context7 https://mcp.context7.com/sse
|
||||
```
|
||||
|
||||
#### Claude Code Local Server Connection
|
||||
|
||||
```sh
|
||||
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Claude Desktop</b></summary>
|
||||
### Install in Claude Desktop
|
||||
|
||||
Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user) for more info.
|
||||
|
||||
@ -357,50 +167,13 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D
|
||||
"mcpServers": {
|
||||
"Context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<b>Install in Cline</b>
|
||||
</summary>
|
||||
|
||||
You can easily install Context7 through the [Cline MCP Server Marketplace](https://cline.bot/mcp-marketplace) by following these instructions:
|
||||
|
||||
1. Open **Cline**.
|
||||
1. Click the hamburger menu icon (☰) to enter the **MCP Servers** section.
|
||||
2. Use the search bar within the **Marketplace** tab to find *Context7*.
|
||||
3. Click the **Install** button.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in BoltAI</b></summary>
|
||||
|
||||
Open the "Settings" page of the app, navigate to "Plugins," and enter the following JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Once saved, enter in the chat `get-library-docs` followed by your Context7 documentation ID (e.g., `get-library-docs /nuxt/ui`). More information is available on [BoltAI's Documentation site](https://docs.boltai.com/docs/plugins/mcp-servers). For BoltAI on iOS, [see this guide](https://docs.boltai.com/docs/boltai-mobile/mcp-servers).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Using Docker</b></summary>
|
||||
### Using Docker
|
||||
|
||||
If you prefer to run the MCP server in a Docker container:
|
||||
|
||||
@ -417,7 +190,7 @@ If you prefer to run the MCP server in a Docker container:
|
||||
WORKDIR /app
|
||||
|
||||
# Install the latest version globally
|
||||
RUN npm install -g @upstash/context7-mcp
|
||||
RUN npm install -g @upstash/context7-mcp@latest
|
||||
|
||||
# Expose default port if needed (optional, depends on MCP client interaction)
|
||||
# EXPOSE 3000
|
||||
@ -438,7 +211,7 @@ If you prefer to run the MCP server in a Docker container:
|
||||
|
||||
Update your MCP client's configuration to use the Docker command.
|
||||
|
||||
_Example for a cline_mcp_settings.json:_
|
||||
*Example for a cline_mcp_settings.json:*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -455,291 +228,38 @@ If you prefer to run the MCP server in a Docker container:
|
||||
}
|
||||
```
|
||||
|
||||
_Note: This is an example configuration. Please refer to the specific examples for your MCP client (like Cursor, VS Code, etc.) earlier in this README to adapt the structure (e.g., `mcpServers` vs `servers`). Also, ensure the image name in `args` matches the tag used during the `docker build` command._
|
||||
*Note: This is an example configuration. Please refer to the specific examples for your MCP client (like Cursor, VS Code, etc.) earlier in this README to adapt the structure (e.g., `mcpServers` vs `servers`). Also, ensure the image name in `args` matches the tag used during the `docker build` command.*
|
||||
|
||||
</details>
|
||||
### Environment Variables
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Windows</b></summary>
|
||||
- `DEFAULT_MINIMUM_TOKENS`: Set the minimum token count for documentation retrieval (default: 10000).
|
||||
|
||||
The configuration on Windows is slightly different compared to Linux or macOS (_`Cline` is used in the example_). The same principle applies to other editors; refer to the configuration of `command` and `args`.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"github.com/upstash/context7-mcp": {
|
||||
"command": "cmd",
|
||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
||||
"disabled": false,
|
||||
"autoApprove": []
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Augment Code</b></summary>
|
||||
|
||||
To configure Context7 MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
|
||||
### **A. Using the Augment Code UI**
|
||||
|
||||
1. Click the hamburger menu.
|
||||
2. Select **Settings**.
|
||||
3. Navigate to the **Tools** section.
|
||||
4. Click the **+ Add MCP** button.
|
||||
5. Enter the following command:
|
||||
|
||||
```
|
||||
npx -y @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
6. Name the MCP: **Context7**.
|
||||
7. Click the **Add** button.
|
||||
|
||||
Once the MCP server is added, you can start using Context7's up-to-date code documentation features directly within Augment Code.
|
||||
|
||||
---
|
||||
|
||||
### **B. Manual Configuration**
|
||||
|
||||
1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
|
||||
2. Select Edit Settings
|
||||
3. Under Advanced, click Edit in settings.json
|
||||
4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object
|
||||
|
||||
"augment.advanced": {
|
||||
"mcpServers": [
|
||||
{
|
||||
"name": "context7",
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Once the MCP server is added, restart your editor. If you receive any errors, check the syntax to make sure closing brackets or commas are not missing.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Roo Code</b></summary>
|
||||
|
||||
Add this to your Roo Code MCP configuration file. See [Roo Code MCP docs](https://docs.roocode.com/features/mcp/using-mcp-in-roo) for more info.
|
||||
|
||||
#### Roo Code Remote Server Connection
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"type": "streamable-http",
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Roo Code Local Server Connection
|
||||
Examples:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"],
|
||||
"env": {
|
||||
"DEFAULT_MINIMUM_TOKENS": "10000"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Zencoder</b></summary>
|
||||
|
||||
To configure Context7 MCP in Zencoder, follow these steps:
|
||||
|
||||
1. Go to the Zencoder menu (...)
|
||||
2. From the dropdown menu, select Agent tools
|
||||
3. Click on the Add custom MCP
|
||||
4. Add the name and server configuration from below, and make sure to hit the Install button
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@upstash/context7-mcp@latest"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Once the MCP server is added, you can easily continue using it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Amazon Q Developer CLI</b></summary>
|
||||
|
||||
Add this to your Amazon Q Developer CLI configuration file. See [Amazon Q Developer CLI docs](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) for more details.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Qodo Gen</b></summary>
|
||||
|
||||
See [Qodo Gen docs](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps) for more details.
|
||||
|
||||
1. Open Qodo Gen chat panel in VSCode or IntelliJ.
|
||||
2. Click Connect more tools.
|
||||
3. Click + Add new MCP.
|
||||
4. Add the following configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in JetBrains AI Assistant</b></summary>
|
||||
|
||||
See [JetBrains AI Assistant Documentation](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html) for more details.
|
||||
|
||||
1. In JetBrains IDEs go to `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`
|
||||
2. Click `+ Add`.
|
||||
3. Click on `Command` in the top-left corner of the dialog and select the As JSON option from the list
|
||||
4. Add this configuration and click `OK`
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
5. Click `Apply` to save changes.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Warp</b></summary>
|
||||
|
||||
See [Warp Model Context Protocol Documentation](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server) for details.
|
||||
|
||||
1. Navigate `Settings` > `AI` > `Manage MCP servers`.
|
||||
2. Add a new MCP server by clicking the `+ Add` button.
|
||||
3. Paste the configuration given below:
|
||||
|
||||
```json
|
||||
{
|
||||
"Context7": {
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@upstash/context7-mcp"
|
||||
],
|
||||
"env": {},
|
||||
"working_directory": null,
|
||||
"start_on_launch": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. Click `Save` to apply the changes.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Install in Opencode</b></summary>
|
||||
|
||||
Add this to your Opencode configuration file. See [Opencode MCP docs](https://opencode.ai/docs/mcp-servers) docs for more info.
|
||||
|
||||
#### Opencode Remote Server Connection
|
||||
|
||||
```json
|
||||
"mcp": {
|
||||
"context7": {
|
||||
"type": "remote",
|
||||
"url": "https://mcp.context7.com/mcp",
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Opencode Local Server Connection
|
||||
|
||||
```json
|
||||
|
||||
{
|
||||
"mcp": {
|
||||
"context7": {
|
||||
"type": "local",
|
||||
"command": ["npx", "-y", "@upstash/context7-mcp"],
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 🔨 Available Tools
|
||||
|
||||
Context7 MCP provides the following tools that LLMs can use:
|
||||
### Available Tools
|
||||
|
||||
- `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
|
||||
|
||||
- `libraryName` (required): The name of the library to search for
|
||||
|
||||
- `libraryName` (required)
|
||||
- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
|
||||
- `context7CompatibleLibraryID` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
|
||||
- `context7CompatibleLibraryID` (required)
|
||||
- `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")
|
||||
- `tokens` (optional, default 10000): Max number of tokens to return. Values less than the default value of 10000 are automatically increased to 10000.
|
||||
- `tokens` (optional, default 10000): Max number of tokens to return. Values less than the configured `DEFAULT_MINIMUM_TOKENS` value or the default value of 10000 are automatically increased to that value.
|
||||
|
||||
## 🛟 Tips
|
||||
|
||||
### Add a Rule
|
||||
> If you don’t want to add `use context7` to every prompt, you can define a simple rule in your `.windsurfrules` file in Windsurf or from `Cursor Settings > Rules` section in Cursor (or the equivalent in your MCP client) to auto-invoke Context7 on any code question:
|
||||
> ```toml
|
||||
> [[calls]]
|
||||
> match = "when the user requests code examples, setup or configuration steps, or library/API documentation"
|
||||
> tool = "context7"
|
||||
> ```
|
||||
> From then on you’ll get Context7’s docs in any related conversation without typing anything extra. You can add your use cases to the match part.
|
||||
|
||||
### Use Library Id
|
||||
> If you already know exactly which library you want to use, add its Context7 ID to your prompt. That way, Context7 MCP server can skip the library-matching step and directly continue with retrieving docs.
|
||||
> ```txt
|
||||
> implement basic authentication with supabase. use library /supabase/supabase for api and docs
|
||||
> ```
|
||||
> The slash syntax tells the MCP tool exactly which library to load docs for.
|
||||
|
||||
|
||||
|
||||
## 💻 Development
|
||||
## Development
|
||||
|
||||
Clone the project and install dependencies:
|
||||
|
||||
@ -753,27 +273,7 @@ Build:
|
||||
bun run build
|
||||
```
|
||||
|
||||
Run the server:
|
||||
|
||||
```bash
|
||||
bun run dist/index.js
|
||||
```
|
||||
|
||||
### CLI Arguments
|
||||
|
||||
`context7-mcp` accepts the following CLI flags:
|
||||
|
||||
- `--transport <stdio|http|sse>` – Transport to use (`stdio` by default).
|
||||
- `--port <number>` – Port to listen on when using `http` or `sse` transport (default `3000`).
|
||||
|
||||
Example with http transport and port 8080:
|
||||
|
||||
```bash
|
||||
bun run dist/index.js --transport http --port 8080
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><b>Local Configuration Example</b></summary>
|
||||
### Local Configuration Example
|
||||
|
||||
```json
|
||||
{
|
||||
@ -786,112 +286,79 @@ bun run dist/index.js --transport http --port 8080
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Testing with MCP Inspector</b></summary>
|
||||
### Testing with MCP Inspector
|
||||
|
||||
```bash
|
||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
</details>
|
||||
## Troubleshooting
|
||||
|
||||
## 🚨 Troubleshooting
|
||||
### ERR_MODULE_NOT_FOUND
|
||||
|
||||
<details>
|
||||
<summary><b>Module Not Found Errors</b></summary>
|
||||
|
||||
If you encounter `ERR_MODULE_NOT_FOUND`, try using `bunx` instead of `npx`:
|
||||
If you see this error, try using `bunx` instead of `npx`.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "bunx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This often resolves module resolution issues in environments where `npx` doesn't properly install or resolve packages.
|
||||
This often resolves module resolution issues, especially in environments where `npx` does not properly install or resolve packages.
|
||||
|
||||
</details>
|
||||
### ESM Resolution Issues
|
||||
|
||||
<details>
|
||||
<summary><b>ESM Resolution Issues</b></summary>
|
||||
|
||||
For errors like `Error: Cannot find module 'uriTemplate.js'`, try the `--experimental-vm-modules` flag:
|
||||
If you encounter an error like: `Error: Cannot find module 'uriTemplate.js'` try running with the `--experimental-vm-modules` flag:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
||||
"args": [
|
||||
"-y",
|
||||
"--node-options=--experimental-vm-modules",
|
||||
"@upstash/context7-mcp@1.0.6"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
### MCP Client Errors
|
||||
|
||||
<details>
|
||||
<summary><b>TLS/Certificate Issues</b></summary>
|
||||
1. Try removing `@latest` from the package name.
|
||||
|
||||
Use the `--experimental-fetch` flag to bypass TLS-related problems:
|
||||
2. Try using `bunx` as an alternative.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
3. Try using `deno` as an alternative.
|
||||
|
||||
</details>
|
||||
4. Make sure you are using Node v18 or higher to have native fetch support with `npx`.
|
||||
|
||||
<details>
|
||||
<summary><b>General MCP Client Errors</b></summary>
|
||||
|
||||
1. Try adding `@latest` to the package name
|
||||
2. Use `bunx` as an alternative to `npx`
|
||||
3. Consider using `deno` as another alternative
|
||||
4. Ensure you're using Node.js v18 or higher for native fetch support
|
||||
|
||||
</details>
|
||||
|
||||
## ⚠️ Disclaimer
|
||||
## Disclaimer
|
||||
|
||||
Context7 projects are community-contributed and while we strive to maintain high quality, we cannot guarantee the accuracy, completeness, or security of all library documentation. Projects listed in Context7 are developed and maintained by their respective owners, not by Context7. If you encounter any suspicious, inappropriate, or potentially harmful content, please use the "Report" button on the project page to notify us immediately. We take all reports seriously and will review flagged content promptly to maintain the integrity and safety of our platform. By using Context7, you acknowledge that you do so at your own discretion and risk.
|
||||
|
||||
## 🤝 Connect with Us
|
||||
|
||||
Stay updated and join our community:
|
||||
|
||||
- 📢 Follow us on [X](https://x.com/contextai) for the latest news and updates
|
||||
- 🌐 Visit our [Website](https://context7.com)
|
||||
- 💬 Join our [Discord Community](https://upstash.com/discord)
|
||||
|
||||
## 📺 Context7 In Media
|
||||
## Context7 In Media
|
||||
|
||||
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
|
||||
- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
||||
- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
||||
- [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
||||
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
||||
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||
- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||
- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
||||
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
||||
|
||||
## ⭐ Star History
|
||||
## Star History
|
||||
|
||||
[](https://www.star-history.com/#upstash/context7&Date)
|
||||
|
||||
## 📄 License
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
21
bun.lock
21
bun.lock
@ -4,8 +4,7 @@
|
||||
"": {
|
||||
"name": "context7-mcp",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"commander": "^14.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.8.0",
|
||||
"zod": "^3.24.2",
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -48,7 +47,7 @@
|
||||
|
||||
"@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=="],
|
||||
|
||||
@ -114,8 +113,6 @@
|
||||
|
||||
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
||||
|
||||
"commander": ["commander@14.0.0", "", {}, "sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA=="],
|
||||
|
||||
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
|
||||
|
||||
"content-disposition": ["content-disposition@1.0.0", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg=="],
|
||||
@ -320,7 +317,7 @@
|
||||
|
||||
"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=="],
|
||||
|
||||
@ -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/config-array/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||
|
||||
"@eslint/eslintrc/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||
|
||||
"@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="],
|
||||
|
||||
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
||||
|
||||
"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
|
||||
|
||||
"body-parser/qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
|
||||
|
||||
"espree/eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
|
||||
|
||||
"express/debug": ["debug@4.3.6", "", { "dependencies": { "ms": "2.1.2" } }, "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg=="],
|
||||
|
||||
"fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
||||
|
||||
"@eslint/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
|
||||
|
||||
"@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
|
||||
|
||||
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
|
||||
|
||||
"express/debug/ms": ["ms@2.1.2", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],
|
||||
|
@ -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,7 +209,7 @@ Wenn du den MCP-Server lieber in einem Docker-Container ausführen möchtest:
|
||||
|
||||
Aktualisiere die Konfiguration deines MCP-Clients, um den Docker-Befehl zu verwenden.
|
||||
|
||||
_Beispiel für eine cline_mcp_settings.json:_
|
||||
*Beispiel für eine cline_mcp_settings.json:*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -225,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
|
||||
|
||||
@ -298,7 +297,11 @@ Wenn du einen Fehler wie `Error: Cannot find module 'uriTemplate.js'` bekommst,
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
||||
"args": [
|
||||
"-y",
|
||||
"--node-options=--experimental-vm-modules",
|
||||
"@upstash/context7-mcp@1.0.6"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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.
|
||||
|
||||
## Haftungsausschluss
|
||||
|
||||
Context7-Projekte werden von der Community beigetragen, und obwohl wir uns bemühen, eine hohe Qualität aufrechtzuerhalten, können wir die Genauigkeit, Vollständigkeit oder Sicherheit aller Bibliotheksdokumentationen nicht garantieren. Die in Context7 aufgeführten Projekte werden von ihren jeweiligen Eigentümern entwickelt und gepflegt, nicht von Context7. Wenn du auf verdächtige, unangemessene oder potenziell schädliche Inhalte stößt, verwende bitte die Schaltfläche "Melden" auf der Projektseite, um uns sofort zu benachrichtigen. Wir nehmen alle Berichte ernst und werden gemeldete Inhalte umgehend überprüfen, um die Integrität und Sicherheit unserer Plattform zu gewährleisten. Durch die Nutzung von Context7 erkennst du an, dass du dies nach eigenem Ermessen und auf eigenes Risiko tust.
|
||||
|
||||
## Context7 in den Medien
|
||||
|
@ -1,6 +1,6 @@
|
||||
# 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
|
||||
|
||||
@ -113,10 +113,10 @@ Ajoutez ceci à votre fichier de configuration MCP Windsurf. Voir la [documentat
|
||||
|
||||
### 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="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 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Installer%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
|
||||
[<img alt="Installation dans VS Code Insiders (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Installer%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
|
||||
|
||||
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
|
||||
{
|
||||
@ -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
|
||||
|
||||
Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
|
||||
@ -226,7 +209,7 @@ Si vous préférez exécuter le serveur MCP dans un conteneur Docker :
|
||||
|
||||
Mettez à jour la configuration de votre client MCP pour utiliser la commande Docker.
|
||||
|
||||
_Exemple pour un fichier cline_mcp_settings.json :_
|
||||
*Exemple pour un fichier cline_mcp_settings.json :*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -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._
|
||||
|
||||
### 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
*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.*
|
||||
|
||||
### 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.
|
||||
|
||||
### Problèmes de résolution ESM
|
||||
|
||||
Si vous rencontrez une erreur comme : `Error: Cannot find module 'uriTemplate.js'` essayez d'exécuter avec le drapeau `--experimental-vm-modules` :
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Erreurs client MCP
|
||||
|
||||
1. Essayez de retirer `@latest` du nom du package.
|
||||
2. Essayez d'utiliser `bunx` comme alternative.
|
||||
3. Essayez d'utiliser `deno` comme alternative.
|
||||
4. Assurez-vous d'utiliser Node v18 ou supérieur pour avoir le support natif de fetch avec `npx`.
|
||||
|
||||
## Clause de non-responsabilité
|
||||
|
||||
Les projets Context7 sont des contributions de la communauté, et bien que nous nous efforcions de maintenir une haute qualité, nous ne pouvons garantir l'exactitude, l'exhaustivité ou la sécurité de toute la documentation des bibliothèques. Les projets listés dans Context7 sont développés et maintenus par leurs propriétaires respectifs, et non par Context7. Si vous rencontrez un contenu suspect, inapproprié ou potentiellement nuisible, veuillez utiliser le bouton "Signaler" sur la page du projet pour nous le faire savoir immédiatement. Nous prenons tous les signalements au sérieux et examinerons rapidement les contenus signalés pour maintenir l'intégrité et la sécurité de notre plateforme. En utilisant Context7, vous reconnaissez que vous le faites à votre propre discrétion et à vos risques et périls.
|
||||
2. Essayez d’utiliser `bunx` comme alternative.
|
||||
3. Essayez d’utiliser `deno` comme alternative.
|
||||
|
||||
## 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)
|
||||
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||
- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
||||
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
||||
|
||||
## Historique des stars
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
|
||||
# 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)
|
||||
|
||||
[](./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
|
||||
|
||||
LLM mengandalkan informasi yang sudah lama atau umum tentang library yang Anda gunakan, bukan yang terbaru.
|
||||
|
||||
Hasilnya anda akan mendapatkan:
|
||||
|
||||
- ❌ Contoh kode sudah usang dan berdasarkan data pelatihan yang sudah lama
|
||||
- ❌ API yang dikarang yang sebetulnya tidak ada sama sekali
|
||||
- ❌ Jawaban umum untuk versi paket lama
|
||||
@ -213,7 +213,7 @@ Jika Anda lebih suka menjalankan server MCP dalam kontainer Docker:
|
||||
|
||||
Perbarui konfigurasi MCP client Anda untuk menggunakan perintah Docker.
|
||||
|
||||
_Contoh untuk cline_mcp_settings.json:_
|
||||
*Contoh untuk cline_mcp_settings.json:*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -229,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
|
||||
|
||||
@ -302,7 +301,11 @@ Jika Anda mengalami kesalahan seperti: `Error: Cannot find module 'uriTemplate.j
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
||||
"args": [
|
||||
"-y",
|
||||
"--node-options=--experimental-vm-modules",
|
||||
"@upstash/context7-mcp@1.0.6"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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`.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mempertahankan kualitas tinggi, kami tidak dapat menjamin keakuratan, kelengkapan, atau keamanan semua dokumentasi library. Proyek yang terdaftar di Context7 dikembangkan dan dikelola oleh pemiliknya masing-masing, bukan oleh Context7. Jika Anda menemukan konten yang mencurigakan, tidak pantas, atau berpotensi berbahaya, silakan gunakan tombol "Report" di halaman proyek untuk memberi tahu kami segera. Kami menganggap semua laporan dengan serius dan akan meninjau konten yang ditandai segera untuk menjaga integritas dan keamanan platform kami. Dengan menggunakan Context7, Anda mengakui bahwa Anda melakukannya atas kebijaksanaan dan risiko Anda sendiri.
|
||||
|
||||
## Context7 Di Media
|
||||
@ -338,3 +340,4 @@ Proyek Context7 adalah kontribusi komunitas dan meskipun kami berusaha untuk mem
|
||||
## Lisensi
|
||||
|
||||
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)
|
||||
|
||||
[](./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
|
||||
|
||||
@ -211,7 +212,7 @@ Se preferisci eseguire il server MCP in un contenitore Docker:
|
||||
|
||||
Aggiorna la configurazione del tuo client MCP per utilizzare il comando Docker.
|
||||
|
||||
_Esempio per un file cline_mcp_settings.json:_
|
||||
*Esempio per un file cline_mcp_settings.json:*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -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
|
||||
|
||||
@ -252,7 +252,6 @@ Compila:
|
||||
```bash
|
||||
bun run build
|
||||
```
|
||||
|
||||
### Esempio di Configurazione Locale
|
||||
|
||||
```json
|
||||
@ -300,7 +299,11 @@ Se riscontri un errore come: `Error: Cannot find module 'uriTemplate.js'` prova
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
||||
"args": [
|
||||
"-y",
|
||||
"--node-options=--experimental-vm-modules",
|
||||
"@upstash/context7-mcp@1.0.6"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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`.
|
||||
|
||||
## Dichiarazione di non responsabilità
|
||||
|
||||
I progetti Context7 sono contributi della comunità e, sebbene ci impegniamo a mantenere un'alta qualità, non possiamo garantire l'accuratezza, la completezza o la sicurezza di tutta la documentazione delle librerie. I progetti elencati in Context7 sono sviluppati e gestiti dai rispettivi proprietari, non da Context7. Se riscontri contenuti sospetti, inappropriati o potenzialmente dannosi, utilizza il pulsante "Segnala" sulla pagina del progetto per informarci immediatamente. Prendiamo sul serio tutte le segnalazioni e esamineremo prontamente i contenuti segnalati per mantenere l'integrità e la sicurezza della nostra piattaforma. Utilizzando Context7, riconosci di farlo a tua discrezione e a tuo rischio.
|
||||
|
||||
## Context7 nei Media
|
||||
|
@ -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 - 모든 프롬프트를 위한 최신 코드 문서
|
||||
|
||||
[](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 MCP - 모든 프롬프트를 위한 최신 문서
|
||||
|
||||
## ❌ Context7 없이
|
||||
|
||||
@ -14,16 +10,16 @@ LLM은 사용하는 라이브러리에 대한 오래되거나 일반적인 정
|
||||
|
||||
## ✅ Context7 사용 시
|
||||
|
||||
Context7 MCP는 최신 버전별 문서와 코드 예제를 소스에서 직접 가져와 프롬프트에 즉시 적용합니다.
|
||||
Context7 MCP는 소스에서 직접 최신 버전별 문서와 코드 예제를 가져와 프롬프트에 즉시 적용합니다.
|
||||
|
||||
Cursor에서 프롬프트에 `use context7`을 추가하세요:
|
||||
Cursor에서 프롬프트에 `use context7`만 추가하세요:
|
||||
|
||||
```txt
|
||||
쿠키에서 유효한 JWT를 확인하고 인증되지 않은 사용자를 /login으로 리디렉션하는 Next.js 미들웨어를 만들어주세요. use context7
|
||||
app router를 사용하는 기본 Next.js 프로젝트를 만들어주세요. use context7
|
||||
```
|
||||
|
||||
```txt
|
||||
JSON API 응답을 5분 동안 캐시하도록 Cloudflare Worker 스크립트를 구성해주세요. use context7
|
||||
PostgreSQL 연결 정보를 사용하여 city 필드가 빈 문자열("")인 행을 삭제하는 스크립트를 만들어주세요. use context7
|
||||
```
|
||||
|
||||
Context7은 최신 코드 예제와 문서를 LLM의 컨텍스트에 즉시 가져옵니다.
|
||||
@ -34,10 +30,6 @@ Context7은 최신 코드 예제와 문서를 LLM의 컨텍스트에 즉시 가
|
||||
|
||||
탭 전환도, 존재하지 않는 API도, 오래된 코드 생성도 없습니다.
|
||||
|
||||
## 📚 프로젝트 추가하기
|
||||
|
||||
Context7에 여러분이 좋아하는 라이브러리를 추가(또는 업데이트)하는 방법을 알아보려면 [프로젝트 추가 가이드](./docs/adding-projects.md)를 확인하세요.
|
||||
|
||||
## 🛠️ 시작하기
|
||||
|
||||
### 요구사항
|
||||
@ -45,546 +37,19 @@ Context7에 여러분이 좋아하는 라이브러리를 추가(또는 업데이
|
||||
- Node.js >= v18.0.0
|
||||
- Cursor, Windsurf, Claude Desktop 또는 다른 MCP 클라이언트
|
||||
|
||||
<details>
|
||||
<summary><b>Smithery를 통한 설치</b></summary>
|
||||
### Smithery를 통한 설치
|
||||
|
||||
[Smithery](https://smithery.ai/server/@upstash/context7-mcp)를 통해 모든 클라이언트에 Context7 MCP 서버를 자동으로 설치하려면:
|
||||
[Smithery](https://smithery.ai/server/@upstash/context7-mcp)를 통해 Claude Desktop용 Context7 MCP 서버를 자동으로 설치하려면:
|
||||
|
||||
```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)에서 찾을 수 있습니다.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Cursor에 설치</b></summary>
|
||||
### Cursor에 설치
|
||||
|
||||
다음으로 이동: `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>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)를 참조하세요.
|
||||
다음 설정을 Cursor의 `~/.cursor/mcp.json` 파일에 붙여넣는 것이 권장됩니다. 자세한 내용은 [Cursor MCP 문서](https://docs.cursor.com/context/model-context-protocol)를 참조하세요.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -596,152 +61,106 @@ Amazon Q Developer CLI 설정 파일에 다음을 추가하세요. 자세한 내
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Qodo Gen에 설치</b></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. 다음 설정을 추가합니다:
|
||||
<summary>대안: Bun 사용</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
"command": "bunx",
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</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)`로 이동합니다.
|
||||
2. `+ 추가`를 클릭합니다.
|
||||
3. 대화 상자 왼쪽 상단의 `Command`를 클릭하고 목록에서 JSON으로 옵션을 선택합니다.
|
||||
4. 이 설정을 추가하고 `OK`를 클릭합니다.
|
||||
</details>
|
||||
|
||||
### Windsurf에 설치
|
||||
|
||||
Windsurf MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [Windsurf MCP 문서](https://docs.windsurf.com/windsurf/mcp)를 참조하세요.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
5. `Apply`를 클릭하여 변경 사항을 저장합니다.
|
||||
### VSCode에 설치
|
||||
|
||||
</details>
|
||||
|
||||
<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. 아래 주어진 설정을 붙여넣습니다:
|
||||
VSCode MCP 설정 파일에 다음을 추가하세요. 자세한 내용은 [VSCode MCP 문서](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)를 참조하세요.
|
||||
|
||||
```json
|
||||
{
|
||||
"servers": {
|
||||
"Context7": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Claude Code에 설치
|
||||
|
||||
다음 명령을 실행하세요. 자세한 내용은 [Claude Code MCP 문서](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp)를 참조하세요.
|
||||
|
||||
```sh
|
||||
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
### Claude 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"
|
||||
],
|
||||
"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
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 🔨 사용 가능한 도구
|
||||
|
||||
Context7 MCP는 LLM이 사용할 수 있는 다음 도구들을 제공합니다:
|
||||
### 사용 가능한 도구
|
||||
|
||||
- `resolve-library-id`: 일반적인 라이브러리 이름을 Context7이 인식할 수 있는 라이브러리 ID로 변환합니다.
|
||||
|
||||
- `libraryName` (필수): 검색할 라이브러리의 이름
|
||||
- `libraryName` (필수): 검색하고자 하는 라이브러리 이름
|
||||
|
||||
- `get-library-docs`: Context7이 인식하는 라이브러리 ID를 사용하여 해당 라이브러리의 문서를 가져옵니다.
|
||||
- `context7CompatibleLibraryID` (필수): 정확한 Context7 호환 라이브러리 ID (예: `/mongodb/docs`, `/vercel/next.js`)
|
||||
- `topic` (선택): 특정 주제에 대한 문서에 집중합니다 (예: "routing", "hooks")
|
||||
- `tokens` (선택, 기본값 10000): 가져올 문서의 최대 토큰 수. 기본값인 10000보다 작은 값은 자동으로 10000으로 증가합니다.
|
||||
- `context7CompatibleLibraryID` (필수)
|
||||
- `topic` (선택): 특정 주제의 문서만 가져오기 (예: "routing", "hooks")
|
||||
- `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
|
||||
bun i
|
||||
@ -753,27 +172,7 @@ bun i
|
||||
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
|
||||
{
|
||||
@ -786,109 +185,49 @@ bun run dist/index.js --transport http --port 8080
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>MCP Inspector로 테스트</b></summary>
|
||||
### MCP Inspector로 테스트
|
||||
|
||||
```bash
|
||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
</details>
|
||||
## 문제 해결
|
||||
|
||||
## 🚨 문제 해결
|
||||
### ERR_MODULE_NOT_FOUND
|
||||
|
||||
<details>
|
||||
<summary><b>Module Not Found Errors</b></summary>
|
||||
|
||||
`ERR_MODULE_NOT_FOUND` 오류가 발생하면 `npx` 대신 `bunx`를 사용해 보세요:
|
||||
이 오류가 발생하면 `npx` 대신 `bunx`를 사용해보세요.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "bunx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
이 방법은 `npx`가 패키지를 제대로 설치하거나 확인하지 못하는 환경에서 모듈 확인 문제를 해결하는 경우가 많습니다.
|
||||
이 방법은 `npx`가 패키지를 제대로 설치 또는 찾지 못하는 환경에서 문제를 해결하는 경우가 많습니다.
|
||||
|
||||
</details>
|
||||
### MCP 클라이언트 오류
|
||||
|
||||
<details>
|
||||
<summary><b>ESM Resolution 문제</b></summary>
|
||||
1. 패키지 이름에서 `@latest`를 제거해보세요.
|
||||
|
||||
`Error: Cannot find module 'uriTemplate.js'`와 같은 오류의 경우 `--experimental-vm-modules` 플래그를 사용해 보세요:
|
||||
2. 대안으로 `bunx`를 사용해보세요.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp@1.0.6"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
3. 대안으로 `deno`를 사용해보세요.
|
||||
|
||||
</details>
|
||||
## Context7 관련 미디어 자료
|
||||
|
||||
<details>
|
||||
<summary><b>TLS/인증서 문제</b></summary>
|
||||
- [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)
|
||||
|
||||
`--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. `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
|
||||
## Star 기록
|
||||
|
||||
[](https://www.star-history.com/#upstash/context7&Date)
|
||||
|
||||
|
@ -58,7 +58,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"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": {
|
||||
"context7": {
|
||||
"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": {
|
||||
"context7": {
|
||||
"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": {
|
||||
"context7": {
|
||||
"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": {
|
||||
"type": "stdio",
|
||||
"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": {
|
||||
"command": {
|
||||
"path": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
},
|
||||
"settings": {}
|
||||
}
|
||||
@ -153,7 +153,7 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
||||
Запустите следующую команду для установки. Смотрите [документацию Claude Code MCP](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) для получения дополнительной информации.
|
||||
|
||||
```sh
|
||||
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
### Установка в Claude Desktop
|
||||
@ -165,22 +165,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
"mcpServers": {
|
||||
"Context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Установка в BoltAI
|
||||
|
||||
Откройте страницу "Settings", перейдите в "Plugins" и добавьте следующие JSON-строки:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"args": ["-y", "@upstash/context7-mcp"],
|
||||
"command": "npx"
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -203,7 +188,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
WORKDIR /app
|
||||
|
||||
# Установите последнюю версию пакета глобально
|
||||
RUN npm install -g @upstash/context7-mcp
|
||||
RUN npm install -g @upstash/context7-mcp@latest
|
||||
|
||||
# Откройте стандартный порт, если это необходимо (необязательно, это зависит от взаимодействия с MCP клиентом)
|
||||
# EXPOSE 3000
|
||||
@ -224,7 +209,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
|
||||
Обновите вашу конфигурацию MCP клиента, чтобы использовать Docker команду.
|
||||
|
||||
_Пример для cline_mcp_settings.json:_
|
||||
*Пример для cline_mcp_settings.json:*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -240,38 +225,19 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
_Примечение: это пример конфигурации. Обратитесь к конкретным примерам для вашего 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:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@upstash/context7-mcp"],
|
||||
"args": ["-y", "@upstash/context7-mcp@latest"],
|
||||
"env": {
|
||||
"DEFAULT_MINIMUM_TOKENS": "10000"
|
||||
}
|
||||
@ -287,7 +253,7 @@ Examples:
|
||||
- `get-library-docs`: получает документацию по библиотеке по совместимому с Context7 идентификатору.
|
||||
- `context7CompatibleLibraryID` (обязательно)
|
||||
- `topic` (необязательно): фокусирует документацию на определённой теме (например, "routing", "hooks")
|
||||
- `tokens` (необязательно, по умолчанию 10000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него.
|
||||
- `tokens` (необязательно, по умолчанию 5000): максимальное число токенов в ответе. Значения ниже заданного `DEFAULT_MINIMUM_TOKENS` будут автоматически увеличены до него.
|
||||
|
||||
## Разработка
|
||||
|
||||
@ -319,7 +285,7 @@ bun run build
|
||||
### Тестирование с помощью инспектора MCP
|
||||
|
||||
```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": {
|
||||
"context7": {
|
||||
"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": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/context7-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Проблемы с TLS/сертификатами
|
||||
|
||||
Используйте флаг `--experimental-fetch` c `npx`, чтобы избежать ошибки, связанные с TLS:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
|
||||
"args": [
|
||||
"-y",
|
||||
"--node-options=--experimental-vm-modules",
|
||||
"@upstash/context7-mcp@1.0.6"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -373,7 +328,7 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
||||
|
||||
### Ошибки MCP клиента
|
||||
|
||||
1. Попробуйте добавить тег `@latest` в имя пакета.
|
||||
1. Попробуйте убрать тег `@latest` из имени пакета.
|
||||
|
||||
2. Попробуйте использовать `bunx` как альтернативу `npx`.
|
||||
|
||||
@ -382,22 +337,13 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
||||
4. Убедитесь, что используете версию Node v18 или выше, чтобы `npx` поддерживал встроенный `fetch`.
|
||||
|
||||
## Отказ от ответственности
|
||||
|
||||
Проекты Context7 создаются сообществом. Мы стремимся поддерживать высокое качество, однако не можем гарантировать точность, полноту или безопасность всей документации по библиотекам. Проекты, представленные в Context7, разрабатываются и поддерживаются их авторами, а не командой Context7.
|
||||
|
||||
Если вы столкнётесь с подозрительным, неуместным или потенциально вредоносным контентом, пожалуйста, воспользуйтесь кнопкой "Report" на странице проекта, чтобы немедленно сообщить нам. Мы внимательно относимся ко всем обращениям и оперативно проверяем помеченные материалы, чтобы обеспечить надёжность и безопасность платформы.
|
||||
|
||||
Используя Context7, вы признаёте, что делаете это по собственному усмотрению и на свой страх и риск.
|
||||
|
||||
## Оставайтесь с нами на связи
|
||||
|
||||
Будьте в курсе последних новостей на наших платформах:
|
||||
|
||||
- 📢 Следите за нашими новостями на [X](https://x.com/contextai), чтобы быть в курсе последних новостей
|
||||
- 🌐 Загляните на наш [сайт](https://context7.com)
|
||||
- 💬 При желании присоединяйтесь к нашему [сообществу в Discord](https://upstash.com/discord)
|
||||
|
||||
## Context7 в СМИ
|
||||
## Context7 In Media
|
||||
|
||||
- [Better Stack: "Бесплатный инструмент делает Cursor в 10 раз умнее"](https://youtu.be/52FC3qObp9E)
|
||||
- [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)
|
||||
- [JeredBlu: "Context 7 MCP: мгновенный доступ к документации + настройка для VS Code"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||
- [Income stream surfers: "Context7: новый MCP-сервер, который изменит кодинг с ИИ"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||
- [AICodeKing: "Context7 + Cline & RooCode: Этот MCP сервер делает CLINE в 100 раз ЭФФЕКТИВНЕЕ!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
||||
- [Sean Kochel: "5 MCP серверов для стремительного вайб-программирования (Подключи и Работай)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
||||
|
||||
## История звёзд на GitHub
|
||||
|
||||
|
@ -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,7 +187,7 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||
|
||||
更新MCP客户端配置以使用Docker命令。
|
||||
|
||||
_cline_mcp_settings.json配置示例:_
|
||||
*cline_mcp_settings.json配置示例:*
|
||||
|
||||
```json
|
||||
{
|
||||
@ -203,31 +203,12 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
_注意事项:_
|
||||
*注意事项:*
|
||||
<em>
|
||||
|
||||
- 此为示例配置。请参考前面README中针对具体MCP客户端(如Cursor、VS Code等)的示例来调整结构(如`mcpServers`与`servers`)。同时确保`args`中的镜像名称与`docker build`命令使用的标签一致。
|
||||
- 当前Cursor版本(0.49.5), 请不要使用本方式启动MCP server,详情:[Cursor官方说明](https://docs.cursor.com/context/model-context-protocol#remote-development)
|
||||
</em>
|
||||
|
||||
### 在Windows上安装
|
||||
|
||||
在windows上的配置相对于linux或macos来说有些许不同,(_示例使用的`Cline`_), 其它编辑器同理, 参考`command`和`args`的配置即可
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"github.com/upstash/context7-mcp": {
|
||||
"command": "cmd",
|
||||
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],
|
||||
"disabled": false,
|
||||
"autoApprove": []
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 可用工具
|
||||
|
||||
- `resolve-library-id`: 将通用库名称解析为Context7兼容的库ID。
|
||||
@ -270,6 +251,7 @@ bun run build
|
||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
|
||||
## 故障排除
|
||||
|
||||
### 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",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.6",
|
||||
"description": "MCP server for Context7",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "tsc && chmod 755 dist/index.js",
|
||||
"format": "prettier --write .",
|
||||
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
||||
"lint:check": "eslint \"**/*.{js,ts,tsx}\"",
|
||||
"start": "node dist/index.js --transport http"
|
||||
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -33,8 +31,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/upstash/context7#readme",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"commander": "^14.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.8.0",
|
||||
"dotenv": "^16.5.0",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
"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
|
||||
|
||||
startCommand:
|
||||
type: http
|
||||
type: stdio
|
||||
configSchema:
|
||||
# JSON Schema defining the configuration options for the MCP.
|
||||
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: {}
|
||||
|
249
src/index.ts
249
src/index.ts
@ -5,98 +5,74 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
||||
import { z } from "zod";
|
||||
import { searchLibraries, fetchLibraryDocumentation } from "./lib/api.js";
|
||||
import { formatSearchResults } from "./lib/utils.js";
|
||||
import { SearchResponse } from "./lib/types.js";
|
||||
import { createServer } from "http";
|
||||
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
||||
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
||||
import { Command } from "commander";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
const DEFAULT_MINIMUM_TOKENS = 10000;
|
||||
// Load environment variables from .env file if present
|
||||
dotenv.config();
|
||||
|
||||
// Parse CLI arguments using commander
|
||||
const program = new Command()
|
||||
.option("--transport <stdio|http|sse>", "transport type", "stdio")
|
||||
.option("--port <number>", "port for HTTP/SSE transport", "3000")
|
||||
.allowUnknownOption() // let MCP Inspector / other wrappers pass through extra flags
|
||||
.parse(process.argv);
|
||||
|
||||
const cliOptions = program.opts<{
|
||||
transport: string;
|
||||
port: string;
|
||||
}>();
|
||||
|
||||
// Validate transport option
|
||||
const allowedTransports = ["stdio", "http", "sse"];
|
||||
if (!allowedTransports.includes(cliOptions.transport)) {
|
||||
console.error(
|
||||
`Invalid --transport value: '${cliOptions.transport}'. Must be one of: stdio, http, sse.`
|
||||
// Get DEFAULT_MINIMUM_TOKENS from environment variable or use default
|
||||
let DEFAULT_MINIMUM_TOKENS = 10000;
|
||||
if (process.env.DEFAULT_MINIMUM_TOKENS) {
|
||||
const parsedValue = parseInt(process.env.DEFAULT_MINIMUM_TOKENS, 10);
|
||||
if (!isNaN(parsedValue) && parsedValue > 0) {
|
||||
DEFAULT_MINIMUM_TOKENS = parsedValue;
|
||||
} else {
|
||||
console.warn(
|
||||
`Warning: Invalid DEFAULT_MINIMUM_TOKENS value provided in environment variable. Using default value of 10000`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Transport configuration
|
||||
const TRANSPORT_TYPE = (cliOptions.transport || "stdio") as "stdio" | "http" | "sse";
|
||||
|
||||
// HTTP/SSE port configuration
|
||||
const CLI_PORT = (() => {
|
||||
const parsed = parseInt(cliOptions.port, 10);
|
||||
return isNaN(parsed) ? undefined : parsed;
|
||||
})();
|
||||
|
||||
// Store SSE transports by session ID
|
||||
const sseTransports: Record<string, SSEServerTransport> = {};
|
||||
|
||||
// Function to create a new server instance with all tools registered
|
||||
function createServerInstance() {
|
||||
const server = new McpServer(
|
||||
{
|
||||
// Create server instance
|
||||
const server = new McpServer({
|
||||
name: "Context7",
|
||||
version: "1.0.13",
|
||||
description: "Retrieves up-to-date documentation and code examples for any library.",
|
||||
version: "1.0.6",
|
||||
capabilities: {
|
||||
resources: {},
|
||||
tools: {},
|
||||
},
|
||||
{
|
||||
instructions:
|
||||
"Use this server to retrieve up-to-date documentation and code examples for any library.",
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Register Context7 tools
|
||||
server.tool(
|
||||
"resolve-library-id",
|
||||
`Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.
|
||||
`Resolves a package name to a Context7-compatible library ID and returns a list of matching libraries.
|
||||
|
||||
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
|
||||
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID.
|
||||
|
||||
Selection Process:
|
||||
1. Analyze the query to understand what library/package the user is looking for
|
||||
2. Return the most relevant match based on:
|
||||
- Name similarity to the query (exact matches prioritized)
|
||||
- Description relevance to the query's intent
|
||||
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
|
||||
- Trust score (consider libraries with scores of 7-10 more authoritative)
|
||||
When selecting the best match, consider:
|
||||
- Name similarity to the query
|
||||
- Description relevance
|
||||
- Code Snippet count (documentation coverage)
|
||||
- GitHub Stars (popularity)
|
||||
|
||||
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.`,
|
||||
Return the selected library ID and explain your choice. If there are multiple good matches, mention this but proceed with the most relevant one.`,
|
||||
{
|
||||
libraryName: z
|
||||
.string()
|
||||
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
|
||||
},
|
||||
async ({ libraryName }) => {
|
||||
const searchResponse: SearchResponse = await searchLibraries(libraryName);
|
||||
const searchResponse = await searchLibraries(libraryName);
|
||||
|
||||
if (!searchResponse.results || searchResponse.results.length === 0) {
|
||||
if (!searchResponse || !searchResponse.results) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: searchResponse.error
|
||||
? searchResponse.error
|
||||
: "Failed to retrieve library documentation data from Context7",
|
||||
text: "Failed to retrieve library documentation data from Context7",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if (searchResponse.results.length === 0) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "No documentation libraries available",
|
||||
},
|
||||
],
|
||||
};
|
||||
@ -111,16 +87,15 @@ For ambiguous queries, request clarification before proceeding with a best-guess
|
||||
text: `Available Libraries (top matches):
|
||||
|
||||
Each result includes:
|
||||
- Library ID: Context7-compatible identifier (format: /org/project)
|
||||
- Library ID: Context7-compatible identifier (format: /org/repo)
|
||||
- Name: Library or package name
|
||||
- Description: Short summary
|
||||
- Code Snippets: Number of available code examples
|
||||
- Trust Score: Authority indicator
|
||||
- Versions: List of versions if available. Use one of those versions if and only if the user explicitly provides a version in their query.
|
||||
- GitHub Stars: Popularity indicator
|
||||
|
||||
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}`,
|
||||
},
|
||||
@ -131,12 +106,12 @@ ${resultsText}`,
|
||||
|
||||
server.tool(
|
||||
"get-library-docs",
|
||||
"Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.",
|
||||
"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/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'."
|
||||
"Exact Context7-compatible library ID (e.g., 'mongodb/docs', 'vercel/nextjs') retrieved from 'resolve-library-id'."
|
||||
),
|
||||
topic: z
|
||||
.string()
|
||||
@ -151,12 +126,23 @@ ${resultsText}`,
|
||||
),
|
||||
},
|
||||
async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
|
||||
const fetchDocsResponse = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
|
||||
// Extract folders parameter if present in the ID
|
||||
let folders = "";
|
||||
let libraryId = context7CompatibleLibraryID;
|
||||
|
||||
if (context7CompatibleLibraryID.includes("?folders=")) {
|
||||
const [id, foldersParam] = context7CompatibleLibraryID.split("?folders=");
|
||||
libraryId = id;
|
||||
folders = foldersParam;
|
||||
}
|
||||
|
||||
const documentationText = await fetchLibraryDocumentation(libraryId, {
|
||||
tokens,
|
||||
topic,
|
||||
folders,
|
||||
});
|
||||
|
||||
if (!fetchDocsResponse) {
|
||||
if (!documentationText) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
@ -171,127 +157,18 @@ ${resultsText}`,
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: fetchDocsResponse,
|
||||
text: documentationText,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
return server;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const transportType = TRANSPORT_TYPE;
|
||||
|
||||
if (transportType === "http" || transportType === "sse") {
|
||||
// Get initial port from environment or use default
|
||||
const initialPort = CLI_PORT ?? 3000;
|
||||
// Keep track of which port we end up using
|
||||
let actualPort = initialPort;
|
||||
const httpServer = createServer(async (req, res) => {
|
||||
const url = new URL(req.url || "", `http://${req.headers.host}`).pathname;
|
||||
|
||||
// Set CORS headers for all responses
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,DELETE");
|
||||
res.setHeader("Access-Control-Allow-Headers", "Content-Type, MCP-Session-Id, mcp-session-id");
|
||||
|
||||
// Handle preflight OPTIONS requests
|
||||
if (req.method === "OPTIONS") {
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create new server instance for each request
|
||||
const requestServer = createServerInstance();
|
||||
|
||||
if (url === "/mcp") {
|
||||
const transport = new StreamableHTTPServerTransport({
|
||||
sessionIdGenerator: undefined,
|
||||
});
|
||||
await requestServer.connect(transport);
|
||||
await transport.handleRequest(req, res);
|
||||
} else if (url === "/sse" && req.method === "GET") {
|
||||
// Create new SSE transport for GET request
|
||||
const sseTransport = new SSEServerTransport("/messages", res);
|
||||
// Store the transport by session ID
|
||||
sseTransports[sseTransport.sessionId] = sseTransport;
|
||||
// Clean up transport when connection closes
|
||||
res.on("close", () => {
|
||||
delete sseTransports[sseTransport.sessionId];
|
||||
});
|
||||
await requestServer.connect(sseTransport);
|
||||
} else if (url === "/messages" && req.method === "POST") {
|
||||
// Get session ID from query parameters
|
||||
const sessionId =
|
||||
new URL(req.url || "", `http://${req.headers.host}`).searchParams.get("sessionId") ??
|
||||
"";
|
||||
|
||||
if (!sessionId) {
|
||||
res.writeHead(400);
|
||||
res.end("Missing sessionId parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get existing transport for this session
|
||||
const sseTransport = sseTransports[sessionId];
|
||||
if (!sseTransport) {
|
||||
res.writeHead(400);
|
||||
res.end(`No transport found for sessionId: ${sessionId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the POST message with the existing transport
|
||||
await sseTransport.handlePostMessage(req, res);
|
||||
} else if (url === "/ping") {
|
||||
res.writeHead(200, { "Content-Type": "text/plain" });
|
||||
res.end("pong");
|
||||
} else {
|
||||
res.writeHead(404);
|
||||
res.end("Not found");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error handling request:", error);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(500);
|
||||
res.end("Internal Server Error");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Function to attempt server listen with port fallback
|
||||
const startServer = (port: number, maxAttempts = 10) => {
|
||||
httpServer.once("error", (err: NodeJS.ErrnoException) => {
|
||||
if (err.code === "EADDRINUSE" && port < initialPort + maxAttempts) {
|
||||
console.warn(`Port ${port} is in use, trying port ${port + 1}...`);
|
||||
startServer(port + 1, maxAttempts);
|
||||
} else {
|
||||
console.error(`Failed to start server: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
httpServer.listen(port, () => {
|
||||
actualPort = port;
|
||||
console.error(
|
||||
`Context7 Documentation MCP Server running on ${transportType.toUpperCase()} at http://localhost:${actualPort}/mcp and legacy SSE at /sse`
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
// Start the server with initial port
|
||||
startServer(initialPort);
|
||||
} else {
|
||||
// Stdio transport - this is already stateless by nature
|
||||
const server = createServerInstance();
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
console.error("Context7 Documentation MCP Server running on stdio");
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error("Fatal error in main():", error);
|
||||
|
@ -8,30 +8,19 @@ const DEFAULT_TYPE = "txt";
|
||||
* @param query The search query
|
||||
* @returns Search results or null if the request fails
|
||||
*/
|
||||
export async function searchLibraries(query: string): Promise<SearchResponse> {
|
||||
export async function searchLibraries(query: string): Promise<SearchResponse | null> {
|
||||
try {
|
||||
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/search`);
|
||||
url.searchParams.set("query", query);
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
const errorCode = response.status;
|
||||
if (errorCode === 429) {
|
||||
console.error(`Rate limited due to too many requests. Please try again later.`);
|
||||
return {
|
||||
results: [],
|
||||
error: `Rate limited due to too many requests. Please try again later.`,
|
||||
} as SearchResponse;
|
||||
}
|
||||
console.error(`Failed to search libraries. Please try again later. Error code: ${errorCode}`);
|
||||
return {
|
||||
results: [],
|
||||
error: `Failed to search libraries. Please try again later. Error code: ${errorCode}`,
|
||||
} as SearchResponse;
|
||||
console.error(`Failed to search libraries: ${response.status}`);
|
||||
return null;
|
||||
}
|
||||
return await response.json();
|
||||
} catch (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: {
|
||||
tokens?: number;
|
||||
topic?: string;
|
||||
folders?: string;
|
||||
} = {}
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
@ -55,6 +45,7 @@ export async function fetchLibraryDocumentation(
|
||||
const url = new URL(`${CONTEXT7_API_BASE_URL}/v1/${libraryId}`);
|
||||
if (options.tokens) url.searchParams.set("tokens", options.tokens.toString());
|
||||
if (options.topic) url.searchParams.set("topic", options.topic);
|
||||
if (options.folders) url.searchParams.set("folders", options.folders);
|
||||
url.searchParams.set("type", DEFAULT_TYPE);
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
@ -62,15 +53,8 @@ export async function fetchLibraryDocumentation(
|
||||
},
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorCode = response.status;
|
||||
if (errorCode === 429) {
|
||||
const errorMessage = `Rate limited due to too many requests. Please try again later.`;
|
||||
console.error(errorMessage);
|
||||
return errorMessage;
|
||||
}
|
||||
const errorMessage = `Failed to fetch documentation. Please try again later. Error code: ${errorCode}`;
|
||||
console.error(errorMessage);
|
||||
return errorMessage;
|
||||
console.error(`Failed to fetch documentation: ${response.status}`);
|
||||
return null;
|
||||
}
|
||||
const text = await response.text();
|
||||
if (!text || text === "No content available" || text === "No context data available") {
|
||||
@ -78,8 +62,7 @@ export async function fetchLibraryDocumentation(
|
||||
}
|
||||
return text;
|
||||
} catch (error) {
|
||||
const errorMessage = `Error fetching library documentation. Please try again later. ${error}`;
|
||||
console.error(errorMessage);
|
||||
return errorMessage;
|
||||
console.error("Error fetching library documentation:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,17 @@
|
||||
export interface SearchResult {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
description?: string;
|
||||
branch: string;
|
||||
lastUpdateDate: string;
|
||||
lastUpdate: string;
|
||||
state: DocumentState;
|
||||
totalTokens: number;
|
||||
totalSnippets: number;
|
||||
totalPages: number;
|
||||
stars?: number;
|
||||
trustScore?: number;
|
||||
versions?: string[];
|
||||
stars: number;
|
||||
}
|
||||
|
||||
export interface SearchResponse {
|
||||
error?: string;
|
||||
results: SearchResult[];
|
||||
}
|
||||
|
||||
|
@ -1,45 +1,22 @@
|
||||
import { SearchResponse, SearchResult } from "./types.js";
|
||||
|
||||
/**
|
||||
* Formats a search result into a human-readable string representation.
|
||||
* Only shows code snippet count and GitHub stars when available (not equal to -1).
|
||||
*
|
||||
* @param result The SearchResult object to format
|
||||
* @returns A formatted string with library information
|
||||
* Format a search result into a string representation
|
||||
* @param result SearchResult to format
|
||||
* @returns Formatted search result string
|
||||
*/
|
||||
export function formatSearchResult(result: SearchResult): string {
|
||||
// Always include these basic details
|
||||
const formattedResult = [
|
||||
`- Title: ${result.title}`,
|
||||
`- Context7-compatible library ID: ${result.id}`,
|
||||
`- Description: ${result.description}`,
|
||||
];
|
||||
|
||||
// Only add code snippets count if it's a valid value
|
||||
if (result.totalSnippets !== -1 && result.totalSnippets !== undefined) {
|
||||
formattedResult.push(`- Code Snippets: ${result.totalSnippets}`);
|
||||
}
|
||||
|
||||
// Only add trust score if it's a valid value
|
||||
if (result.trustScore !== -1 && result.trustScore !== undefined) {
|
||||
formattedResult.push(`- Trust Score: ${result.trustScore}`);
|
||||
}
|
||||
|
||||
// Only add versions if it's a valid value
|
||||
if (result.versions !== undefined && result.versions.length > 0) {
|
||||
formattedResult.push(`- Versions: ${result.versions.join(", ")}`);
|
||||
}
|
||||
|
||||
// Join all parts with newlines
|
||||
return formattedResult.join("\n");
|
||||
return `- Title: ${result.title}
|
||||
- Context7-compatible library ID: ${result.id}
|
||||
- Description: ${result.description}
|
||||
- Code Snippets: ${result.totalSnippets}
|
||||
- GitHub Stars: ${result.stars}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a search response into a human-readable string representation.
|
||||
* Each result is formatted using formatSearchResult.
|
||||
*
|
||||
* @param searchResponse The SearchResponse object to format
|
||||
* @returns A formatted string with search results
|
||||
* Format search results into a string representation
|
||||
* @param searchResponse The search response to format
|
||||
* @returns Formatted search results string
|
||||
*/
|
||||
export function formatSearchResults(searchResponse: SearchResponse): string {
|
||||
if (!searchResponse.results || searchResponse.results.length === 0) {
|
||||
@ -47,5 +24,5 @@ export function formatSearchResults(searchResponse: SearchResponse): string {
|
||||
}
|
||||
|
||||
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