@upstash/context7-mcp 2.1.4 → 2.1.7

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 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)")
@@ -91,8 +92,18 @@ function getClientIp(req) {
91
92
  const server = new McpServer({
92
93
  name: "Context7",
93
94
  version: SERVER_VERSION,
95
+ websiteUrl: "https://context7.com",
96
+ description: "Context7 provides up-to-date documentation and code examples for libraries and frameworks.",
97
+ icons: [
98
+ {
99
+ src: "https://context7.com/context7-icon-green.png",
100
+ mimeType: "image/png",
101
+ },
102
+ ],
94
103
  }, {
95
- instructions: "Use this server to retrieve up-to-date documentation and code examples for any library.",
104
+ instructions: `Use this server to fetch current documentation whenever the user asks about a library, framework, SDK, API, CLI tool, or cloud service -- even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot. This includes API syntax, configuration, version migration, library-specific debugging, setup instructions, and CLI tool usage. Use even when you think you know the answer -- your training data may not reflect recent changes. Prefer this over web search for library docs.
105
+
106
+ Do not use for: refactoring, writing scripts from scratch, debugging business logic, code review, or general programming concepts.`,
96
107
  });
97
108
  // Capture client info from MCP initialize handshake
98
109
  server.server.oninitialized = () => {
@@ -145,7 +156,7 @@ IMPORTANT: Do not call this tool more than 3 times per question. If you cannot f
145
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."),
146
157
  libraryName: z
147
158
  .string()
148
- .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'."),
149
160
  },
150
161
  annotations: {
151
162
  readOnlyHint: true,
package/dist/lib/api.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { generateHeaders } from "./encryption.js";
2
- import { ProxyAgent, setGlobalDispatcher } from "undici";
2
+ import { Agent, ProxyAgent, setGlobalDispatcher } from "undici";
3
3
  import { CONTEXT7_API_BASE_URL } from "./constants.js";
4
+ import { readFileSync } from "fs";
4
5
  /**
5
6
  * Parses error response from the Context7 API
6
7
  * Extracts the server's error message, falling back to status-based messages if parsing fails
@@ -37,14 +38,38 @@ const PROXY_URL = process.env.HTTPS_PROXY ??
37
38
  process.env.HTTP_PROXY ??
38
39
  process.env.http_proxy ??
39
40
  null;
41
+ const CUSTOM_CA_CERTS = process.env.NODE_EXTRA_CA_CERTS;
42
+ function loadCustomCACerts() {
43
+ if (!CUSTOM_CA_CERTS)
44
+ return undefined;
45
+ try {
46
+ return readFileSync(CUSTOM_CA_CERTS);
47
+ }
48
+ catch (error) {
49
+ console.error(`[Context7] Failed to load custom CA certificates from ${CUSTOM_CA_CERTS}:`, error);
50
+ return undefined;
51
+ }
52
+ }
40
53
  if (PROXY_URL && !PROXY_URL.startsWith("$") && /^(http|https):\/\//i.test(PROXY_URL)) {
41
54
  try {
42
- setGlobalDispatcher(new ProxyAgent(PROXY_URL));
55
+ const ca = loadCustomCACerts();
56
+ setGlobalDispatcher(new ProxyAgent({ uri: PROXY_URL, ...(ca ? { connect: { ca } } : {}) }));
43
57
  }
44
58
  catch (error) {
45
59
  console.error(`[Context7] Failed to configure proxy agent for provided proxy URL: ${PROXY_URL}:`, error);
46
60
  }
47
61
  }
62
+ else if (CUSTOM_CA_CERTS) {
63
+ const ca = loadCustomCACerts();
64
+ if (ca) {
65
+ try {
66
+ setGlobalDispatcher(new Agent({ connect: { ca } }));
67
+ }
68
+ catch (error) {
69
+ console.error(`[Context7] Failed to configure custom CA certificates:`, error);
70
+ }
71
+ }
72
+ }
48
73
  /**
49
74
  * Searches for libraries matching the given query
50
75
  * @param query The user's question or task (used for LLM relevance ranking)
package/dist/lib/utils.js CHANGED
@@ -60,7 +60,7 @@ export function formatSearchResults(searchResponse) {
60
60
  }
61
61
  const parts = [];
62
62
  if (searchResponse.searchFilterApplied) {
63
- parts.push("**Note:** Your results only include libraries matching your access settings. To search across all public libraries, update your settings at https://context7.com/dashboard?tab=libraries");
63
+ parts.push("**Note:** Your results only include libraries matching your teamspace's library filters. To adjust quality thresholds or blocked libraries, update your filters at https://context7.com/dashboard?tab=policies");
64
64
  }
65
65
  const formattedResults = searchResponse.results.map(formatSearchResult);
66
66
  parts.push(formattedResults.join("\n----------\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upstash/context7-mcp",
3
- "version": "2.1.4",
3
+ "version": "2.1.7",
4
4
  "mcpName": "io.github.upstash/context7",
5
5
  "description": "MCP server for Context7",
6
6
  "repository": {