Skip to content

Commit c502e79

Browse files
authored
feat: fix tool loading bugs
Fixes: * When `XCODEBUILDMCP_DEBUG` was true the `doctor` workflow doesn't load * Doctor tool doesn't reflect run-time tool loading state * Session-defaults tools not loaded implicitly when selective workflows are configured
1 parent 472c8c6 commit c502e79

65 files changed

Lines changed: 628 additions & 2694 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.axe-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.0
1+
1.2.1

.vscode/launch.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@
3434
],
3535
"env": {
3636
"XCODEBUILDMCP_DEBUG": "true",
37-
"XCODEBUILDMCP_DYNAMIC_TOOLS": "true",
3837
"INCREMENTAL_BUILDS_ENABLED": "false",
39-
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "/Volumes/Developer/XcodeBuildMCP-iOS-Template",
40-
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "/Volumes/Developer/XcodeBuildMCP-macOS-Template"
38+
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "${workspaceFolder}/../XcodeBuildMCP-iOS-Template",
39+
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "${workspaceFolder}/../XcodeBuildMCP-macOS-Template"
4140
},
4241
"sourceMaps": true,
4342
"outFiles": [
@@ -51,4 +50,4 @@
5150
}
5251
}
5352
]
54-
}
53+
}

.vscode/mcp.json

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
{
2-
"servers": {
3-
"XcodeBuildMCP": {
4-
"type": "stdio",
5-
"command": "npx",
6-
"args": [
7-
"-y",
8-
"xcodebuildmcp@latest"
9-
],
10-
"env": {
11-
"XCODEBUILDMCP_DEBUG": "true",
12-
"XCODEBUILDMCP_DYNAMIC_TOOLS": "true",
13-
"INCREMENTAL_BUILDS_ENABLED": "false",
14-
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "/Volumes/Developer/XcodeBuildMCP-iOS-Template",
15-
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "/Volumes/Developer/XcodeBuildMCP-macOS-Template"
16-
}
17-
},
18-
"XcodeBuildMCP-Dev": {
19-
"type": "stdio",
20-
"command": "node",
21-
"args": [
22-
"--inspect-brk=9999",
23-
"--trace-warnings",
24-
"/Users/cameroncooke/Developer/XcodeBuildMCP/build/index.js"
25-
],
26-
"env": {
27-
"XCODEBUILDMCP_DEBUG": "true",
28-
"XCODEBUILDMCP_DYNAMIC_TOOLS": "true",
29-
"INCREMENTAL_BUILDS_ENABLED": "false",
30-
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "/Volumes/Developer/XcodeBuildMCP-iOS-Template",
31-
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "/Volumes/Developer/XcodeBuildMCP-macOS-Template"
32-
}
33-
},
2+
"servers": {
3+
"XcodeBuildMCP": {
4+
"type": "stdio",
5+
"command": "npx",
6+
"args": [
7+
"-y",
8+
"xcodebuildmcp@latest"
9+
],
10+
"env": {
11+
"XCODEBUILDMCP_DEBUG": "true",
12+
"INCREMENTAL_BUILDS_ENABLED": "false",
13+
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "${workspaceFolder}/../XcodeBuildMCP-iOS-Template",
14+
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "${workspaceFolder}/../XcodeBuildMCP-macOS-Template"
15+
}
16+
},
17+
"XcodeBuildMCP-Dev": {
18+
"type": "stdio",
19+
"command": "node",
20+
"args": [
21+
"--inspect=9999",
22+
"--trace-warnings",
23+
"${workspaceFolder}/build/index.js"
24+
],
25+
"env": {
26+
"XCODEBUILDMCP_DEBUG": "true",
27+
"INCREMENTAL_BUILDS_ENABLED": "false",
28+
"XCODEBUILDMCP_IOS_TEMPLATE_PATH": "${workspaceFolder}/../XcodeBuildMCP-iOS-Template",
29+
"XCODEBUILDMCP_MACOS_TEMPLATE_PATH": "${workspaceFolder}/../XcodeBuildMCP-macOS-Template"
30+
}
3431
}
32+
}
3533
}

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
},
3939
"chat.mcp.serverSampling": {
4040
"XcodeBuildMCP/.vscode/mcp.json: XcodeBuildMCP-Dev": {
41-
"allowedDuringChat": true
41+
"allowedDuringChat": true,
42+
"allowedModels": [
43+
"copilot/gpt-5.2"
44+
]
4245
}
4346
},
4447
}

AGENTS.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ npx reloaderoo proxy --log-level debug -- node build/index.js
9797

9898
#### Key Benefits
9999

100-
-**No MCP Client Setup**: Direct CLI access to all 84+ tools
100+
-**No MCP Client Setup**: Direct CLI access to all tools
101101
-**Raw JSON Output**: Perfect for AI agents and programmatic use
102102
-**Hot-Reload Support**: `restart_server` tool for MCP client development
103103
-**Claude Code Compatible**: Automatic content block consolidation
@@ -124,17 +124,9 @@ Resources are the secondary way to interact with the server. They are used to pr
124124

