Skip to content

Commit 2f50bae

Browse files
committed
Add support selective tool support
1 parent 38fb45c commit 2f50bae

12 files changed

Lines changed: 865 additions & 174 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,7 @@ xcuserdata/
8787

8888
# Sentry Config File
8989
.sentryclirc
90+
91+
# Claude Config File
92+
**/.claude/settings.local.json
93+
CLAUDE.md

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## [v1.3.6] - 2025-05-07
4+
- Added support for enabling/disabling tools via environment variables
5+
36
## [v1.3.5] - 2025-05-05
47
- Fixed the text input UI automation tool
58
- Improve the UI automation tool hints to reduce agent tool call errors

README.md

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ A Model Context Protocol (MCP) server that provides Xcode-related tools for inte
1010
- [Overview](#overview)
1111
- [Why?](#why)
1212
- [Features](#features)
13-
* [Xcode project management](#xcode-project-management)
14-
* [Simulator management](#simulator-management)
15-
* [App utilities](#app-utilities)
13+
- [Xcode project management](#xcode-project-management)
14+
- [Simulator management](#simulator-management)
15+
- [App utilities](#app-utilities)
1616
- [Getting started](#getting-started)
17-
* [Prerequisites](#prerequisites)
18-
* [One-line setup with mise](#one-line-setup-with-mise)
19-
* [Configure MCP clients](#configure-mcp-clients)
20-
* [Enabling UI Automation (beta)](#enabling-ui-automation-beta)
21-
- [Incremental build support](#incremental-build-support)
17+
- [Prerequisites](#prerequisites)
18+
- [One-line setup with mise](#one-line-setup-with-mise)
19+
- [Configure MCP clients](#configure-mcp-clients)
20+
- [Enabling UI Automation (beta)](#enabling-ui-automation-beta)
21+
- [Incremental build support](#incremental-build-support)
2222
- [Troubleshooting](#troubleshooting)
23-
* [Diagnostic Tool](#diagnostic-tool)
24-
+ [Using with mise](#using-with-mise)
25-
+ [Using with npx](#using-with-npx)
23+
- [Diagnostic Tool](#diagnostic-tool)
24+
- [Using with mise](#using-with-mise)
25+
- [Using with npx](#using-with-npx)
2626
- [Privacy](#privacy)
27-
* [What is sent to Sentry?](#what-is-sent-to-sentry)
28-
* [Opting Out of Sentry](#opting-out-of-sentry)
27+
- [What is sent to Sentry?](#what-is-sent-to-sentry)
28+
- [Opting Out of Sentry](#opting-out-of-sentry)
29+
- [Selective tool registration](#selective-tool-registration)
2930
- [Demos](#demos)
30-
* [Autonomously fixing build errors in Cursor](#autonomously-fixing-build-errors-in-cursor)
31-
* [Utilising the new UI automation and screen capture features](#utilising-the-new-ui-automation-and-screen-capture-features)
32-
* [Building and running iOS app in Claude Desktop](#building-and-running-ios-app-in-claude-desktop)
31+
- [Autonomously fixing build errors in Cursor](#autonomously-fixing-build-errors-in-cursor)
32+
- [Utilising the new UI automation and screen capture features](#utilising-the-new-ui-automation-and-screen-capture-features)
33+
- [Building and running iOS app in Claude Desktop](#building-and-running-ios-app-in-claude-desktop)
3334
- [Contributing](#contributing)
3435
- [Licence](#licence)
3536

@@ -92,7 +93,7 @@ For more information about mise, visit the [official documentation](https://mise
9293

9394
### Configure MCP clients
9495

95-
Configure your MCP client (Windsurf, Cursor, Claude Desktop, etc.) to use the XcodeBuildMCP server by adding the following configuration, changing the version number to match the version you wish to use:
96+
Configure your MCP client (Windsurf, Cursor, Claude Desktop, etc.) to use the XcodeBuildMCP server by ammending your client application's MCP configuration, changing the version number to match the version you wish to use:
9697

9798
```json
9899
{
@@ -205,6 +206,33 @@ Example MCP client configuration:
205206
}
206207
```
207208

209+
## Selective tool registration
210+
211+
By default all tools are enabled but for some clients it may be useful to only enable specific tools to reduce the amount of context that is sent to the client. This can be achieved by setting specific environment variables in your clients MCP configuration.
212+
213+
Once you have enabled one or more tools or groups of tools all other tools will be disabled. For example, to enable only the simulator related tools, you can set the environment variable to `XCODEBUILDMCP_GROUP_IOS_SIMULATOR_WORKFLOW=true` this will only expose tools for building, running and debugging on simulators
214+
215+
```bash
216+
{
217+
"mcpServers": {
218+
"XcodeBuildMCP": {
219+
"command": "mise",
220+
"args": [
221+
"x",
222+
"npm:xcodebuildmcp@1.3.5",
223+
"--",
224+
"xcodebuildmcp"
225+
],
226+
"env": {
227+
"XCODEBUILDMCP_GROUP_IOS_SIMULATOR_WORKFLOW": "true"
228+
}
229+
}
230+
}
231+
}
232+
```
233+
234+
You can find a list of available tools and detailed instructions on how to enable them in the [TOOL_OPTIONS.md](TOOL_OPTIONS.md) file.
235+
208236
## Demos
209237

210238
### Autonomously fixing build errors in Cursor

TOOL_OPTIONS.md

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# XcodeBuildMCP Tool Options
2+
3+
This document explains how to configure tool registration in XcodeBuildMCP to optimise for different workflows and reduce the number of tools presented to LLM clients.
4+
5+
## Overview
6+
7+
XcodeBuildMCP supports selective tool registration based on environment variables. This allows you to:
8+
9+
1. **Opt-in to individual tools** - Enable only specific tools you need
10+
2. **Enable tool groups** - Enable logical groups of tools for specific workflows
11+
3. **Default "all tools enabled"** - Without any configuration, all tools are enabled (default behaviour)
12+
13+
## Why Use Selective Tool Registration?
14+
15+
- **Reduced context window usage for LLMs** - Only register tools needed for a specific workflow
16+
- **Optimised for different use cases** - Configure for iOS development, macOS development, UI testing, etc.
17+
18+
## Available Tool Groups and Environment Variables
19+
20+
XcodeBuildMCP provides workflow-based tool groups that organise tools logically based on common developer workflows.
21+
22+
### Workflow-based Groups
23+
24+
These groups organise tools based on common developer workflows, making it easier to enable just the tools needed for specific tasks:
25+
26+
- **XCODEBUILDMCP_GROUP_PROJECT_DISCOVERY=true** - Project/target discovery and analysis tools
27+
- _e.g., Discover projects, list schemes, show build settings._
28+
- **XCODEBUILDMCP_GROUP_IOS_SIMULATOR_WORKFLOW=true** - Complete iOS simulator development workflow tools
29+
- _e.g., Building, running, debugging on simulators._
30+
- **XCODEBUILDMCP_GROUP_IOS_DEVICE_WORKFLOW=true** - iOS physical device development workflow tools
31+
- _e.g., Building and deploying to physical iOS devices._
32+
- **XCODEBUILDMCP_GROUP_MACOS_WORKFLOW=true** - macOS application development workflow tools
33+
- _e.g., Building, running, debugging macOS applications._
34+
- **XCODEBUILDMCP_GROUP_SIMULATOR_MANAGEMENT=true** - Simulator device management tools
35+
- _e.g., Managing simulator lifecycle (boot, open, set appearance)._
36+
- **XCODEBUILDMCP_GROUP_APP_DEPLOYMENT=true** - Application deployment tools
37+
- _e.g., Installing and launching apps across platforms._
38+
- **XCODEBUILDMCP_GROUP_DIAGNOSTICS=true** - Logging and diagnostics tools
39+
- _e.g., Log capture, debugging information._
40+
- **XCODEBUILDMCP_GROUP_UI_TESTING=true** - UI testing and automation tools
41+
- _e.g., Tools for interacting with UI elements, typically via IDB._
42+
43+
## Enabling Individual Tools
44+
45+
To enable specific tools rather than entire groups, use the following environment variables. Each tool is enabled by setting its corresponding variable to `true`.
46+
47+
### Project Discovery & Information
48+
- **XCODEBUILDMCP_TOOL_DISCOVER_PROJECTS=true** - Discover Xcode projects and workspaces.
49+
- **XCODEBUILDMCP_TOOL_LIST_SCHEMES_WORKSPACE=true** - List schemes in an Xcode workspace.
50+
- **XCODEBUILDMCP_TOOL_LIST_SCHEMES_PROJECT=true** - List schemes in an Xcode project.
51+
- **XCODEBUILDMCP_TOOL_LIST_SIMULATORS=true** - List available iOS/tvOS/watchOS simulators.
52+
- **XCODEBUILDMCP_TOOL_SHOW_BUILD_SETTINGS_WORKSPACE=true** - Show build settings for an Xcode workspace.
53+
- **XCODEBUILDMCP_TOOL_SHOW_BUILD_SETTINGS_PROJECT=true** - Show build settings for an Xcode project.
54+
55+
### Build, Clean & Run Tools
56+
57+
#### Clean
58+
- **XCODEBUILDMCP_TOOL_CLEAN_WORKSPACE=true** - Clean build products for an Xcode workspace.
59+
- **XCODEBUILDMCP_TOOL_CLEAN_PROJECT=true** - Clean build products for an Xcode project.
60+
61+
#### macOS Build & Run
62+
- **XCODEBUILDMCP_TOOL_MACOS_BUILD_WORKSPACE=true** - Build a macOS application from a workspace.
63+
- **XCODEBUILDMCP_TOOL_MACOS_BUILD_PROJECT=true** - Build a macOS application from a project.
64+
- **XCODEBUILDMCP_TOOL_MACOS_BUILD_AND_RUN_WORKSPACE=true** - Build and run a macOS application from a workspace.
65+
- **XCODEBUILDMCP_TOOL_MACOS_BUILD_AND_RUN_PROJECT=true** - Build and run a macOS application from a project.
66+
67+
#### iOS Simulator Build & Run
68+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_BY_NAME_WORKSPACE=true** - Build for iOS Simulator by name from a workspace.
69+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_BY_NAME_PROJECT=true** - Build for iOS Simulator by name from a project.
70+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_BY_ID_WORKSPACE=true** - Build for iOS Simulator by UDID from a workspace.
71+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_BY_ID_PROJECT=true** - Build for iOS Simulator by UDID from a project.
72+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_AND_RUN_BY_NAME_WORKSPACE=true** - Build and run on iOS Simulator by name (workspace).
73+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_AND_RUN_BY_NAME_PROJECT=true** - Build and run on iOS Simulator by name (project).
74+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_AND_RUN_BY_ID_WORKSPACE=true** - Build and run on iOS Simulator by UDID (workspace).
75+
- **XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_AND_RUN_BY_ID_PROJECT=true** - Build and run on iOS Simulator by UDID (project).
76+
77+
#### iOS Device Build
78+
- **XCODEBUILDMCP_TOOL_IOS_DEVICE_BUILD_TOOLS=true** - Build iOS apps for physical devices (collection of tools).
79+
80+
### App Path & Bundle ID Retrieval
81+
82+
#### App Path
83+
- **XCODEBUILDMCP_TOOL_GET_MACOS_APP_PATH_WORKSPACE=true** - Get path to a built macOS app (workspace).
84+
- **XCODEBUILDMCP_TOOL_GET_MACOS_APP_PATH_PROJECT=true** - Get path to a built macOS app (project).
85+
- **XCODEBUILDMCP_TOOL_GET_IOS_DEVICE_APP_PATH_WORKSPACE=true** - Get path to a built iOS device app (workspace).
86+
- **XCODEBUILDMCP_TOOL_GET_IOS_DEVICE_APP_PATH_PROJECT=true** - Get path to a built iOS device app (project).
87+
- **XCODEBUILDMCP_TOOL_GET_SIMULATOR_APP_PATH_BY_NAME_WORKSPACE=true** - Get path to a built simulator app by name (workspace).
88+
- **XCODEBUILDMCP_TOOL_GET_SIMULATOR_APP_PATH_BY_NAME_PROJECT=true** - Get path to a built simulator app by name (project).
89+
- **XCODEBUILDMCP_TOOL_GET_SIMULATOR_APP_PATH_BY_ID_WORKSPACE=true** - Get path to a built simulator app by UDID (workspace).
90+
- **XCODEBUILDMCP_TOOL_GET_SIMULATOR_APP_PATH_BY_ID_PROJECT=true** - Get path to a built simulator app by UDID (project).
91+
92+
#### Bundle ID
93+
- **XCODEBUILDMCP_TOOL_GET_MACOS_BUNDLE_ID=true** - Get the bundle ID of a macOS app.
94+
- **XCODEBUILDMCP_TOOL_GET_IOS_BUNDLE_ID=true** - Get the bundle ID of an iOS app.
95+
96+
### Simulator Management & App Lifecycle
97+
98+
#### Management
99+
- **XCODEBUILDMCP_TOOL_BOOT_SIMULATOR=true** - Boot an iOS/tvOS/watchOS simulator.
100+
- **XCODEBUILDMCP_TOOL_OPEN_SIMULATOR=true** - Open the Simulator application.
101+
- **XCODEBUILDMCP_TOOL_SET_SIMULATOR_APPEARANCE=true** - Set simulator appearance (dark/light mode).
102+
103+
#### App Installation & Launch
104+
- **XCODEBUILDMCP_TOOL_INSTALL_APP_IN_SIMULATOR=true** - Install an app in a simulator.
105+
- **XCODEBUILDMCP_TOOL_LAUNCH_APP_IN_SIMULATOR=true** - Launch an app in a simulator.
106+
- **XCODEBUILDMCP_TOOL_LAUNCH_APP_WITH_LOGS_IN_SIMULATOR=true** - Launch an app in simulator and capture logs.
107+
- **XCODEBUILDMCP_TOOL_LAUNCH_MACOS_APP=true** - Launch a macOS application.
108+
109+
### Logging & Diagnostics
110+
111+
#### Log Capture
112+
- **XCODEBUILDMCP_TOOL_START_SIMULATOR_LOG_CAPTURE=true** - Start capturing logs from a simulator.
113+
- **XCODEBUILDMCP_TOOL_STOP_AND_GET_SIMULATOR_LOG=true** - Stop capturing logs and retrieve them.
114+
115+
#### UI Automation (IDB)
116+
- **XCODEBUILDMCP_TOOL_UI_AUTOMATION_TOOLS=true** - Enable UI automation tools (e.g., tap, swipe - requires IDB).
117+
118+
#### Diagnostics
119+
- **XCODEBUILDMCP_DEBUG=true** - Enable diagnostic tool for XcodeBuildMCP server.
120+
121+
## Recommended Tool Combinations for Common Use Cases
122+
123+
Workflow-based groups make it easier to enable just the right tools for specific development tasks. Here are some recommended combinations:
124+
125+
### iOS Simulator Developer
126+
127+
For developers focussed on iOS simulator development:
128+
129+
```json
130+
{
131+
// Rest of your MCP configuration
132+
"env": {
133+
"XCODEBUILDMCP_GROUP_PROJECT_DISCOVERY": "true",
134+
"XCODEBUILDMCP_GROUP_IOS_SIMULATOR_WORKFLOW": "true"
135+
}
136+
// Rest of your MCP configuration
137+
}
138+
```
139+
140+
This provides all tools needed to:
141+
1. Discover and analyse projects
142+
2. Build for iOS simulators
143+
3. Install and launch on simulators
144+
4. Capture logs
145+
146+
### macOS Application Developer
147+
148+
For developers focussed on macOS application development:
149+
150+
```json
151+
{
152+
// Rest of your MCP configuration
153+
"env": {
154+
"XCODEBUILDMCP_GROUP_PROJECT_DISCOVERY": "true",
155+
"XCODEBUILDMCP_GROUP_MACOS_WORKFLOW": "true"
156+
}
157+
// Rest of your MCP configuration
158+
}
159+
```
160+
161+
This provides all tools needed to:
162+
1. Discover and analyse projects
163+
2. Build for macOS
164+
3. Launch macOS applications
165+
166+
### UI Automation Testing
167+
168+
For developers focussed on UI automation testing:
169+
170+
```json
171+
{
172+
// Rest of your MCP configuration
173+
"env": {
174+
"XCODEBUILDMCP_GROUP_UI_TESTING": "true",
175+
"XCODEBUILDMCP_GROUP_SIMULATOR_MANAGEMENT": "true",
176+
"XCODEBUILDMCP_GROUP_APP_DEPLOYMENT": "true"
177+
}
178+
// Rest of your MCP configuration
179+
}
180+
```
181+
182+
This provides tools for:
183+
1. Managing simulators
184+
2. Installing and launching apps
185+
3. Running UI automation tests
186+
187+
## Example Cursor/Windsurf Configuration
188+
189+
Here is a fully worked example of how to configure Cursor/Windsurf to use specific tool groups:
190+
191+
```json
192+
{
193+
"mcpServers": {
194+
"XcodeBuildMCP": {
195+
"command": "mise",
196+
"args": [
197+
"x",
198+
"npm:xcodebuildmcp@1.3.5",
199+
"--",
200+
"xcodebuildmcp"
201+
],
202+
"env": {
203+
"XCODEBUILDMCP_GROUP_PROJECT_DISCOVERY": "true",
204+
"XCODEBUILDMCP_GROUP_IOS_SIMULATOR_WORKFLOW": "true"
205+
}
206+
}
207+
}
208+
}
209+
```
210+
211+
This example configures the MCP client to only enable tools related to iOS simulator development.

release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ npm version "$VERSION" --no-git-tag-version
1414

1515
echo "📝 Updating version in README.md..."
1616
sed -i '' "s/@[0-9]*\.[0-9]*\.[0-9]*/@$VERSION/g" README.md
17+
echo ""
18+
echo "📝 Updating version in TOOL_OPTIONS.md..."
19+
sed -i '' "s/@[0-9]*\.[0-9]*\.[0-9]*/@$VERSION/g" TOOL_OPTIONS.md
1720

1821
echo "🛠 Running build..."
1922
npm run build
@@ -26,6 +29,9 @@ git tag "v$VERSION"
2629
echo "🚀 Pushing to origin..."
2730
git push origin main --tags
2831

32+
echo "📦 Creating GitHub release..."
33+
gh release create "v$VERSION" --generate-notes -t "Release v$VERSION"
34+
2935
echo "📤 Publishing to npm..."
3036
npm publish
3137

src/diagnostic-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function runDiagnostic(): Promise<void> {
2121
const { runDiagnosticTool } = await import('./tools/diagnostic.js');
2222

2323
// Run the diagnostic tool
24-
const result = await runDiagnosticTool({});
24+
const result = await runDiagnosticTool();
2525

2626
// Output the diagnostic information
2727
if (result.content && result.content.length > 0) {

0 commit comments

Comments
 (0)