@upstash/context7-mcp 2.1.2 → 2.1.3
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 +3 -0
- package/package.json +1 -1
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
|
}
|