@upstash/context7-mcp 2.2.0 → 2.2.2
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 +20 -8
- package/dist/lib/constants.js +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import express from "express";
|
|
|
9
9
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
10
10
|
import { Command } from "commander";
|
|
11
11
|
import { AsyncLocalStorage } from "async_hooks";
|
|
12
|
-
import { SERVER_VERSION, RESOURCE_URL, AUTH_SERVER_URL } from "./lib/constants.js";
|
|
12
|
+
import { SERVER_VERSION, RESOURCE_URL, AUTH_SERVER_URL, OPENAI_APPS_CHALLENGE_TOKEN, } from "./lib/constants.js";
|
|
13
13
|
/** Default HTTP server port */
|
|
14
14
|
const DEFAULT_PORT = 3000;
|
|
15
15
|
// Parse CLI arguments using commander
|
|
@@ -160,6 +160,9 @@ IMPORTANT: Do not call this tool more than 3 times per question. If you cannot f
|
|
|
160
160
|
},
|
|
161
161
|
annotations: {
|
|
162
162
|
readOnlyHint: true,
|
|
163
|
+
destructiveHint: false,
|
|
164
|
+
openWorldHint: true,
|
|
165
|
+
idempotentHint: true,
|
|
163
166
|
},
|
|
164
167
|
}, async ({ query, libraryName }) => {
|
|
165
168
|
const searchResponse = await searchLibraries(query, libraryName, getClientContext());
|
|
@@ -194,7 +197,7 @@ server.registerTool("query-docs", {
|
|
|
194
197
|
|
|
195
198
|
You must call 'Resolve Context7 Library ID' tool 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.
|
|
196
199
|
|
|
197
|
-
|
|
200
|
+
Do not call this tool more than 3 times per question.`,
|
|
198
201
|
inputSchema: {
|
|
199
202
|
libraryId: z
|
|
200
203
|
.string()
|
|
@@ -202,16 +205,15 @@ Workflow: call first without researchMode. If that doesn't answer the question,
|
|
|
202
205
|
query: z
|
|
203
206
|
.string()
|
|
204
207
|
.describe("The question or task you need help with. Be specific and include relevant details. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad: 'auth' or 'hooks'. 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."),
|
|
205
|
-
researchMode: z
|
|
206
|
-
.boolean()
|
|
207
|
-
.optional()
|
|
208
|
-
.describe(`Retry the query with deep research: spins up sandboxed agents that read the actual source repos and runs a live web search, then synthesizes a fresh answer. Set true on retry if you weren't satisfied with the first answer and want a more thorough one. Requires an API key — you can get one free at https://context7.com.`),
|
|
209
208
|
},
|
|
210
209
|
annotations: {
|
|
211
210
|
readOnlyHint: true,
|
|
211
|
+
destructiveHint: false,
|
|
212
|
+
openWorldHint: true,
|
|
213
|
+
idempotentHint: true,
|
|
212
214
|
},
|
|
213
|
-
}, async ({ query, libraryId
|
|
214
|
-
const response = await fetchLibraryContext({ query, libraryId
|
|
215
|
+
}, async ({ query, libraryId }) => {
|
|
216
|
+
const response = await fetchLibraryContext({ query, libraryId }, getClientContext());
|
|
215
217
|
return {
|
|
216
218
|
content: [
|
|
217
219
|
{
|
|
@@ -373,6 +375,16 @@ async function main() {
|
|
|
373
375
|
});
|
|
374
376
|
}
|
|
375
377
|
});
|
|
378
|
+
// OpenAI Apps SDK domain verification challenge
|
|
379
|
+
app.get("/.well-known/openai-apps-challenge", (_req, res) => {
|
|
380
|
+
if (!OPENAI_APPS_CHALLENGE_TOKEN) {
|
|
381
|
+
return res.status(404).json({
|
|
382
|
+
error: "not_found",
|
|
383
|
+
message: "Endpoint not found.",
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
res.type("text/plain").send(OPENAI_APPS_CHALLENGE_TOKEN);
|
|
387
|
+
});
|
|
376
388
|
// Catch-all 404 handler - must be after all other routes
|
|
377
389
|
app.use((_req, res) => {
|
|
378
390
|
res.status(404).json({
|
package/dist/lib/constants.js
CHANGED
|
@@ -10,3 +10,4 @@ export const CLERK_DOMAIN = "clerk.context7.com";
|
|
|
10
10
|
export const CONTEXT7_API_BASE_URL = process.env.CONTEXT7_API_URL || `${CONTEXT7_BASE_URL}/api`;
|
|
11
11
|
export const RESOURCE_URL = process.env.RESOURCE_URL || MCP_RESOURCE_URL;
|
|
12
12
|
export const AUTH_SERVER_URL = process.env.AUTH_SERVER_URL || CONTEXT7_BASE_URL;
|
|
13
|
+
export const OPENAI_APPS_CHALLENGE_TOKEN = process.env.OPENAI_APPS_CHALLENGE_TOKEN;
|