125125
For more information see @docs/PLUGIN_DEVELOPMENT.md
126126

127-
### Operating Modes
127+
### Tool Registration
128128

129-
XcodeBuildMCP has two modes to manage its extensive toolset, controlled by the `XCODEBUILDMCP_DYNAMIC_TOOLS` environment variable.
130-
131-
#### Static Mode (Default)
132-
- **Environment**: `XCODEBUILDMCP_DYNAMIC_TOOLS=false` or unset.
133-
- **Behavior**: All tools are loaded at startup. This provides immediate access to the full toolset but uses a larger context window.
134-
135-
#### Dynamic Mode (AI-Powered)
136-
- **Environment**: `XCODEBUILDMCP_DYNAMIC_TOOLS=true`.
137-
- **Behavior**: Only the `discover_tools` tool is available initially. You can use this tool by providing a natural language task description. The server then uses an LLM call (via MCP Sampling) to identify the most relevant workflow group and dynamically loads only those tools. This conserves context window space.
129+
XcodeBuildMCP loads tools at startup. To limit the toolset, set `XCODEBUILDMCP_ENABLED_WORKFLOWS` to a comma-separated list of workflow directory names (for example: `simulator,project-discovery`). The `session-management` workflow is always auto-included since other tools depend on it.
138130

139131
#### Claude Code Compatibility Workaround
140132
- **Detection**: Automatic detection when running under Claude Code.
@@ -143,7 +135,7 @@ XcodeBuildMCP has two modes to manage its extensive toolset, controlled by the `
143135

144136
### Core Architecture Layers
145137
1. **MCP Transport**: stdio protocol communication
146-
2. **Plugin Discovery**: Automatic tool AND resource registration system
138+
2. **Plugin Discovery**: Automatic tool AND resource registration system
147139
3. **MCP Resources**: URI-based data access (e.g., `xcodebuildmcp://simulators`)
148140
4. **Tool Implementation**: Self-contained workflow modules
149141
5. **Shared Utilities**: Command execution, build management, validation
@@ -173,7 +165,7 @@ This project uses **TypeScript file extensions** (`.ts`) for all relative import
173165

174166
-**Use `.ts` extensions**: `import { tool } from './tool.ts'`
175167
-**Use `.ts` for re-exports**: `export { default } from '../shared/tool.ts'`
176-
-**External packages use `.js`**: `import { McpServer } from '@camsoft/mcp-sdk/server/mcp.js'`
168+
-**External packages use `.js`**: `import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'`
177169
-**Never use `.js` for internal files**: `import { tool } from './tool.js'` ← ESLint error
178170

179171
### Benefits
@@ -215,4 +207,4 @@ https://github.com/modelcontextprotocol/inspector
215207

216208
### MCP Client SDKs
217209

218-
https://github.com/modelcontextprotocol/typescript-sdk
210+
https://github.com/modelcontextprotocol/typescript-sdk

CHANGELOG.md

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

3+
## [1.16.0] - 2025-12-30
4+
- Remove dynamic tool discovery (`discover_tools`) and `XCODEBUILDMCP_DYNAMIC_TOOLS`. Use `XCODEBUILDMCP_ENABLED_WORKFLOWS` to limit startup tool registration.
5+
- Add MCP tool annotations to all tools.
6+
37
## [1.14.0] - 2025-09-22
48
- Add video capture tool for simulators
59

