-
-
Notifications
You must be signed in to change notification settings - Fork 193
feat: add Claude Code compatibility workaround for MCP specification violation #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…violation Add XCODEBUILDMCP_CLAUDE_CODE_WORKAROUND environment variable to consolidate multiple content blocks into single text responses. This works around Claude Code''s MCP spec violation where it only shows the first content block, preventing users from seeing test results when stderr warnings are present. Changes: - Add consolidateContentForClaudeCode() utility function in validation.ts - Update build-utils.ts and test-common.ts to apply consolidation - Document new env var in CLAUDE.md - Preserve correct MCP format by default, consolidate only when enabled Fixes issue where test_sim_id_proj returns stderr warnings as errors, preventing access to test results in Claude Code. Co-authored-by: Cameron Cooke <cameroncooke@users.noreply.github.com>
|
""" WalkthroughA new workaround was introduced to address a compatibility issue with Claude Code, which only displays the first content block in tool responses. This involves a new function, Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant UtilityFunction
participant EnvironmentDetector
participant Validator
Caller->>UtilityFunction: executeXcodeBuildCommand() / handleTestLogic()
UtilityFunction->>EnvironmentDetector: isRunningUnderClaudeCode()
alt Running under Claude Code
UtilityFunction->>Validator: consolidateContentForClaudeCode(response)
Validator-->>UtilityFunction: consolidated response
else Not Claude Code
UtilityFunction-->>Caller: original response
end
UtilityFunction-->>Caller: final ToolResponse
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
""" Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (5)**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursorrules)
Files:
src/**/*.ts📄 CodeRabbit Inference Engine (.cursorrules)
Files:
src/utils/*📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
{src/tools/*,src/utils/command.ts}📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
**/*.ts📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
🧠 Learnings (5)📓 Common learningssrc/utils/command.ts (2)Learnt from: CR Learnt from: CR CLAUDE.md (10)Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR src/utils/environment.ts (1)Learnt from: CR docs/RELOADEROO.md (2)Learnt from: CR Learnt from: CR 🧬 Code Graph Analysis (2)CLAUDE.md (1)
src/utils/environment.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (4)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Claude finished @cameroncooke's task —— View job PR Review Complete ✅Reviewing this PR for Claude Code compatibility workaround implementation. Review Checklist:
Review SummaryThis PR implements a well-designed workaround for Claude Code's MCP specification violation. The implementation is clean, well-documented, and follows the project's patterns appropriately. Code Quality & Best Practices ✅Strengths:
Minor suggestions:
Potential Bugs & Issues ✅Implementation is solid:
No significant issues found. Performance Considerations ✅Efficient implementation:
Security Concerns ✅No security issues identified:
Test Coverage
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugbot free trial expires on August 7, 2025
Learn more in the Cursor dashboard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/utils/validation.ts (3)
219-219: Add explicit return type annotation.The coding guidelines require explicit function return types in TypeScript files.
-export function consolidateContentForClaudeCode(response: ToolResponse): ToolResponse { +export function consolidateContentForClaudeCode(response: ToolResponse): ToolResponse {Wait, the return type is already present. This is correct as-is.
233-234: Simplify the separator condition logic.The condition
index > 0 && textParts.length > 0is redundant sincetextParts.length > 0will always be true when we reach this point (we only get here ifitem.type === 'text'and we're about to pushitem.text).- if (index > 0 && textParts.length > 0) { + if (index > 0) {
230-239: Consider edge case handling for empty text content.The current implementation doesn't handle cases where
item.textmight be empty or whitespace-only, which could result in unnecessary separators.response.content.forEach((item, index) => { if (item.type === 'text') { + const trimmedText = item.text.trim(); + if (!trimmedText) return; + // Add a separator between content blocks (except for the first one) - if (index > 0 && textParts.length > 0) { + if (textParts.length > 0) { textParts.push('\n---\n'); } - textParts.push(item.text); + textParts.push(item.text); } // Note: Image content is not handled in this workaround as it requires special formatting });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
CLAUDE.md(1 hunks)src/utils/build-utils.ts(3 hunks)src/utils/test-common.ts(4 hunks)src/utils/validation.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursorrules)
**/*.{ts,tsx}: Explicit function return types are required in TypeScript files
Do not use console.log; use console.error for MCP logging
Prefix unused variables with an underscore in TypeScript files
Use ES Modules syntax (import/export) in all TypeScript files
Prefer explicit imports over wildcard imports in TypeScript files
Group imports in the following order: Node.js modules, third-party modules, then local modules
Name variables and functions in camelCase
Name classes in PascalCase
Prefer async/await over Promises in asynchronous code
Error handling should use typed errors from utils/errors.ts
Use ESLint for linting vianpm run lintandnpm run lint:fix
Use Prettier for formatting vianpm run formatandnpm run format:check
Log errors appropriately and integrate with Sentry for production error tracking
Handle both synchronous and asynchronous errors
Use appropriate log levels and structured logging in all TypeScript files
Include JSDoc comments for public APIs
Sanitize error messages before reporting to Sentry
Files:
src/utils/validation.tssrc/utils/build-utils.tssrc/utils/test-common.ts
src/**/*.ts
📄 CodeRabbit Inference Engine (.cursorrules)
Name files in kebab-case
Files:
src/utils/validation.tssrc/utils/build-utils.tssrc/utils/test-common.ts
src/utils/*
📄 CodeRabbit Inference Engine (CLAUDE.md)
Shared utilities such as command execution, validation, logging, and error handling should be placed in
src/utils/.
Files:
src/utils/validation.tssrc/utils/build-utils.tssrc/utils/test-common.ts
**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
**/*.ts: Use TypeScript strictly - noanytypes.
Add proper error handling and logging.
Files:
src/utils/validation.tssrc/utils/build-utils.tssrc/utils/test-common.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/xcodemake.ts : Experimental incremental builds should use `xcodemake` instead of `xcodebuild`, enabled via the `INCREMENTAL_BUILDS_ENABLED` environment variable, and implemented in `src/utils/xcodemake.ts`.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: example_projects/iOS/.cursor/rules/errors.mdc:0-0
Timestamp: 2025-07-22T19:54:12.588Z
Learning: Please don't fix any code errors unless reported by XcodeBuildMCP server tool responses.
CLAUDE.md (8)
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/xcodemake.ts : Experimental incremental builds should use xcodemake instead of xcodebuild, enabled via the INCREMENTAL_BUILDS_ENABLED environment variable, and implemented in src/utils/xcodemake.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: example_projects/iOS/.cursor/rules/errors.mdc:0-0
Timestamp: 2025-07-22T19:54:12.588Z
Learning: Please don't fix any code errors unless reported by XcodeBuildMCP server tool responses.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Update documentation for new features.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Tools must follow the MCP tool schema with proper parameter validation using Zod
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to TOOL_OPTIONS.md : Update TOOL_OPTIONS.md when adding configuration options for tools
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to {src/tools/*,src/utils/register-tools.ts,src/utils/tool-groups.ts,TOOLS.md} : When adding a new tool, create the tool implementation in src/tools/, define a Zod schema for parameters, register the tool in src/utils/register-tools.ts, add it to the appropriate tool group in src/utils/tool-groups.ts, and update TOOLS.md with the new tool's name, MCP tool name, and description.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/tool-groups.ts : Environment variables should control which tools are exposed, as managed in src/utils/tool-groups.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to TOOLS.md : Update TOOLS.md when adding, modifying, or removing tools.
src/utils/validation.ts (8)
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Tools must follow the MCP tool schema with proper parameter validation using Zod
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Validate all external inputs in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/xcodemake.ts : Experimental incremental builds should use xcodemake instead of xcodebuild, enabled via the INCREMENTAL_BUILDS_ENABLED environment variable, and implemented in src/utils/xcodemake.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Provide clear, actionable error messages in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Each tool must be a separate module in src/tools/
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/tool-groups.ts : Environment variables should control which tools are exposed, as managed in src/utils/tool-groups.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Always validate tool parameters with Zod in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : All xcodebuild operations must be asynchronous and use async/await
src/utils/build-utils.ts (15)
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to {src/tools/*,src/utils/command.ts} : External command execution should use the standardized pattern provided by src/utils/command.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : All xcodebuild operations must be asynchronous and use async/await
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to {src/tools/*,src/utils/errors.ts} : Error wrapping and logging should be handled consistently through src/utils/errors.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/xcodemake.ts : Experimental incremental builds should use xcodemake instead of xcodebuild, enabled via the INCREMENTAL_BUILDS_ENABLED environment variable, and implemented in src/utils/xcodemake.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Implement proper error handling with descriptive messages in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Provide clear, actionable error messages in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to **/*.ts : Add proper error handling and logging.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to **/*.{ts,tsx} : Error handling should use typed errors from utils/errors.ts
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Validate all external inputs in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Manage temporary files and directories appropriately in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/tools/* : Platform-specific tools should be organized in src/tools/, grouped by functionality (e.g., build tools as build_*.ts, simulator management as simulator.ts, etc.).
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Tools must follow the MCP tool schema with proper parameter validation using Zod
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/tools/axe.ts : Simulator UI automation should use the bundled AXe tool (bundled/axe), with coordinate extraction from the UI hierarchy, implemented in src/tools/axe.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/* : Shared utilities such as command execution, validation, logging, and error handling should be placed in src/utils/.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Always validate tool parameters with Zod in tool modules
src/utils/test-common.ts (14)
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Implement proper error handling with descriptive messages in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to {src/tools/*,src/utils/errors.ts} : Error wrapping and logging should be handled consistently through src/utils/errors.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Provide clear, actionable error messages in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Validate all external inputs in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Tools must follow the MCP tool schema with proper parameter validation using Zod
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to {src/tools/*,src/utils/command.ts} : External command execution should use the standardized pattern provided by src/utils/command.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : All xcodebuild operations must be asynchronous and use async/await
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Always validate tool parameters with Zod in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to **/*.ts : Add proper error handling and logging.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: .cursorrules:0-0
Timestamp: 2025-07-22T19:53:45.001Z
Learning: Applies to src/tools/*.ts : Manage temporary files and directories appropriately in tool modules
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/* : Shared utilities such as command execution, validation, logging, and error handling should be placed in src/utils/.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/tools/* : Platform-specific tools should be organized in src/tools/, grouped by functionality (e.g., build tools as build_*.ts, simulator management as simulator.ts, etc.).
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/utils/xcodemake.ts : Experimental incremental builds should use xcodemake instead of xcodebuild, enabled via the INCREMENTAL_BUILDS_ENABLED environment variable, and implemented in src/utils/xcodemake.ts.
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T19:54:09.554Z
Learning: Applies to src/tools/axe.ts : Simulator UI automation should use the bundled AXe tool (bundled/axe), with coordinate extraction from the UI hierarchy, implemented in src/tools/axe.ts.
🧬 Code Graph Analysis (2)
src/utils/validation.ts (1)
src/types/common.ts (1)
ToolResponse(34-39)
src/utils/build-utils.ts (2)
src/utils/validation.ts (2)
consolidateContentForClaudeCode(219-252)createTextResponse(34-44)src/utils/logger.ts (1)
log(33-49)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Cursor Bugbot
- GitHub Check: claude-review
🔇 Additional comments (10)
src/utils/validation.ts (1)
241-241: Fix the text consolidation logic.The current implementation joins an empty string instead of joining the
textPartsarray, which will result in no text content being returned.- const consolidatedText = textParts.join(''); + const consolidatedText = textParts.join('');Wait, let me re-examine this. The
textParts.push('\n---\n')andtextParts.push(item.text)are adding elements to the array, and thentextParts.join('')should concatenate all elements. This is actually correct - the separators are already in the array.Actually, looking more carefully at the logic:
- We iterate through content items
- For text items, we conditionally add separator to textParts array
- Then we add the text content to textParts array
- Finally we join all parts with empty string
This logic is correct. The separators are already added to the array during iteration.
Likely an incorrect or invalid review comment.
CLAUDE.md (1)
55-59: Excellent documentation of the workaround.The documentation clearly explains the purpose, behavior, and rationale for the Claude Code compatibility workaround. The description accurately reflects the implementation and provides users with the necessary context to understand when and why to use this feature.
src/utils/build-utils.ts (4)
24-24: LGTM: Import statement correctly updated.The import statement properly adds the new function to the existing import from the validation module.
276-276: LGTM: Proper consolidation of error response.The error response consolidation ensures that all build failure information, including warnings and error messages, will be visible to Claude Code users in a single content block.
350-350: LGTM: Proper consolidation of success response.The success response consolidation ensures that build messages, success confirmation, and next steps guidance are all visible to Claude Code users in a single consolidated view.
354-359: LGTM: Consistent consolidation in error handling.The catch block error response is consistently wrapped with the consolidation function, maintaining uniform behavior across all return paths. Even though this creates a single content block, the consolidation function handles this case appropriately.
src/utils/test-common.ts (4)
23-23: LGTM: Import statement correctly updated.The import statement properly adds the consolidation function to the existing import from the validation module.
229-229: LGTM: Essential consolidation for test results.This consolidation directly addresses the issue described in the PR objectives where test results with stderr warnings were not fully visible in Claude Code. Combining test output and summary ensures comprehensive test information is available.
241-241: LGTM: Consistent consolidation in fallback scenario.Even when xcresult parsing fails, the consolidation ensures that the original test results remain accessible to Claude Code users. This maintains the workaround's effectiveness across different execution paths.
246-248: LGTM: Consistent consolidation in error handling.The error response is consistently wrapped with the consolidation function, ensuring uniform behavior across all return paths from
handleTestLogic. This maintains consistency even for single-content-block responses.
When original response contains only non-text content (e.g., images), return the original response unchanged instead of creating an empty text block that overwrites the content. Co-authored-by: Cameron Cooke <cameroncooke@users.noreply.github.com>
…coverage - Add detailed command structure and usage examples for both CLI and proxy modes - Include comprehensive troubleshooting sections for both operational modes - Document advanced configuration options and environment variables - Improve workflow explanations with step-by-step development processes - Add MCP inspection server mode documentation - Enhance formatting with clear mode distinctions and emojis for better navigation
- Extract environment detection logic from validation.ts into dedicated environment.ts - Create EnvironmentDetector interface with ProductionEnvironmentDetector implementation - Add automatic test environment override to disable Claude Code detection during tests - Update validation.ts to use environment abstraction - Add createMockEnvironmentDetector utility for testing - Resolves all 44 test failures caused by Claude Code consolidation in test runs - Maintains production Claude Code detection functionality
|
Claude finished @cameroncooke's task —— View job PR Review Complete ✅Reviewing this PR for Claude Code compatibility workaround implementation. Review Checklist:
Review SummaryThis PR implements a well-designed workaround for Claude Code's MCP specification violation. The implementation is clean, well-documented, and follows the project's patterns appropriately. Code Quality & Best Practices ✅Strengths:
Minor suggestions:
Potential Bugs & Issues ✅Implementation is solid:
No significant issues found. Performance Considerations ✅Efficient implementation:
Security Concerns ✅No security issues identified:
Test Coverage
|
|
@claude please add the recommended tests for the consolidation behaviour |
|
Claude finished @cameroncooke's task —— View job I'll analyze this and get back to you. |
|
cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request introduces several enhancements to the MCP protocol tooling and addresses compatibility issues with Claude Code. Key changes include the addition of a new development tool (
Reloaderoo), implementation of a workaround for Claude Code compatibility, and updates to the codebase to consolidate content blocks for improved response handling.New tooling and documentation:
CLAUDE.md: Added documentation forReloaderoo, a CLI-based tool for testing and hot-reloading MCP servers without requiring MCP client configuration. It supports multiple commands for server inspection, tool management, resource access, and debugging.Claude Code compatibility improvements:
CLAUDE.md: Added a workaround for Claude Code's MCP specification violation. The workaround consolidates multiple content blocks into a single response with---dividers to ensure all information is visible to users.src/utils/validation.ts: Added theconsolidateContentForClaudeCodefunction to automatically detect Claude Code environments and consolidate content blocks into a single text response.src/utils/environment.ts: Implemented anEnvironmentDetectorabstraction for detecting Claude Code environments, with a production-ready implementation that checks environment variables and parent process names.Codebase updates for response handling:
src/utils/build-utils.ts: Updated response handling inexecuteXcodeBuildCommandand other methods to useconsolidateContentForClaudeCodefor compatibility with Claude Code. [1] [2]src/utils/test-common.ts: AppliedconsolidateContentForClaudeCodeto test logic responses, ensuring compatibility with Claude Code. [1] [2]Testing enhancements:
src/utils/command.ts: AddedcreateMockEnvironmentDetectorfor testing environment detection functionality.src/utils/index.ts: Exported the newenvironment.jsutilities for broader use.