@upstash/context7-mcp 1.0.16 → 1.0.17
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 +14 -30
- package/dist/index.js +12 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# Context7 MCP - Up-to-date Code Docs For Any Prompt
|
|
2
4
|
|
|
3
5
|
[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp)
|
|
@@ -11,7 +13,7 @@
|
|
|
11
13
|
LLMs rely on outdated or generic information about the libraries you use. You get:
|
|
12
14
|
|
|
13
15
|
- ❌ Code examples are outdated and based on year-old training data
|
|
14
|
-
- ❌ Hallucinated APIs don't even exist
|
|
16
|
+
- ❌ Hallucinated APIs that don't even exist
|
|
15
17
|
- ❌ Generic answers for old package versions
|
|
16
18
|
|
|
17
19
|
## ✅ With Context7
|
|
@@ -48,6 +50,11 @@ Check out our [project addition guide](./docs/adding-projects.md) to learn how t
|
|
|
48
50
|
- Cursor, Claude Code, VSCode, Windsurf or another MCP Client
|
|
49
51
|
- Context7 API Key (Optional for higher rate limits) (Get yours by creating an account at [context7.com/dashboard](https://context7.com/dashboard))
|
|
50
52
|
|
|
53
|
+
> [!WARNING]
|
|
54
|
+
> **SSE Protocol Deprecation Notice**
|
|
55
|
+
>
|
|
56
|
+
> The Server-Sent Events (SSE) transport protocol is deprecated and its endpoint will be removed in upcoming releases. Please use HTTP or stdio transport methods instead.
|
|
57
|
+
|
|
51
58
|
<details>
|
|
52
59
|
<summary><b>Installing via Smithery</b></summary>
|
|
53
60
|
|
|
@@ -107,7 +114,7 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
|
|
107
114
|
<details>
|
|
108
115
|
<summary><b>Install in Claude Code</b></summary>
|
|
109
116
|
|
|
110
|
-
Run this command. See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/
|
|
117
|
+
Run this command. See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp) for more info.
|
|
111
118
|
|
|
112
119
|
#### Claude Code Remote Server Connection
|
|
113
120
|
|
|
@@ -115,12 +122,6 @@ Run this command. See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/
|
|
|
115
122
|
claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY"
|
|
116
123
|
```
|
|
117
124
|
|
|
118
|
-
Or using SSE transport:
|
|
119
|
-
|
|
120
|
-
```sh
|
|
121
|
-
claude mcp add --transport sse context7 https://mcp.context7.com/sse --header "CONTEXT7_API_KEY: YOUR_API_KEY"
|
|
122
|
-
```
|
|
123
|
-
|
|
124
125
|
#### Claude Code Local Server Connection
|
|
125
126
|
|
|
126
127
|
```sh
|
|
@@ -333,7 +334,8 @@ See [Gemini CLI Configuration](https://google-gemini.github.io/gemini-cli/docs/t
|
|
|
333
334
|
"context7": {
|
|
334
335
|
"httpUrl": "https://mcp.context7.com/mcp",
|
|
335
336
|
"headers": {
|
|
336
|
-
"CONTEXT7_API_KEY": "YOUR_API_KEY"
|
|
337
|
+
"CONTEXT7_API_KEY": "YOUR_API_KEY",
|
|
338
|
+
"Accept": "application/json, text/event-stream"
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
}
|
|
@@ -755,7 +757,7 @@ Add this to your Visual Studio MCP config file (see the [Visual Studio docs](htt
|
|
|
755
757
|
"inputs": [],
|
|
756
758
|
"servers": {
|
|
757
759
|
"context7": {
|
|
758
|
-
"type": "
|
|
760
|
+
"type": "http",
|
|
759
761
|
"url": "https://mcp.context7.com/mcp",
|
|
760
762
|
"headers": {
|
|
761
763
|
"CONTEXT7_API_KEY": "YOUR_API_KEY"
|
|
@@ -807,23 +809,6 @@ Add this to your Crush configuration file. See [Crush MCP docs](https://github.c
|
|
|
807
809
|
}
|
|
808
810
|
```
|
|
809
811
|
|
|
810
|
-
#### Crush Remote Server Connection (SSE)
|
|
811
|
-
|
|
812
|
-
```json
|
|
813
|
-
{
|
|
814
|
-
"$schema": "https://charm.land/crush.json",
|
|
815
|
-
"mcp": {
|
|
816
|
-
"context7": {
|
|
817
|
-
"type": "sse",
|
|
818
|
-
"url": "https://mcp.context7.com/sse",
|
|
819
|
-
"headers": {
|
|
820
|
-
"CONTEXT7_API_KEY": "YOUR_API_KEY"
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
```
|
|
826
|
-
|
|
827
812
|
#### Crush Local Server Connection
|
|
828
813
|
|
|
829
814
|
```json
|
|
@@ -985,13 +970,12 @@ See [Local and Remote MCPs for Perplexity](https://www.perplexity.ai/help-center
|
|
|
985
970
|
Context7 MCP provides the following tools that LLMs can use:
|
|
986
971
|
|
|
987
972
|
- `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
|
|
988
|
-
|
|
989
973
|
- `libraryName` (required): The name of the library to search for
|
|
990
974
|
|
|
991
975
|
- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
|
|
992
976
|
- `context7CompatibleLibraryID` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
|
|
993
977
|
- `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")
|
|
994
|
-
- `tokens` (optional, default
|
|
978
|
+
- `tokens` (optional, default 5000): Max number of tokens to return. Values less than 1000 are automatically increased to 1000.
|
|
995
979
|
|
|
996
980
|
## 🛟 Tips
|
|
997
981
|
|
|
@@ -1019,7 +1003,7 @@ Context7 MCP provides the following tools that LLMs can use:
|
|
|
1019
1003
|
|
|
1020
1004
|
### HTTPS Proxy
|
|
1021
1005
|
|
|
1022
|
-
|
|
1006
|
+
If you are behind an HTTP proxy, Context7 uses the standard `https_proxy` / `HTTPS_PROXY` environment variables.
|
|
1023
1007
|
|
|
1024
1008
|
## 💻 Development
|
|
1025
1009
|
|
package/dist/index.js
CHANGED
|
@@ -8,11 +8,16 @@ import { createServer } from "http";
|
|
|
8
8
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
9
9
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
10
10
|
import { Command } from "commander";
|
|
11
|
-
|
|
11
|
+
/** Minimum allowed tokens for documentation retrieval */
|
|
12
|
+
const MINIMUM_TOKENS = 1000;
|
|
13
|
+
/** Default tokens when none specified */
|
|
14
|
+
const DEFAULT_TOKENS = 5000;
|
|
15
|
+
/** Default HTTP server port */
|
|
16
|
+
const DEFAULT_PORT = 3000;
|
|
12
17
|
// Parse CLI arguments using commander
|
|
13
18
|
const program = new Command()
|
|
14
19
|
.option("--transport <stdio|http>", "transport type", "stdio")
|
|
15
|
-
.option("--port <number>", "port for HTTP transport",
|
|
20
|
+
.option("--port <number>", "port for HTTP transport", DEFAULT_PORT.toString())
|
|
16
21
|
.option("--api-key <key>", "API key for authentication")
|
|
17
22
|
.allowUnknownOption() // let MCP Inspector / other wrappers pass through extra flags
|
|
18
23
|
.parse(process.argv);
|
|
@@ -72,7 +77,7 @@ function getClientIp(req) {
|
|
|
72
77
|
function createServerInstance(clientIp, apiKey) {
|
|
73
78
|
const server = new McpServer({
|
|
74
79
|
name: "Context7",
|
|
75
|
-
version: "1.0.
|
|
80
|
+
version: "1.0.17",
|
|
76
81
|
}, {
|
|
77
82
|
instructions: "Use this server to retrieve up-to-date documentation and code examples for any library.",
|
|
78
83
|
});
|
|
@@ -154,11 +159,11 @@ ${resultsText}`,
|
|
|
154
159
|
.describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
|
|
155
160
|
tokens: z
|
|
156
161
|
.preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number())
|
|
157
|
-
.transform((val) => (val <
|
|
162
|
+
.transform((val) => (val < MINIMUM_TOKENS ? MINIMUM_TOKENS : val))
|
|
158
163
|
.optional()
|
|
159
|
-
.describe(`Maximum number of tokens of documentation to retrieve (default: ${
|
|
164
|
+
.describe(`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_TOKENS}). Higher values provide more context but consume more tokens.`),
|
|
160
165
|
},
|
|
161
|
-
}, async ({ context7CompatibleLibraryID, tokens =
|
|
166
|
+
}, async ({ context7CompatibleLibraryID, tokens = DEFAULT_TOKENS, topic = "" }) => {
|
|
162
167
|
const fetchDocsResponse = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
|
|
163
168
|
tokens,
|
|
164
169
|
topic,
|
|
@@ -188,7 +193,7 @@ async function main() {
|
|
|
188
193
|
const transportType = TRANSPORT_TYPE;
|
|
189
194
|
if (transportType === "http") {
|
|
190
195
|
// Get initial port from environment or use default
|
|
191
|
-
const initialPort = CLI_PORT ??
|
|
196
|
+
const initialPort = CLI_PORT ?? DEFAULT_PORT;
|
|
192
197
|
// Keep track of which port we end up using
|
|
193
198
|
let actualPort = initialPort;
|
|
194
199
|
const httpServer = createServer(async (req, res) => {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@upstash/context7-mcp","version":"1.0.
|
|
1
|
+
{"name":"@upstash/context7-mcp","version":"1.0.17","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","pack-dxt":"bun install && bun run build && rm -rf node_modules && bun install --production && mv dxt/.dxtignore .dxtignore && mv dxt/manifest.json manifest.json && dxt validate manifest.json && dxt pack . dxt/context7.dxt && mv manifest.json dxt/manifest.json && mv .dxtignore dxt/.dxtignore && bun install"},"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.13.2","commander":"^14.0.0","undici":"^6.6.3","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.34.0","eslint-config-prettier":"^10.1.1","eslint-plugin-prettier":"^5.2.5","prettier":"^3.6.2","typescript":"^5.8.2","typescript-eslint":"^8.28.0"}}
|