@upstash/context7-mcp 2.1.6 → 2.1.8
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/dist/index.js +2 -1
- package/dist/lib/api.js +16 -5
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { SERVER_VERSION, RESOURCE_URL, AUTH_SERVER_URL } from "./lib/constants.j
|
|
|
14
14
|
const DEFAULT_PORT = 3000;
|
|
15
15
|
// Parse CLI arguments using commander
|
|
16
16
|
const program = new Command()
|
|
17
|
+
.version(SERVER_VERSION, "-v, --version", "output the current version")
|
|
17
18
|
.option("--transport <stdio|http>", "transport type", "stdio")
|
|
18
19
|
.option("--port <number>", "port for HTTP transport", DEFAULT_PORT.toString())
|
|
19
20
|
.option("--api-key <key>", "API key for authentication (or set CONTEXT7_API_KEY env var)")
|
|
@@ -155,7 +156,7 @@ IMPORTANT: Do not call this tool more than 3 times per question. If you cannot f
|
|
|
155
156
|
.describe("The question or task you need help with. This is used to rank library results by relevance to what the user is trying to accomplish. The query is sent to the Context7 API for processing. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query."),
|
|
156
157
|
libraryName: z
|
|
157
158
|
.string()
|
|
158
|
-
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
|
|
159
|
+
.describe("Library name to search for and retrieve a Context7-compatible library ID. Use the official library name with proper punctuation — e.g., 'Next.js' instead of 'nextjs', 'Customer.io' instead of 'customerio', 'Three.js' instead of 'threejs'."),
|
|
159
160
|
},
|
|
160
161
|
annotations: {
|
|
161
162
|
readOnlyHint: true,
|
package/dist/lib/api.js
CHANGED
|
@@ -2,6 +2,7 @@ import { generateHeaders } from "./encryption.js";
|
|
|
2
2
|
import { Agent, ProxyAgent, setGlobalDispatcher } from "undici";
|
|
3
3
|
import { CONTEXT7_API_BASE_URL } from "./constants.js";
|
|
4
4
|
import { readFileSync } from "fs";
|
|
5
|
+
import tls from "tls";
|
|
5
6
|
/**
|
|
6
7
|
* Parses error response from the Context7 API
|
|
7
8
|
* Extracts the server's error message, falling back to status-based messages if parsing fails
|
|
@@ -39,21 +40,31 @@ const PROXY_URL = process.env.HTTPS_PROXY ??
|
|
|
39
40
|
process.env.http_proxy ??
|
|
40
41
|
null;
|
|
41
42
|
const CUSTOM_CA_CERTS = process.env.NODE_EXTRA_CA_CERTS;
|
|
42
|
-
function
|
|
43
|
-
if (
|
|
43
|
+
export function getDefaultCACertificates() {
|
|
44
|
+
if (typeof tls.getCACertificates === "function") {
|
|
45
|
+
return tls.getCACertificates("default");
|
|
46
|
+
}
|
|
47
|
+
return [...tls.rootCertificates];
|
|
48
|
+
}
|
|
49
|
+
export function loadCustomCACerts(customCACertsPath = CUSTOM_CA_CERTS) {
|
|
50
|
+
if (!customCACertsPath)
|
|
44
51
|
return undefined;
|
|
45
52
|
try {
|
|
46
|
-
|
|
53
|
+
const customCa = readFileSync(customCACertsPath, "utf-8");
|
|
54
|
+
return [...getDefaultCACertificates(), customCa];
|
|
47
55
|
}
|
|
48
56
|
catch (error) {
|
|
49
|
-
console.error(`[Context7] Failed to load custom CA certificates from ${
|
|
57
|
+
console.error(`[Context7] Failed to load custom CA certificates from ${customCACertsPath}:`, error);
|
|
50
58
|
return undefined;
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
if (PROXY_URL && !PROXY_URL.startsWith("$") && /^(http|https):\/\//i.test(PROXY_URL)) {
|
|
54
62
|
try {
|
|
55
63
|
const ca = loadCustomCACerts();
|
|
56
|
-
setGlobalDispatcher(new ProxyAgent({
|
|
64
|
+
setGlobalDispatcher(new ProxyAgent({
|
|
65
|
+
uri: PROXY_URL,
|
|
66
|
+
...(ca ? { requestTls: { ca }, proxyTls: { ca } } : {}),
|
|
67
|
+
}));
|
|
57
68
|
}
|
|
58
69
|
catch (error) {
|
|
59
70
|
console.error(`[Context7] Failed to configure proxy agent for provided proxy URL: ${PROXY_URL}:`, error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upstash/context7-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"mcpName": "io.github.upstash/context7",
|
|
5
5
|
"description": "MCP server for Context7",
|
|
6
6
|
"repository": {
|
|
@@ -43,11 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.3",
|
|
46
|
-
"typescript": "^5.8.2"
|
|
46
|
+
"typescript": "^5.8.2",
|
|
47
|
+
"vitest": "^4.0.13"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "tsc && chmod 755 dist/index.js",
|
|
50
|
-
"test": "
|
|
51
|
+
"test": "pnpm exec vitest run",
|
|
51
52
|
"typecheck": "tsc --noEmit",
|
|
52
53
|
"lint": "eslint .",
|
|
53
54
|
"lint:check": "eslint .",
|