@upstash/context7-mcp 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -2
- package/dist/index.js +19 -11
- package/dist/lib/utils.js +27 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)
|
|
4
4
|
|
|
5
|
-
[](./docs/README.zh-CN.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) [-purple)](./docs/README.pt-BR.md) [](./docs/README.it.md) [](./docs/README.id-ID.md) [](./docs/README.de.md) [](./docs/README.ru.md)
|
|
5
|
+
[](./docs/README.zh-CN.md) [](./docs/README.ko.md) [](./docs/README.es.md) [](./docs/README.fr.md) [-purple)](./docs/README.pt-BR.md) [](./docs/README.it.md) [](./docs/README.id-ID.md) [](./docs/README.de.md) [](./docs/README.ru.md) [](./docs/README.tr.md) [](./docs/README.ar.md)
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
## ❌ Without Context7
|
|
8
9
|
|
|
@@ -90,7 +91,7 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
|
|
90
91
|
"mcpServers": {
|
|
91
92
|
"context7": {
|
|
92
93
|
"command": "deno",
|
|
93
|
-
"args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
94
|
+
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
}
|
|
@@ -173,6 +174,23 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D
|
|
|
173
174
|
}
|
|
174
175
|
```
|
|
175
176
|
|
|
177
|
+
### Install in BoltAI
|
|
178
|
+
|
|
179
|
+
Open the "Settings" page of the app, navigate to "Plugins," and enter the following JSON:
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"mcpServers": {
|
|
184
|
+
"context7": {
|
|
185
|
+
"command": "npx",
|
|
186
|
+
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
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).
|
|
193
|
+
|
|
176
194
|
### Using Docker
|
|
177
195
|
|
|
178
196
|
If you prefer to run the MCP server in a Docker container:
|
|
@@ -230,6 +248,26 @@ If you prefer to run the MCP server in a Docker container:
|
|
|
230
248
|
|
|
231
249
|
*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.*
|
|
232
250
|
|
|
251
|
+
### Install in Windows
|
|
252
|
+
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`.
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"mcpServers": {
|
|
256
|
+
"github.com/upstash/context7-mcp": {
|
|
257
|
+
"command": "cmd",
|
|
258
|
+
"args": [
|
|
259
|
+
"/c",
|
|
260
|
+
"npx",
|
|
261
|
+
"-y",
|
|
262
|
+
"@upstash/context7-mcp@latest"
|
|
263
|
+
],
|
|
264
|
+
"disabled": false,
|
|
265
|
+
"autoApprove": []
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
233
271
|
### Environment Variables
|
|
234
272
|
|
|
235
273
|
- `DEFAULT_MINIMUM_TOKENS`: Set the minimum token count for documentation retrieval (default: 10000).
|
|
@@ -344,6 +382,13 @@ If you encounter an error like: `Error: Cannot find module 'uriTemplate.js'` try
|
|
|
344
382
|
|
|
345
383
|
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.
|
|
346
384
|
|
|
385
|
+
## Connect with Us
|
|
386
|
+
|
|
387
|
+
Stay updated and join our community:
|
|
388
|
+
- 📢 Follow us on [X](https://x.com/contextai) for the latest news and updates
|
|
389
|
+
- 🌐 Visit our [Website](https://context7.com)
|
|
390
|
+
- 💬 Join our [Discord Community](https://upstash.com/discord) (if applicable)
|
|
391
|
+
|
|
347
392
|
## Context7 In Media
|
|
348
393
|
|
|
349
394
|
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
|
package/dist/index.js
CHANGED
|
@@ -22,24 +22,32 @@ if (process.env.DEFAULT_MINIMUM_TOKENS) {
|
|
|
22
22
|
const server = new McpServer({
|
|
23
23
|
name: "Context7",
|
|
24
24
|
description: "Retrieves up-to-date documentation and code examples for any library.",
|
|
25
|
-
version: "v1.0.
|
|
25
|
+
version: "v1.0.9",
|
|
26
26
|
capabilities: {
|
|
27
27
|
resources: {},
|
|
28
28
|
tools: {},
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
// Register Context7 tools
|
|
32
|
-
server.tool("resolve-library-id", `Resolves a package name to a Context7-compatible library ID and returns a list of matching libraries.
|
|
32
|
+
server.tool("resolve-library-id", `Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.
|
|
33
33
|
|
|
34
34
|
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID.
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
36
|
+
Selection Process:
|
|
37
|
+
1. Analyze the query to understand what library/package the user is looking for
|
|
38
|
+
2. Return the most relevant match based on:
|
|
39
|
+
- Name similarity to the query (exact matches prioritized)
|
|
40
|
+
- Description relevance to the query's intent
|
|
41
|
+
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
|
|
42
|
+
- Trust score (consider libraries with scores of 7-10 more authoritative)
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
Response Format:
|
|
45
|
+
- Return the selected library ID in a clearly marked section
|
|
46
|
+
- Provide a brief explanation for why this library was chosen
|
|
47
|
+
- If multiple good matches exist, acknowledge this but proceed with the most relevant one
|
|
48
|
+
- If no good matches exist, clearly state this and suggest query refinements
|
|
49
|
+
|
|
50
|
+
For ambiguous queries, request clarification before proceeding with a best-guess match.`, {
|
|
43
51
|
libraryName: z
|
|
44
52
|
.string()
|
|
45
53
|
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
|
|
@@ -77,11 +85,11 @@ Each result includes:
|
|
|
77
85
|
- Name: Library or package name
|
|
78
86
|
- Description: Short summary
|
|
79
87
|
- Code Snippets: Number of available code examples
|
|
80
|
-
-
|
|
88
|
+
- Trust Score: Authority indicator
|
|
81
89
|
|
|
82
|
-
For best results, select libraries based on name match,
|
|
90
|
+
For best results, select libraries based on name match, trust score, snippet coverage, and relevance to your use case.
|
|
83
91
|
|
|
84
|
-
|
|
92
|
+
----------
|
|
85
93
|
|
|
86
94
|
${resultsText}`,
|
|
87
95
|
},
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Formats a search result into a human-readable string representation.
|
|
3
|
+
* Only shows code snippet count and GitHub stars when available (not equal to -1).
|
|
4
|
+
*
|
|
5
|
+
* @param result The SearchResult object to format
|
|
6
|
+
* @returns A formatted string with library information
|
|
5
7
|
*/
|
|
6
8
|
export function formatSearchResult(result) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
9
|
+
// Always include these basic details
|
|
10
|
+
const formattedResult = [
|
|
11
|
+
`- Title: ${result.title}`,
|
|
12
|
+
`- Context7-compatible library ID: ${result.id}`,
|
|
13
|
+
`- Description: ${result.description}`,
|
|
14
|
+
];
|
|
15
|
+
// Only add code snippets count if it's a valid value
|
|
16
|
+
if (result.totalSnippets !== -1 && result.totalSnippets !== undefined) {
|
|
17
|
+
formattedResult.push(`- Code Snippets: ${result.totalSnippets}`);
|
|
18
|
+
}
|
|
19
|
+
// Only add trust score if it's a valid value
|
|
20
|
+
if (result.trustScore !== -1 && result.trustScore !== undefined) {
|
|
21
|
+
formattedResult.push(`- Trust Score: ${result.trustScore}`);
|
|
22
|
+
}
|
|
23
|
+
// Join all parts with newlines
|
|
24
|
+
return formattedResult.join("\n");
|
|
12
25
|
}
|
|
13
26
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
27
|
+
* Formats a search response into a human-readable string representation.
|
|
28
|
+
* Each result is formatted using formatSearchResult.
|
|
29
|
+
*
|
|
30
|
+
* @param searchResponse The SearchResponse object to format
|
|
31
|
+
* @returns A formatted string with search results
|
|
17
32
|
*/
|
|
18
33
|
export function formatSearchResults(searchResponse) {
|
|
19
34
|
if (!searchResponse.results || searchResponse.results.length === 0) {
|
|
20
35
|
return "No documentation libraries found matching your query.";
|
|
21
36
|
}
|
|
22
37
|
const formattedResults = searchResponse.results.map(formatSearchResult);
|
|
23
|
-
return formattedResults.join("\n
|
|
38
|
+
return formattedResults.join("\n----------\n");
|
|
24
39
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@upstash/context7-mcp","version":"v1.0.
|
|
1
|
+
{"name":"@upstash/context7-mcp","version":"v1.0.9","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"},"repository":{"type":"git","url":"git+https://github.com/upstash/context7.git"},"keywords":["modelcontextprotocol","mcp","context7"],"author":"abdush","license":"MIT","type":"module","bin":{"context7-mcp":"dist/index.js"},"files":["dist"],"bugs":{"url":"https://github.com/upstash/context7/issues"},"homepage":"https://github.com/upstash/context7#readme","dependencies":{"@modelcontextprotocol/sdk":"^1.8.0","dotenv":"^16.5.0","zod":"^3.24.2"},"devDependencies":{"@types/node":"^22.13.14","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0","eslint":"^9.23.0","eslint-config-prettier":"^10.1.1","eslint-plugin-prettier":"^5.2.5","prettier":"^3.5.3","typescript":"^5.8.2","typescript-eslint":"^8.28.0"}}
|