Skip to main content
Glama
sendProgress-fix.md3.37 kB
# SendProgress Implementation Fix ## Problem Analysis The `sendProgress` functionality in the SVGMaker MCP server was not working due to several critical issues: ### 1. **Incorrect API Usage** - **Problem**: The code was using `(server as any).sendProgress()` which doesn't exist in the MCP SDK v1.12.1 - **Location**: All tool files (`generateTool.ts`, `convertTool.ts`, `editTool.ts`) - **Impact**: Progress notifications were completely non-functional ### 2. **Wrong Progress Format** - **Problem**: Using a custom progress format that's incompatible with the MCP protocol - **Example**: ```typescript // WRONG - Custom format (server as any).sendProgress(token, { content: [{ type: 'text', text: 'Starting...' }], percentage: 0, }); ``` ### 3. **Inefficient Progress Updates** - **Problem**: Using `setInterval` to send fake progress updates every 5 seconds - **Impact**: Created unnecessary overhead and didn't reflect actual progress ## Solution Implemented ### 1. **Correct MCP Protocol Usage** Fixed the implementation to use the proper MCP protocol for progress notifications: ```typescript // CORRECT - MCP Protocol await server.notification({ method: 'notifications/progress', params: { progress: currentStep, total: steps, progressToken, }, }); ``` ### 2. **Step-Based Progress Tracking** Implemented a logical 4-step progress system: - **Step 0**: Initial/Starting - **Step 1**: Preparing request - **Step 3**: Processing complete - **Step 4**: Final/Complete ### 3. **Proper Progress Token Handling** - Extract progress token from `request.params._meta?.progressToken` - Check if token exists before sending notifications - Use the token correctly in the notification params ## Key Changes Made ### Files Modified: 1. **`src/tools/generateTool.ts`** 2. **`src/tools/convertTool.ts`** 3. **`src/tools/editTool.ts`** ### Changes Applied: 1. Removed incorrect `sendProgress` calls 2. Removed inefficient `setInterval` progress updates 3. Added proper `server.notification()` calls 4. Implemented step-based progress tracking 5. Fixed progress token handling 6. Cleaned up unused variables (`progressInterval`) ## Reference Implementation The fix was based on the official MCP server example from: `https://raw.githubusercontent.com/modelcontextprotocol/servers/bae14623dbbb5ede2f20b8dd57e29b67e1d87293/src/everything/everything.ts` Key pattern from the reference: ```typescript const progressToken = request.params._meta?.progressToken; if (progressToken !== undefined) { await server.notification({ method: "notifications/progress", params: { progress: i, total: steps, progressToken, }, }); } ``` ## Verification The implementation was verified by: 1. **Build Success**: `npm run build` completed without errors 2. **Linting Pass**: `npm run lint` found no issues 3. **TypeScript Compilation**: All type errors resolved ## Benefits of the Fix 1. **Functional Progress**: Progress notifications now work correctly 2. **Standards Compliant**: Uses proper MCP protocol 3. **Performance**: Removed unnecessary intervals and fake progress 4. **Maintainable**: Code follows MCP best practices 5. **Reliable**: Based on official reference implementation The `sendProgress` functionality is now fully operational and compliant with the Model Context Protocol specification.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GenWaveLLC/svgmaker-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server