(protocolVersion?: string)
| 907 | |
| 908 | describe('initialize protocol version negotiation', () => { |
| 909 | async function callInitialize(protocolVersion?: string) { |
| 910 | dbChainMockFns.limit.mockResolvedValueOnce([ |
| 911 | { |
| 912 | id: 'server-1', |
| 913 | name: 'Public Server', |
| 914 | workspaceId: 'ws-1', |
| 915 | isPublic: true, |
| 916 | createdBy: 'owner-1', |
| 917 | }, |
| 918 | ]) |
| 919 | const params: Record<string, unknown> = { |
| 920 | capabilities: {}, |
| 921 | clientInfo: { name: 'test', version: '1.0.0' }, |
| 922 | } |
| 923 | if (protocolVersion !== undefined) params.protocolVersion = protocolVersion |
| 924 | const req = new NextRequest('http://localhost:3000/api/mcp/serve/server-1', { |
| 925 | method: 'POST', |
| 926 | body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize', params }), |
| 927 | }) |
| 928 | const res = await POST(req, { params: Promise.resolve({ serverId: 'server-1' }) }) |
| 929 | return res.json() as Promise<{ result: { protocolVersion: string } }> |
| 930 | } |
| 931 | |
| 932 | it('echoes a supported client protocolVersion (2025-06-18)', async () => { |
| 933 | const body = await callInitialize('2025-06-18') |
no test coverage detected