mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: Add real-time progress output for MCP init action
- MCP server outputs progress to stderr during smart_search init
- Progress format: [Progress] {percent}% - {message}
- Does not interfere with JSON-RPC protocol (stdout)
- Added executeInitWithProgress for external progress callback
- Added executeToolWithProgress to tools/index.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
CallToolRequestSchema,
|
||||
ListToolsRequestSchema,
|
||||
} from '@modelcontextprotocol/sdk/types.js';
|
||||
import { getAllToolSchemas, executeTool } from '../tools/index.js';
|
||||
import { getAllToolSchemas, executeTool, executeToolWithProgress } from '../tools/index.js';
|
||||
import type { ToolSchema, ToolResult } from '../types/tool.js';
|
||||
|
||||
const SERVER_NAME = 'ccw-tools';
|
||||
@@ -104,7 +104,19 @@ function createServer(): Server {
|
||||
}
|
||||
|
||||
try {
|
||||
const result: ToolResult = await executeTool(name, args || {});
|
||||
// For smart_search init action, use progress-aware execution
|
||||
const isInitAction = name === 'smart_search' && args?.action === 'init';
|
||||
|
||||
let result: ToolResult;
|
||||
if (isInitAction) {
|
||||
// Execute with progress callback that writes to stderr
|
||||
result = await executeToolWithProgress(name, args || {}, (progress) => {
|
||||
// Output progress to stderr (visible in terminal, doesn't interfere with JSON-RPC)
|
||||
console.error(`[Progress] ${progress.percent}% - ${progress.message}`);
|
||||
});
|
||||
} else {
|
||||
result = await executeTool(name, args || {});
|
||||
}
|
||||
|
||||
if (!result.success) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user