Contributions are welcome! Here's how you can help improve XcodeBuildMCP.
- Local development setup
- Architecture and Code Standards
- Making changes
- Plugin Development
- Testing
- Submitting
- Code of Conduct
In addition to the prerequisites mentioned in the Getting started section of the README, you will also need:
- Node.js (v18 or later)
- npm
When running locally, you'll need to install AXe for UI automation:
# Install axe (required for UI automation)
brew tap cameroncooke/axe
brew install axenpm run bundle:axe defaults to downloading pinned AXe release artifacts from GitHub.
To bundle from a local AXe source checkout instead:
AXE_USE_LOCAL=1 AXE_LOCAL_DIR=/absolute/path/to/AXe npm run bundle:axeRules:
- Local mode is enabled only when
AXE_USE_LOCAL=1. AXE_LOCAL_DIRmust point to a valid AXe repository (must containPackage.swift).- If
AXE_USE_LOCAL=1andAXE_LOCAL_DIRis missing/invalid, bundling fails fast. AXE_FORCE_REMOTE=1overrides local mode and forces remote artifact download.
- Clone the repository
- Install dependencies:
npm install - Install repository-managed git hooks:
This configures
npm run hooks:installcore.hooksPathto.githooksso the shared pre-commit hook runs for this repository. - Build the project:
npm run build - Start the server:
node build/cli.js mcp
Most MCP clients (Cursor, VS Code, Windsurf, Claude Desktop etc) have standardised on the following JSON configuration format, just add the the following to your client's JSON configuration's mcpServers object:
{
"mcpServers": {
"XcodeBuildMCP": {
"command": "node",
"args": [
"/path_to/XcodeBuildMCP/build/cli.js",
"mcp"
]
}
}
}VS Code is especially good for developing XcodeBuildMCP as it has a built-in way to view MCP client/server logs as well as the ability to configure MCP servers at a project level. It probably has the most comprehensive support for MCP development.
To make your development workflow in VS Code more efficient:
- Start the MCP Server: Open the
.vscode/mcp.jsonfile. You can start thexcodebuildmcp-devserver either by clicking theStartCodeLens that appears above the server definition, or by opening the Command Palette (Cmd+Shift+PorCtrl+Shift+P), runningMcp: List Servers, selectingxcodebuildmcp-dev, and starting the server. - Launch the Debugger: Press
F5to attach the Node.js debugger.
Once these steps are completed, you can utilize the tools from the MCP server you are developing within this repository in agent mode. For more details on how to work with MCP servers in VS Code see: https://code.visualstudio.com/docs/copilot/chat/mcp-servers
You can use MCP Inspector for basic debugging via:
npm run inspector if you prefer the explicit command:
npx @modelcontextprotocol/inspector node build/cli.js mcpFor development and debugging, we strongly recommend using Reloaderoo, which provides hot-reloading capabilities and advanced debugging features for MCP servers.
Reloaderoo operates in two modes:
Provides transparent hot-reloading without disconnecting your MCP client:
# Install reloaderoo globally
npm install -g reloaderoo
# Start XcodeBuildMCP through reloaderoo proxy
reloaderoo -- node build/cli.js mcpBenefits:
- 🔄 Hot-reload server without restarting client
- 🛠️ Automatic
restart_servertool added to toolset - 🌊 Transparent MCP protocol forwarding
- 📡 Full protocol support (tools, resources, prompts)
MCP Client Configuration for Proxy Mode:
"XcodeBuildMCP": {
"command": "reloaderoo",
"args": ["--", "node", "/path/to/XcodeBuildMCP/build/cli.js", "mcp"],
"env": {
"XCODEBUILDMCP_DEBUG": "true"
}
}Exposes debug tools for making raw MCP protocol calls and inspecting server responses:
# Start reloaderoo in inspection mode
reloaderoo inspect mcp -- node build/cli.js mcpAvailable Debug Tools:
list_tools- List all server toolscall_tool- Execute any server tool with parameterslist_resources- List all server resourcesread_resource- Read any server resourcelist_prompts- List all server promptsget_prompt- Get any server promptget_server_info- Get comprehensive server informationping- Test server connectivity
MCP Client Configuration for Inspection Mode:
"XcodeBuildMCP": {
"command": "node",
"args": [
"/path/to/reloaderoo/dist/bin/reloaderoo.js",
"inspect", "mcp",
"--working-dir", "/path/to/XcodeBuildMCP",
"--",
"node", "/path/to/XcodeBuildMCP/build/cli.js", "mcp"
],
"env": {
"XCODEBUILDMCP_DEBUG": "true"
}
}Test full vs. selective workflow registration during development:
# Test full tool registration (default)
reloaderoo inspect mcp -- node build/cli.js mcp
# Test selective workflow registration
XCODEBUILDMCP_ENABLED_WORKFLOWS=simulator,device reloaderoo inspect mcp -- node build/cli.js mcpKey Differences to Test:
- Full Registration: All tools are available immediately via
list_tools - Selective Registration: Only tools from the selected workflows (plus
session-management) are available
Running the XcodeBuildMCP server with the environmental variable XCODEBUILDMCP_DEBUG=true will expose a new doctor MCP tool called doctor which your agent can call to get information about the server's environment, available tools, and configuration status.
Note
You can also call the doctor tool directly using the following command but be advised that the output may vary from that of the MCP tool call due to environmental differences:
npm run doctor-
Start Development Session:
# Terminal 1: Start in hot-reload mode reloaderoo -- node build/cli.js mcp # Terminal 2: Start build watcher npm run build:watch
-
Make Changes: Edit source code in
src/ -
Test Changes: Ask your AI client to restart the server:
"Please restart the MCP server to load my changes"The AI will automatically call the
restart_servertool provided by reloaderoo. -
Verify Changes: New functionality immediately available without reconnecting client
Before making changes, please familiarize yourself with:
- ARCHITECTURE.md - Comprehensive architectural overview
- CLAUDE.md - AI assistant guidelines and testing principles
- TOOLS.md - Complete tool documentation
- CONFIGURATION.md - Tool configuration options
- Follow existing code patterns and structure
- Use TypeScript strictly - no
anytypes, proper typing throughout - Add proper error handling and logging - all failures must set
isError: true - Update documentation for new features
- Test with example projects before submitting
All contributions must adhere to the testing standards outlined in the XcodeBuildMCP Plugin Testing Guidelines (TESTING.md). This is the canonical source of truth for all testing practices.
Key Principles (Summary):
- Dependency Injection for External Boundaries: All external dependencies (command execution, file system access) must be injected into tool logic functions using the
CommandExecutorandFileSystemExecutorpatterns. - Internal Mocking Is Allowed: Vitest mocking (
vi.mock,vi.fn,vi.spyOn, etc.) is acceptable for internal modules/collaborators. - Test Production Code: Tests must import and execute the actual tool logic, not mock implementations.
- Comprehensive Coverage: Tests must cover input validation, command generation, and output processing.
Please read TESTING.md in its entirety before writing tests.
MANDATORY: Run these commands before any commit and ensure they all pass:
# 1. Run linting (must pass with 0 errors)
npm run lint:fix
# 2. Run typechecker (must pass with 0 errors)
npm run typecheck
# 3. Run formatting (must format all files)
npm run format
# 4. Run build (must compile successfully)
npm run build
# 5. Validate docs CLI command references (requires built CLI artifact)
npm run docs:check
# 6. Run tests (all tests must pass)
npm testNO EXCEPTIONS: Code that fails any of these commands cannot be committed.
The shared pre-commit hook installed via npm run hooks:install runs:
npm run format:checknpm run lintnpm run buildnpm run docs:check
- Fork the repository and create a new branch
- Follow the TypeScript best practices and existing code style
- Add proper parameter validation and error handling
For comprehensive instructions on creating new tools and workflow groups, see our dedicated Plugin Development Guide.
The plugin development guide covers:
- Auto-discovery system architecture
- Tool creation with dependency injection patterns
- Workflow group organization
- Testing guidelines and patterns
- Workflow registration and selection
- Choose appropriate workflow directory in
src/mcp/tools/ - Follow naming conventions:
{action}_{target}_{specifier}_{projectType} - Use dependency injection pattern with separate logic functions
- Create comprehensive tests using
createMockExecutor() - Add workflow metadata if creating new workflow group
See PLUGIN_DEVELOPMENT.md for complete details.
XcodeBuildMCP uses external template repositories for the iOS and macOS project scaffolding features. These templates are maintained separately to allow independent versioning and updates.
- iOS Template: XcodeBuildMCP-iOS-Template
- macOS Template: XcodeBuildMCP-macOS-Template
When developing or testing changes to the templates:
-
Clone the template repository you want to work on:
git clone https://github.com/getsentry/XcodeBuildMCP-iOS-Template.git git clone https://github.com/getsentry/XcodeBuildMCP-macOS-Template.git
-
Set the appropriate environment variable to use your local template:
# For iOS template development export XCODEBUILDMCP_IOS_TEMPLATE_PATH=/path/to/XcodeBuildMCP-iOS-Template # For macOS template development export XCODEBUILDMCP_MACOS_TEMPLATE_PATH=/path/to/XcodeBuildMCP-macOS-Template
-
When using MCP clients, add these environment variables to your MCP configuration:
"XcodeBuildMCP": {
"command": "node",
"args": ["/path_to/XcodeBuildMCP/build/cli.js", "mcp"],
"env": {
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "/path/to/XcodeBuildMCP-iOS-Template",
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "/path/to/XcodeBuildMCP-macOS-Template"
}
}- The scaffold tools will use your local templates instead of downloading from GitHub releases.
- Templates are versioned independently from XcodeBuildMCP
- The default template version is specified in
package.jsonundertemplateVersion - You can override the template version with
XCODEBUILD_MCP_TEMPLATE_VERSIONenvironment variable - To update the default template version:
- Update
templateVersioninpackage.json - Run
npm run buildto regenerate version.ts - Create a new XcodeBuildMCP release
- Update
- Make changes to your local template
- Test scaffolding with your changes using the local override
- Verify the scaffolded project builds and runs correctly
- Once satisfied, create a PR in the template repository
- After merging, create a new release in the template repository using the release script
- Build the project with
npm run build - Test your changes with MCP Inspector
- Verify tools work correctly with different MCP clients
- Run
npm run lintto check for linting issues (usenpm run lint:fixto auto-fix) - Run
npm run format:checkto verify formatting (usenpm run formatto fix) - Update documentation if you've added or modified features
- Add your changes to the CHANGELOG.md file
- Push your changes and create a pull request with a clear description
- Link any related issues
For major changes or new features, please open an issue first to discuss your proposed changes.
Please follow our Code of Conduct and community guidelines.