* 处理初始化请求
(clientId: string, message: MCPMessage)
| 192 | * 处理初始化请求 |
| 193 | */ |
| 194 | private async handleInitialize(clientId: string, message: MCPMessage): Promise<void> { |
| 195 | const clientInfo = message.params?.clientInfo as MCPClientInfo; |
| 196 | |
| 197 | this.sendResponse(clientId, message.id, { |
| 198 | protocolVersion: '2024-11-05', |
| 199 | capabilities: this.serverInfo.capabilities, |
| 200 | serverInfo: { |
| 201 | name: this.serverInfo.name, |
| 202 | version: this.serverInfo.version, |
| 203 | }, |
| 204 | }); |
| 205 | |
| 206 | console.log( |
| 207 | `Client initialized: ${clientInfo?.name || 'Unknown'} v${clientInfo?.version || '0.0.0'}` |
| 208 | ); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * 处理列出资源 |
no test coverage detected