mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-07 02:07:54 +02:00
Merge pull request #2869 from actus7/consolidate/mcp-health-v3
fix(hooks): consolidate MCP health-check fixes (3 PRs)
This commit is contained in:
@@ -28,8 +28,11 @@ const MAX_BACKOFF_MS = 10 * 60 * 1000;
|
||||
// Claude Code's stored OAuth bearer token. Treat auth-gated responses as
|
||||
// reachable so the real MCP client can attempt the authenticated call. A
|
||||
// Streamable HTTP MCP server can also return 406 to a bare GET that omits
|
||||
// Accept: text/event-stream; that still proves the endpoint is alive.
|
||||
const HEALTHY_HTTP_CODES = new Set([200, 201, 202, 204, 301, 302, 303, 304, 307, 308, 400, 401, 403, 405, 406]);
|
||||
// Accept: text/event-stream; that still proves the endpoint is alive. Some
|
||||
// POST-only Streamable HTTP servers (e.g. Paper Desktop) answer a bare GET
|
||||
// with 404 instead; a routed HTTP response of any kind proves reachability,
|
||||
// so treat 404 as alive and let the real MCP client validate the endpoint.
|
||||
const HEALTHY_HTTP_CODES = new Set([200, 201, 202, 204, 301, 302, 303, 304, 307, 308, 400, 401, 403, 404, 405, 406]);
|
||||
const RECONNECT_STATUS_CODES = new Set([401, 403, 429, 503]);
|
||||
const FAILURE_PATTERNS = [
|
||||
{ code: 401, pattern: /\b401\b|unauthori[sz]ed|auth(?:entication)?\s+(?:failed|expired|invalid)/i },
|
||||
|
||||
+10
-2
@@ -423,8 +423,16 @@ function createMemoryMcpService(options = {}) {
|
||||
return jsonRpcResult(message.id, {});
|
||||
}
|
||||
if (message.method === 'tools/list') {
|
||||
if (message.params && Object.keys(message.params).length > 0) {
|
||||
return jsonRpcError(message.id, -32602, 'tools/list does not accept parameters.');
|
||||
const params = message.params || {};
|
||||
if (
|
||||
(Object.prototype.hasOwnProperty.call(params, '_meta') && !isRecord(params._meta))
|
||||
|| (
|
||||
Object.prototype.hasOwnProperty.call(params, 'cursor')
|
||||
&& typeof params.cursor !== 'string'
|
||||
)
|
||||
|| Object.keys(params).some(key => !['cursor', '_meta'].includes(key))
|
||||
) {
|
||||
return jsonRpcError(message.id, -32602, 'Invalid tools/list parameters.');
|
||||
}
|
||||
return jsonRpcResult(message.id, {
|
||||
tools: TOOL_DEFINITIONS.map(tool => ({ ...tool })),
|
||||
|
||||
Reference in New Issue
Block a user