@upstash/context7-mcp 1.0.4 → 1.0.5

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  # Context7 MCP - Up-to-date Docs For Any Cursor Prompt
2
+ [![Website](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![smithery badge](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp)
2
3
 
3
4
  ## ❌ Without Context7
4
5
 
@@ -26,7 +27,7 @@ How do I invalidate a query in React Query? use context7
26
27
  How do I protect a route with NextAuth? use context7
27
28
  ```
28
29
 
29
- Context7 fetches up-to-date documentation and working code examples right into your LLMs context.
30
+ Context7 fetches up-to-date documentation and working code examples right into your LLM's context.
30
31
 
31
32
  - 1️⃣ Ask your question naturally
32
33
  - 2️⃣ Tell the LLM to `use context7`
@@ -41,11 +42,19 @@ No tab-switching, no hallucinated APIs that don't exist, no outdated code genera
41
42
  - Node.js >= v18.0.0
42
43
  - Cursor, Windsurf, Claude Desktop or another MCP Client
43
44
 
45
+ ### Installing via Smithery
46
+
47
+ To install Context7 MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@upstash/context7-mcp):
48
+
49
+ ```bash
50
+ npx -y @smithery/cli install @upstash/context7-mcp --client claude
51
+ ```
52
+
44
53
  ### Install in Cursor
45
54
 
46
55
  Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
47
56
 
48
- Paste this into your Cursor `~/.cursor/mcp.json` file. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
57
+ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file is the recommended approach. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
49
58
 
50
59
  ```json
51
60
  {
@@ -58,6 +67,38 @@ Paste this into your Cursor `~/.cursor/mcp.json` file. See [Cursor MCP docs](htt
58
67
  }
59
68
  ```
60
69
 
70
+ <details>
71
+ <summary>Alternative: Use Bun</summary>
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "context7": {
77
+ "command": "bunx",
78
+ "args": ["-y", "@upstash/context7-mcp@latest"]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ </details>
85
+
86
+ <details>
87
+ <summary>Alternative: Use Deno</summary>
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "context7": {
93
+ "command": "deno",
94
+ "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"]
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ </details>
101
+
61
102
  ### Install in Windsurf
62
103
 
63
104
  Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.windsurf.com/windsurf/mcp) for more info.
@@ -89,6 +130,29 @@ Add this to your VSCode MCP config file. See [VSCode MCP docs](https://code.visu
89
130
  }
90
131
  ```
91
132
 
133
+ ### Install in Claude Code
134
+
135
+ 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.
136
+
137
+ ```sh
138
+ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
139
+ ```
140
+
141
+ ### Install in Claude Desktop
142
+
143
+ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user) for more info.
144
+
145
+ ```json
146
+ {
147
+ "mcpServers": {
148
+ "Context7": {
149
+ "command": "npx",
150
+ "args": ["-y", "@upstash/context7-mcp@latest"]
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
92
156
  ### Available Tools
93
157
 
94
158
  - `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
@@ -131,6 +195,25 @@ bun run build
131
195
  npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
132
196
  ```
133
197
 
198
+ ## Troubleshooting
199
+
200
+ ### ERR_MODULE_NOT_FOUND
201
+
202
+ If you see this error, try using `bunx` instead of `npx`.
203
+
204
+ ```json
205
+ {
206
+ "mcpServers": {
207
+ "context7": {
208
+ "command": "bunx",
209
+ "args": ["-y", "@upstash/context7-mcp@latest"]
210
+ }
211
+ }
212
+ }
213
+ ```
214
+
215
+ This often resolves module resolution issues, especially in environments where `npx` does not properly install or resolve packages.
216
+
134
217
  ## License
135
218
 
136
219
  MIT
package/dist/index.js CHANGED
@@ -19,10 +19,9 @@ const server = new McpServer({
19
19
  server.tool("resolve-library-id", "Required first step: Resolves a general package name into a Context7-compatible library ID. Must be called before using 'get-library-docs' to retrieve a valid Context7-compatible library ID.", {
20
20
  libraryName: z
21
21
  .string()
22
- .optional()
23
- .describe("Optional library name to search for and rerank results based on."),
22
+ .describe("Library name to search for and retrieve a Context7-compatible library ID."),
24
23
  }, async ({ libraryName }) => {
25
- const searchResponse = await searchLibraries(libraryName || "");
24
+ const searchResponse = await searchLibraries(libraryName);
26
25
  if (!searchResponse || !searchResponse.results) {
27
26
  return {
28
27
  content: [
@@ -62,8 +61,10 @@ server.tool("get-library-docs", "Fetches up-to-date documentation for a library.
62
61
  .optional()
63
62
  .describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
64
63
  tokens: z
65
- .number()
66
- .min(DEFAULT_MINIMUM_TOKENS)
64
+ .preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number())
65
+ .refine((val) => typeof val === "number" && val >= DEFAULT_MINIMUM_TOKENS, {
66
+ message: `Must be a number >= ${DEFAULT_MINIMUM_TOKENS}`,
67
+ })
67
68
  .optional()
68
69
  .describe(`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`),
69
70
  }, async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
package/dist/lib/utils.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * @returns Formatted search result string
5
5
  */
6
6
  export function formatSearchResult(result) {
7
- return `Title: ${result.title}\n\nContext7-compatible library ID: ${result.id}`;
7
+ return `Title: ${result.title}\n\nContext7-compatible library ID: ${result.id}\n\nDescription: ${result.description}`;
8
8
  }
9
9
  /**
10
10
  * Format search results into a string representation
@@ -16,5 +16,5 @@ export function formatSearchResults(searchResponse) {
16
16
  return "No documentation libraries found matching your query.";
17
17
  }
18
18
  const formattedResults = searchResponse.results.map(formatSearchResult);
19
- return formattedResults.join("\n\n");
19
+ return formattedResults.join("\n\n--------------------\n");
20
20
  }
package/package.json CHANGED
@@ -1,44 +1 @@
1
- {
2
- "name": "@upstash/context7-mcp",
3
- "version": "1.0.4",
4
- "description": "MCP server for Context7",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1",
7
- "build": "tsc && chmod 755 dist/index.js",
8
- "format": "prettier --write .",
9
- "lint": "eslint \"**/*.{js,ts,tsx}\" --fix"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/upstash/context7-mcp.git"
14
- },
15
- "keywords": [],
16
- "author": "",
17
- "license": "MIT",
18
- "type": "module",
19
- "bin": {
20
- "context7-mcp": "dist/index.js"
21
- },
22
- "files": [
23
- "dist"
24
- ],
25
- "bugs": {
26
- "url": "https://github.com/upstash/context7-mcp/issues"
27
- },
28
- "homepage": "https://github.com/upstash/context7-mcp#readme",
29
- "dependencies": {
30
- "@modelcontextprotocol/sdk": "^1.8.0",
31
- "zod": "^3.24.2"
32
- },
33
- "devDependencies": {
34
- "@types/node": "^22.13.14",
35
- "@typescript-eslint/eslint-plugin": "^8.28.0",
36
- "@typescript-eslint/parser": "^8.28.0",
37
- "eslint": "^9.23.0",
38
- "eslint-config-prettier": "^10.1.1",
39
- "eslint-plugin-prettier": "^5.2.5",
40
- "prettier": "^3.5.3",
41
- "typescript": "^5.8.2",
42
- "typescript-eslint": "^8.28.0"
43
- }
44
- }
1
+ {"name":"@upstash/context7-mcp","version":"v1.0.5","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-mcp.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-mcp/issues"},"homepage":"https://github.com/upstash/context7-mcp#readme","dependencies":{"@modelcontextprotocol/sdk":"^1.8.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"}}