feat: 增加对 Windows CLI 工具的支持,允许使用 cmd 作为首选 shell,并改进错误处理

This commit is contained in:
catlog22
2026-02-20 11:14:22 +08:00
parent 113d0bd234
commit d6bf941113
10 changed files with 174 additions and 28 deletions

View File

@@ -4,4 +4,19 @@
* Entry point for running CCW tools as an MCP server
*/
import '../dist/mcp-server/index.js';
// IMPORTANT:
// MCP stdio servers must not write arbitrary text to stdout.
// stdout is reserved for JSON-RPC protocol messages.
// Redirect common console output to stderr to avoid breaking handshake.
const toStderr = (...args) => console.error(...args);
console.log = toStderr;
console.info = toStderr;
console.debug = toStderr;
console.dir = toStderr;
try {
await import('../dist/mcp-server/index.js');
} catch (err) {
console.error('[ccw-mcp] Failed to start MCP server:', err);
process.exit(1);
}