Fix example server elicitation conf (#29)

* fix server elicitation conf

* Remove empty elicitation object from server config

* Use ElicitResultSchema instead of z.any() for proper validation

The elicitation/create response should be validated against ElicitResultSchema
which ensures the response has the correct structure (action, content fields)
rather than accepting any response.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Paul Carleton <paulc@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
This commit is contained in:
Pavel Bezglasny 2025-11-20 15:33:37 +01:00 • committed by GitHub
commit 7f0755627f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,6 +13,7 @@ import {
ResourceTemplate
} from '@modelcontextprotocol/sdk/server/mcp.js';
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
import { ElicitResultSchema } from '@modelcontextprotocol/sdk/types.js';
import { z } from 'zod';
import express from 'express';
import cors from 'cors';
@ -369,9 +370,7 @@ function createMcpServer() {
}
}
},
z
.object({ method: z.literal('elicitation/create') })
.passthrough() as any
ElicitResultSchema
);
const elicitResult = result as any;
@ -445,9 +444,7 @@ function createMcpServer() {
}
}
},
z
.object({ method: z.literal('elicitation/create') })
.passthrough() as any
ElicitResultSchema
);
const elicitResult = result as any;
@ -544,9 +541,7 @@ function createMcpServer() {
}
}
},
z
.object({ method: z.literal('elicitation/create') })
.passthrough() as any
ElicitResultSchema
);
const elicitResult = result as any;