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

Method handleStdioConnection

src/mcp/server/MCPServer.ts:134–151  ·  view source on GitHub ↗

* 处理 Stdio 连接

()

Source from the content-addressed store, hash-verified

132 * 处理 Stdio 连接
133 */
134 private handleStdioConnection(): void {
135 process.stdin.on('data', async data => {
136 try {
137 const lines = data.toString().trim().split('\n');
138 for (const line of lines) {
139 if (line.trim()) {
140 const message = JSON.parse(line);
141 await this.handleMessage('stdio', message);
142 }
143 }
144 } catch (error) {
145 this.sendErrorToStdio(-32700, 'Parse error', error);
146 }
147 });
148
149 console.log('MCP Server listening on stdio');
150 this.emit('started', { transport: 'stdio' });
151 }
152
153 /**
154 * 处理消息

Callers 1

startMethod · 0.95

Calls 5

handleMessageMethod · 0.95
sendErrorToStdioMethod · 0.95
onMethod · 0.45
logMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected