@upstash/context7-mcp 1.0.9 → 1.0.10
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 +34 -15
- package/dist/index.js +7 -15
- package/dist/lib/api.js +0 -2
- package/dist/lib/utils.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
|
|
61
61
|
"mcpServers": {
|
|
62
62
|
"context7": {
|
|
63
63
|
"command": "npx",
|
|
64
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
64
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -75,7 +75,7 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
|
|
75
75
|
"mcpServers": {
|
|
76
76
|
"context7": {
|
|
77
77
|
"command": "bunx",
|
|
78
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
78
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -108,7 +108,7 @@ Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.
|
|
|
108
108
|
"mcpServers": {
|
|
109
109
|
"context7": {
|
|
110
110
|
"command": "npx",
|
|
111
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
111
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -127,7 +127,7 @@ Add this to your VS Code MCP config file. See [VS Code MCP docs](https://code.vi
|
|
|
127
127
|
"Context7": {
|
|
128
128
|
"type": "stdio",
|
|
129
129
|
"command": "npx",
|
|
130
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
130
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -143,7 +143,7 @@ It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Contex
|
|
|
143
143
|
"Context7": {
|
|
144
144
|
"command": {
|
|
145
145
|
"path": "npx",
|
|
146
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
146
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
147
147
|
},
|
|
148
148
|
"settings": {}
|
|
149
149
|
}
|
|
@@ -156,7 +156,7 @@ It can be installed via [Zed Extensions](https://zed.dev/extensions?query=Contex
|
|
|
156
156
|
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.
|
|
157
157
|
|
|
158
158
|
```sh
|
|
159
|
-
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|
159
|
+
claude mcp add context7 -- npx -y @upstash/context7-mcp
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
### Install in Claude Desktop
|
|
@@ -168,7 +168,7 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D
|
|
|
168
168
|
"mcpServers": {
|
|
169
169
|
"Context7": {
|
|
170
170
|
"command": "npx",
|
|
171
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
171
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -183,7 +183,7 @@ Open the "Settings" page of the app, navigate to "Plugins," and enter the follow
|
|
|
183
183
|
"mcpServers": {
|
|
184
184
|
"context7": {
|
|
185
185
|
"command": "npx",
|
|
186
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
186
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -208,7 +208,7 @@ If you prefer to run the MCP server in a Docker container:
|
|
|
208
208
|
WORKDIR /app
|
|
209
209
|
|
|
210
210
|
# Install the latest version globally
|
|
211
|
-
RUN npm install -g @upstash/context7-mcp
|
|
211
|
+
RUN npm install -g @upstash/context7-mcp
|
|
212
212
|
|
|
213
213
|
# Expose default port if needed (optional, depends on MCP client interaction)
|
|
214
214
|
# EXPOSE 3000
|
|
@@ -259,7 +259,7 @@ The configuration on Windows is slightly different compared to Linux or macOS (*
|
|
|
259
259
|
"/c",
|
|
260
260
|
"npx",
|
|
261
261
|
"-y",
|
|
262
|
-
"@upstash/context7-mcp
|
|
262
|
+
"@upstash/context7-mcp"
|
|
263
263
|
],
|
|
264
264
|
"disabled": false,
|
|
265
265
|
"autoApprove": []
|
|
@@ -279,7 +279,7 @@ Examples:
|
|
|
279
279
|
"mcpServers": {
|
|
280
280
|
"context7": {
|
|
281
281
|
"command": "npx",
|
|
282
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
282
|
+
"args": ["-y", "@upstash/context7-mcp"],
|
|
283
283
|
"env": {
|
|
284
284
|
"DEFAULT_MINIMUM_TOKENS": "10000"
|
|
285
285
|
}
|
|
@@ -327,7 +327,7 @@ bun run build
|
|
|
327
327
|
### Testing with MCP Inspector
|
|
328
328
|
|
|
329
329
|
```bash
|
|
330
|
-
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|
330
|
+
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
|
|
331
331
|
```
|
|
332
332
|
|
|
333
333
|
## Troubleshooting
|
|
@@ -341,7 +341,7 @@ If you see this error, try using `bunx` instead of `npx`.
|
|
|
341
341
|
"mcpServers": {
|
|
342
342
|
"context7": {
|
|
343
343
|
"command": "bunx",
|
|
344
|
-
"args": ["-y", "@upstash/context7-mcp
|
|
344
|
+
"args": ["-y", "@upstash/context7-mcp"]
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
@@ -361,7 +361,26 @@ If you encounter an error like: `Error: Cannot find module 'uriTemplate.js'` try
|
|
|
361
361
|
"args": [
|
|
362
362
|
"-y",
|
|
363
363
|
"--node-options=--experimental-vm-modules",
|
|
364
|
-
"@upstash/context7-mcp
|
|
364
|
+
"@upstash/context7-mcp"
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### TLS/Certificate Issues
|
|
372
|
+
|
|
373
|
+
Use the `--experimental-fetch` flag with `npx` to bypass TLS-related issues:
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"mcpServers": {
|
|
378
|
+
"context7": {
|
|
379
|
+
"command": "npx",
|
|
380
|
+
"args": [
|
|
381
|
+
"-y",
|
|
382
|
+
"--node-options=--experimental-fetch",
|
|
383
|
+
"@upstash/context7-mcp"
|
|
365
384
|
]
|
|
366
385
|
}
|
|
367
386
|
}
|
|
@@ -370,7 +389,7 @@ If you encounter an error like: `Error: Cannot find module 'uriTemplate.js'` try
|
|
|
370
389
|
|
|
371
390
|
### MCP Client Errors
|
|
372
391
|
|
|
373
|
-
1. Try
|
|
392
|
+
1. Try adding `@latest` to the package name.
|
|
374
393
|
|
|
375
394
|
2. Try using `bunx` as an alternative.
|
|
376
395
|
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ 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.10",
|
|
26
26
|
capabilities: {
|
|
27
27
|
resources: {},
|
|
28
28
|
tools: {},
|
|
@@ -31,7 +31,7 @@ const server = new McpServer({
|
|
|
31
31
|
// Register Context7 tools
|
|
32
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
|
-
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID.
|
|
34
|
+
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.
|
|
35
35
|
|
|
36
36
|
Selection Process:
|
|
37
37
|
1. Analyze the query to understand what library/package the user is looking for
|
|
@@ -81,11 +81,12 @@ For ambiguous queries, request clarification before proceeding with a best-guess
|
|
|
81
81
|
text: `Available Libraries (top matches):
|
|
82
82
|
|
|
83
83
|
Each result includes:
|
|
84
|
-
- Library ID: Context7-compatible identifier (format: /org/
|
|
84
|
+
- Library ID: Context7-compatible identifier (format: /org/project)
|
|
85
85
|
- Name: Library or package name
|
|
86
86
|
- Description: Short summary
|
|
87
87
|
- Code Snippets: Number of available code examples
|
|
88
88
|
- Trust Score: Authority indicator
|
|
89
|
+
- Versions: List of versions if available. Use one of those versions if and only if the user explicitly provides a version in their query.
|
|
89
90
|
|
|
90
91
|
For best results, select libraries based on name match, trust score, snippet coverage, and relevance to your use case.
|
|
91
92
|
|
|
@@ -96,10 +97,10 @@ ${resultsText}`,
|
|
|
96
97
|
],
|
|
97
98
|
};
|
|
98
99
|
});
|
|
99
|
-
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.", {
|
|
100
|
+
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.", {
|
|
100
101
|
context7CompatibleLibraryID: z
|
|
101
102
|
.string()
|
|
102
|
-
.describe("Exact Context7-compatible library ID (e.g., 'mongodb/docs', 'vercel/
|
|
103
|
+
.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'."),
|
|
103
104
|
topic: z
|
|
104
105
|
.string()
|
|
105
106
|
.optional()
|
|
@@ -110,18 +111,9 @@ server.tool("get-library-docs", "Fetches up-to-date documentation for a library.
|
|
|
110
111
|
.optional()
|
|
111
112
|
.describe(`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`),
|
|
112
113
|
}, async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
|
|
113
|
-
|
|
114
|
-
let folders = "";
|
|
115
|
-
let libraryId = context7CompatibleLibraryID;
|
|
116
|
-
if (context7CompatibleLibraryID.includes("?folders=")) {
|
|
117
|
-
const [id, foldersParam] = context7CompatibleLibraryID.split("?folders=");
|
|
118
|
-
libraryId = id;
|
|
119
|
-
folders = foldersParam;
|
|
120
|
-
}
|
|
121
|
-
const documentationText = await fetchLibraryDocumentation(libraryId, {
|
|
114
|
+
const documentationText = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
|
|
122
115
|
tokens,
|
|
123
116
|
topic,
|
|
124
|
-
folders,
|
|
125
117
|
});
|
|
126
118
|
if (!documentationText) {
|
|
127
119
|
return {
|
package/dist/lib/api.js
CHANGED
|
@@ -37,8 +37,6 @@ export async function fetchLibraryDocumentation(libraryId, options = {}) {
|
|
|
37
37
|
url.searchParams.set("tokens", options.tokens.toString());
|
|
38
38
|
if (options.topic)
|
|
39
39
|
url.searchParams.set("topic", options.topic);
|
|
40
|
-
if (options.folders)
|
|
41
|
-
url.searchParams.set("folders", options.folders);
|
|
42
40
|
url.searchParams.set("type", DEFAULT_TYPE);
|
|
43
41
|
const response = await fetch(url, {
|
|
44
42
|
headers: {
|
package/dist/lib/utils.js
CHANGED
|
@@ -20,6 +20,10 @@ export function formatSearchResult(result) {
|
|
|
20
20
|
if (result.trustScore !== -1 && result.trustScore !== undefined) {
|
|
21
21
|
formattedResult.push(`- Trust Score: ${result.trustScore}`);
|
|
22
22
|
}
|
|
23
|
+
// Only add versions if it's a valid value
|
|
24
|
+
if (result.versions !== undefined && result.versions.length > 0) {
|
|
25
|
+
formattedResult.push(`- Versions: ${result.versions.join(", ")}`);
|
|
26
|
+
}
|
|
23
27
|
// Join all parts with newlines
|
|
24
28
|
return formattedResult.join("\n");
|
|
25
29
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@upstash/context7-mcp","version":"v1.0.
|
|
1
|
+
{"name":"@upstash/context7-mcp","version":"v1.0.10","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"}}
|