Skip to content

Conversation

@jonathannorris
Copy link
Member

@jonathannorris jonathannorris commented Aug 11, 2025

Cleanup MCP implementation issues

This PR addresses several technical debt items and UX improvements in the MCP (Model Context Protocol) implementation:

✨ Features

  • Add destructive hints to self-targeting override tools to warn users about potentially dangerous operations

🔧 Technical improvements

  • Unify header management between CLI and Worker implementations with consistent initializeMCPHeaders() pattern
  • Improve TypeScript configuration for MCP worker with proper noEmit flag and build script cleanup
  • Enhance type safety by removing unnecessary type casting and improving interface definitions
  • Better error handling with more specific type annotations and runtime safety

@jonathannorris jonathannorris requested a review from a team as a code owner August 11, 2025 20:29
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 11, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
devcycle-mcp-server c0452d8 Aug 11 2025, 08:59 PM

@jonathannorris jonathannorris requested review from JamieSinn, Copilot and kaushalkapasi and removed request for a team August 11, 2025 20:29

This comment was marked as outdated.

@jonathannorris jonathannorris changed the base branch from feat-mcp-server to main August 11, 2025 20:48
@jonathannorris jonathannorris force-pushed the chore-cleanup-mcp-issues branch from 8fcaa64 to 0f3669c Compare August 11, 2025 20:48
@jonathannorris jonathannorris changed the base branch from main to feat-mcp-server August 11, 2025 20:52
@jonathannorris jonathannorris force-pushed the chore-cleanup-mcp-issues branch from ca9b438 to c0452d8 Compare August 11, 2025 20:57
@jonathannorris jonathannorris requested a review from Copilot August 11, 2025 21:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"outDir": "./dist",

Copilot uses AI. Check for mistakes.
@jonathannorris jonathannorris merged commit e7780b1 into feat-mcp-server Aug 11, 2025
4 of 7 checks passed
@jonathannorris jonathannorris deleted the chore-cleanup-mcp-issues branch August 11, 2025 21:02
jonathannorris added a commit that referenced this pull request Aug 11, 2025
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants