@upstash/context7-mcp 2.1.2 → 2.1.4
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 +10 -0
- package/dist/lib/utils.js +9 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -245,6 +245,16 @@ async function main() {
|
|
|
245
245
|
extractHeaderValue(req.headers["x_api_key"]));
|
|
246
246
|
};
|
|
247
247
|
const handleMcpRequest = async (req, res, requireAuth) => {
|
|
248
|
+
// Reject GET requests — this server is stateless and does not send server-initiated
|
|
249
|
+
// notifications, so SSE streams serve no purpose and cause mass NGINX timeouts.
|
|
250
|
+
// Returning 405 is spec-compliant per MCP StreamableHTTP (2025-03-26).
|
|
251
|
+
if (req.method === "GET") {
|
|
252
|
+
return res.status(405).json({
|
|
253
|
+
jsonrpc: "2.0",
|
|
254
|
+
error: { code: -32000, message: "Server does not support GET requests" },
|
|
255
|
+
id: null,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
248
258
|
try {
|
|
249
259
|
const apiKey = extractApiKey(req);
|
|
250
260
|
const resourceUrl = RESOURCE_URL;
|
package/dist/lib/utils.js
CHANGED
|
@@ -41,6 +41,9 @@ export function formatSearchResult(result) {
|
|
|
41
41
|
if (result.versions !== undefined && result.versions.length > 0) {
|
|
42
42
|
formattedResult.push(`- Versions: ${result.versions.join(", ")}`);
|
|
43
43
|
}
|
|
44
|
+
if (result.source) {
|
|
45
|
+
formattedResult.push(`- Source: ${result.source}`);
|
|
46
|
+
}
|
|
44
47
|
// Join all parts with newlines
|
|
45
48
|
return formattedResult.join("\n");
|
|
46
49
|
}
|
|
@@ -55,8 +58,13 @@ export function formatSearchResults(searchResponse) {
|
|
|
55
58
|
if (!searchResponse.results || searchResponse.results.length === 0) {
|
|
56
59
|
return "No documentation libraries found matching your query.";
|
|
57
60
|
}
|
|
61
|
+
const parts = [];
|
|
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");
|
|
64
|
+
}
|
|
58
65
|
const formattedResults = searchResponse.results.map(formatSearchResult);
|
|
59
|
-
|
|
66
|
+
parts.push(formattedResults.join("\n----------\n"));
|
|
67
|
+
return parts.join("\n\n");
|
|
60
68
|
}
|
|
61
69
|
/**
|
|
62
70
|
* Extract client info from User-Agent header.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upstash/context7-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"mcpName": "io.github.upstash/context7",
|
|
5
5
|
"description": "MCP server for Context7",
|
|
6
6
|
"repository": {
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"format:check": "prettier --check .",
|
|
56
56
|
"dev": "tsc --watch",
|
|
57
57
|
"start": "node dist/index.js --transport http",
|
|
58
|
-
"pack-mcpb": "pnpm install && pnpm run build && rm -rf node_modules && pnpm install --prod && cp mcpb/manifest.json manifest.json && cp ../../public/icon.png icon.png && mcpb validate manifest.json && mcpb pack . mcpb/context7.mcpb && rm manifest.json icon.png && pnpm install"
|
|
58
|
+
"pack-mcpb": "pnpm install && pnpm run build && rm -rf node_modules && pnpm install --prod && cp mcpb/manifest.json manifest.json && cp mcpb/.mcpbignore .mcpbignore && cp ../../public/icon.png icon.png && mcpb validate manifest.json && mcpb pack . mcpb/context7.mcpb && rm manifest.json .mcpbignore icon.png && pnpm install"
|
|
59
59
|
}
|
|
60
60
|
}
|