README.md

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ A Model Context Protocol (MCP) server that provides Xcode-related tools for inte
2626
- [Smithery](#smithery)
2727
- [MCP Compatibility](#mcp-compatibility)
2828
- [Incremental build support](#incremental-build-support)
29-
- [Dynamic Tools](#dynamic-tools)
30-
- [What is Dynamic Tools?](#what-is-dynamic-tools)
31-
- [How to Enable Dynamic Tools](#how-to-enable-dynamic-tools)
32-
- [Usage Example](#usage-example)
33-
- [Client Compatibility](#client-compatibility)
34-
- [Selective Workflow Loading (Static Mode)](#selective-workflow-loading-static-mode)
29+
- [Workflow Selection](#workflow-selection)
3530
- [Session-aware opt-out](#session-aware-opt-out)
3631
- [Code Signing for Device Deployment](#code-signing-for-device-deployment)
3732
- [Troubleshooting](#troubleshooting)
@@ -215,56 +210,11 @@ Example MCP configuration:
215210
> [!IMPORTANT]
216211
> Please note that incremental builds support is currently highly experimental and your mileage may vary. Please report any issues you encounter to the [issue tracker](https://github.com/cameroncooke/XcodeBuildMCP/issues).
217212
218-
## Dynamic Tools
213+
## Workflow Selection
219214

220-
XcodeBuildMCP supports dynamic tool loading to optimize context window usage in AI assistants. This feature is particularly useful for managing the extensive toolset that XcodeBuildMCP provides.
221-
222-
### What is Dynamic Tools?
223-
224-
By default, XcodeBuildMCP loads all available tools at startup (Static Mode), which provides immediate access to the complete toolset but uses a larger context window. Dynamic Tools mode solves this by:
225-
226-
1. **Starting minimal**: Only essential tools like `discover_tools` and `discover_projs` are available initially
227-
2. **AI-powered discovery**: When an AI agent identifies XcodeBuildMCP can help with development tasks, it automatically uses the `discover_tools` tool
228-
3. **Intelligent loading**: The server uses an LLM call to identify the most relevant workflow group and dynamically loads only those tools
229-
4. **Context efficiency**: Reduces the initial context footprint from the entire list of tools to just 2 discovery tools while maintaining full functionality
230-
231-
### How to Enable Dynamic Tools
232-
233-
To enable dynamic tools, set the `XCODEBUILDMCP_DYNAMIC_TOOLS` environment variable to `true`:
215+
By default, XcodeBuildMCP loads all tools at startup. If you want a smaller tool surface for a specific workflow, set `XCODEBUILDMCP_ENABLED_WORKFLOWS` to a comma-separated list of workflow directory names. The `session-management` workflow is always auto-included since other tools depend on it.
234216

235217
Example MCP client configuration:
236-
```json
237-
"XcodeBuildMCP": {
238-
...
239-
"env": {
240-
"XCODEBUILDMCP_DYNAMIC_TOOLS": "true"
241-
}
242-
}
243-
```
244-
245-
### Usage Example
246-
247-
Once enabled, AI agents automatically discover and load relevant tools based on context. For example, when you mention working on an iOS app or the agent detects iOS development tasks in your workspace, it will automatically use the `discover_tools` tool to load the appropriate simulator and project tools needed for your workflow.
248-
249-
### Client Compatibility
250-
251-
Dynamic Tools requires MCP clients that support **MCP Sampling** for the AI-powered tool discovery to function:
252-
253-
| Editor | Dynamic Tools Support |
254-
|--------|----------------------|
255-
| **VS Code** ||
256-
| **Cursor** | ❌ (No MCP Sampling) |
257-
| **Windsurf** | ❌ (No MCP Sampling) |
258-
| **Claude Code** | ❌ (No MCP Sampling) |
259-
| **Claude Desktop** | ❌ (No MCP Sampling) |
260-
261-
> [!NOTE]
262-
> For clients that don't support MCP Sampling, XcodeBuildMCP will automatically fall back to Static Mode, loading all tools at startup regardless of the `XCODEBUILDMCP_DYNAMIC_TOOLS` setting.
263-
264-
### Selective Workflow Loading (Static Mode)
265-
266-
For clients that don't support MCP Sampling but still want to reduce context window usage, you can selectively load only specific workflows using the `XCODEBUILDMCP_ENABLED_WORKFLOWS` environment variable:
267-
268218
```json
269219
"XcodeBuildMCP": {
270220
...
@@ -275,21 +225,17 @@ For clients that don't support MCP Sampling but still want to reduce context win
275225
```
276226

277227
**Available Workflows:**
278-
- `device` (14 tools) - iOS Device Development
279-
- `simulator` (18 tools) - iOS Simulator Development
280-
- `simulator-management` (8 tools) - Simulator Management
228+
- `device` (7 tools) - iOS Device Development
229+
- `simulator` (12 tools) - iOS Simulator Development
230+
- `simulator-management` (5 tools) - Simulator Management
281231
- `swift-package` (6 tools) - Swift Package Manager
282232
- `project-discovery` (5 tools) - Project Discovery
283-
- `macos` (11 tools) - macOS Development
233+
- `macos` (6 tools) - macOS Development
284234
- `ui-testing` (11 tools) - UI Testing & Automation
285235
- `logging` (4 tools) - Log Capture & Management
286236
- `project-scaffolding` (2 tools) - Project Scaffolding
287237
- `utilities` (1 tool) - Project Utilities
288238
- `doctor` (1 tool) - System Doctor
289-
- `discovery` (1 tool) - Dynamic Tool Discovery
290-
291-
> [!NOTE]
292-
> The `XCODEBUILDMCP_ENABLED_WORKFLOWS` setting only works in Static Mode. If `XCODEBUILDMCP_DYNAMIC_TOOLS=true` is set, the selective workflow setting will be ignored.
293239

294240
## Session-aware opt-out
295241

XcodeBuildMCP.code-workspace

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
},
6+
{
7+
"path": "../XcodeBuildMCP-iOS-Template"
8+
},
9+
{
10+
"path": "../XcodeBuildMCP-macOS-Template"
11+
}
12+
]
13+
}

0 commit comments

Comments
 (0)