refactor(mcp): unify header setting between CLI and Worker implementations#486
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
devcycle-mcp-server | c0452d8 | Aug 11 2025, 08:59 PM |
8fcaa64 to
0f3669c
Compare
ca9b438 to
c0452d8
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the MCP (Model Context Protocol) implementation to unify header management patterns and improve type safety. The changes focus on standardizing how MCP servers initialize and manage API headers while adding safety features for destructive operations.
- Unified header management with consistent
initializeMCPHeaders()pattern across CLI and Worker implementations - Enhanced type safety by removing unnecessary type casting and improving interface definitions with proper TypeScript types
- Added destructive hints to self-targeting override tools to warn users about potentially dangerous operations
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/mcp/utils/headers.ts | Changed default mcpVersion from 'unknown' to empty string |
| src/mcp/tools/selfTargetingTools.ts | Added destructiveHint annotations to override tools for safety warnings |
| src/mcp/server.ts | Improved type definitions and removed unnecessary type casting |
| src/mcp/index.ts | Simplified error handling by removing unused error parameter |
| mcp-worker/wrangler.toml | Added ENABLE_OUTPUT_SCHEMAS environment variable configuration |
| mcp-worker/tsconfig.json | Added noEmit flag to TypeScript configuration |
| mcp-worker/src/index.ts | Unified header initialization pattern and improved type safety |
| mcp-worker/src/apiClient.ts | Refactored to use new unified header management functions |
| @@ -3,6 +3,7 @@ | |||
| "compilerOptions": { | |||
| "outDir": "./dist", | |||
There was a problem hiding this comment.
Adding noEmit: true to a TypeScript configuration that has an outDir specified is contradictory. The noEmit flag prevents TypeScript from generating output files, making the outDir setting meaningless. Consider removing either noEmit: true or the outDir setting based on whether you want TypeScript to emit files or just perform type checking.
| "outDir": "./dist", |
…tions (#486) * refactor(mcp): unify header setting between CLI and Worker implementations * chore: cleanup TS worker config * feat: add destructiveHint to self-targeting tools * fix: env.ENABLE_OUTPUT_SCHEMAS support * chore: cleanup setting mcp headers * chore: cleanup
Cleanup MCP implementation issues
This PR addresses several technical debt items and UX improvements in the MCP (Model Context Protocol) implementation:
✨ Features
🔧 Technical improvements
initializeMCPHeaders()patternnoEmitflag and build script cleanup