MCPcopy Create free account
hub / github.com/echoVic/blade-code / handleInitialize

Method handleInitialize

src/mcp/server/MCPServer.ts:194–209  ·  view source on GitHub ↗

* 处理初始化请求

(clientId: string, message: MCPMessage)

Source from the content-addressed store, hash-verified

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 * 处理列出资源

Callers 1

handleMessageMethod · 0.95

Calls 2

sendResponseMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected