Skip to content

Commit 082bf9e

Browse files
committed
fix: prevent blocking Cursor (mcp-server)
1 parent 4f84c64 commit 082bf9e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

mcp-server/src/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class MyMCP extends McpAgent {
4848
}
4949

5050
// Enhanced request validation for SSE endpoints
51-
// Combines Accept header validation with User-Agent security check
51+
// Validates Accept header and logs suspicious User-Agents (but doesn't block)
5252
function validateSSERequest(request: Request): { valid: boolean; error?: string } {
5353
// Check Accept header
5454
const accept = request.headers.get("accept");
@@ -68,13 +68,10 @@ function validateSSERequest(request: Request): { valid: boolean; error?: string
6868
}
6969
// Accept missing header for backwards compatibility
7070

71-
// Check User-Agent (block empty or suspicious)
71+
// Log suspicious User-Agents but don't block (MCP clients may not send standard UAs)
7272
const userAgent = request.headers.get("user-agent") || "";
7373
if (userAgent && userAgent.length < 5) {
74-
return {
75-
valid: false,
76-
error: "Invalid User-Agent header"
77-
};
74+
console.warn(`Suspicious User-Agent detected: "${userAgent}"`);
7875
}
7976

8077
return { valid: true };

0 commit comments

Comments
 (0)