ios-sim-mcp: Instructions file for Claude Code

CLAUDE.md

ios-sim-mcp CLAUDE.md is an instructions file for Claude Code from rmathew1973/ios-sim-mcp. It costs 4,311 tokens per session, scanned A, original, MIT.

Project instructions for an MCP server that controls Apple’s iOS Simulator, a virtual iPhone used for app testing. They describe its structure, important files, unusual behaviours, and available tools.

In plain words
What is it for?
Use them when developing or maintaining the iOS Simulator MCP server, including its simulator controls and optional app-launch code injection.
Why use it?
They give a coding agent the project context it needs so it does not repeatedly rediscover how the simulator integration works.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is rmathew1973/ios-sim-mcp's own configuration. It tells Claude Code how to work on ios-sim-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ios-sim-mcp configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/russellmathews/Projects/ios-sim-mcp/src/server.ts.

Reuse

Borrowing it

Nothing to install: this file belongs to rmathew1973/ios-sim-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/rmathew1973/ios-sim-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/rmathew1973/ios-sim-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ios-sim-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/rmathew1973/ios-sim-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/rmathew1973/ios-sim-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/rmathew1973/ios-sim-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/rmathew1973/ios-sim-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ios-sim-mcp CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/rmathew1973/ios-sim-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/rmathew1973/ios-sim-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,311 This file is loaded in full into every session.
When invoked 4,311 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.04311 $0.04311
Opus 5 $0.02155 $0.02155
Sonnet 5 $0.00862 $0.00862
Haiku 4.5 $0.00431 $0.00431

Measured 8d ago against content hash 134bd2bb6082, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

ios-sim-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ios-sim-mcp

MCP server for driving the iOS Simulator the way Chrome MCP drives a browser: semantic AX tree with stable refs, fast snapshot/tap/type cycles, no screenshot-and-click loops.

Architecture

Layer 1 (current, shipping): wraps idb (Facebook's iOS Device Bridge — talks to CoreSimulator's private framework, no WebDriverAgent bridge). Each call is ~100ms.

Layer 2 (in progress): DYLD_INSERT_LIBRARIES dylib injected at app launch via SIMCTL_CHILD_DYLD_INSERT_LIBRARIES (passed to xcrun simctl launch — idb's launch path doesn't forward env). Opt-in per launch (launch_app({inject: true})).

  • 2a ✅ Proof-of-life — constructor runs, emits os_log lifecycle line. See dylib/ios_sim_mcp_dylib.m + dylib/build.sh. Subsystem: com.hmbsoftware.ios-sim-mcp, category: lifecycle. Smoke-tested via test/inject.ts.
  • 2b ✅ Unix socket + JSON-Lines RPC. Socket at /tmp/ios-sim-mcp-<sanitized-bundle-id>.sock, perms 0600. Per-connection serial read loop on a concurrent dispatch queue. Methods registered via ism_register_method (ping, info, paste_text). MCP side: src/dylib_client.ts with line-buffered protocol, pending-call map, lazy connect with 4s deadline, auto-reconnect after relaunch. Tools: dylib_ping, dylib_info, dylib_call, paste_text. type_text auto-routes through paste_text when dylib is loaded. Measured: ~1ms per call once connected, 822ms cold first call (mostly socket-existence wait after launch). Smoke-tested via test/dylib_2b.ts + test/paste_perfect.ts.
    • paste_text uses UIPasteboard.generalPasteboard.string = text + first-responder [responder paste:nil], bouncing to the main queue. First-responder lookup walks UIWindowScene.windows (iOS 13+) preferring isKeyWindow, then falls back to UIApplication.windows. Solves three real input bugs: (1) iOS first-letter autocapitalization mangling lowercase emails ([email protected][email protected] → login fails), (2) Unicode silently dropped through HID translation (café → nothing), (3) smart-quote substitution chewing a"b'c into A. Verified byte-perfect for emails, passwords, Unicode, and quote-containing strings.
  • 2c ✅ view_tree + view_hit_test. Walks UIWindowScene.windows (with UIApplication.windows fallback) → recursive subviews, on the main thread (dispatch_sync(main)). Per node: class, window-coord frame, alpha/hidden/interactive, accessibility id+label+value, text content for UILabel/UIButton/UITextField/UITextView, and vc_class when this view is a UIViewController's viewIfLoaded. Caps: default max_nodes=1500, max_depth=30; hit_cap: true in response when truncated. Skips invisible (hidden / α<0.01 / zero-size) unless include_invisible: true. Renderer: src/view_tree.ts with class_filter / ax_id_contains / text_contains filters (subtree ancestor preservation). Tools: view_tree, view_hit_test. Smoke-tested via test/view_tree.ts. Sub-5ms response for a 105-node SwiftUI Settings tree.
  • 2e ✅ JavaScriptCore eval bridge. JSContext singleton (lazily created on first eval_js, persists across calls, reset via eval_js_reset). All evaluation runs on the main queue via dispatch_sync — same discipline as view_tree/paste_text — so JS code can safely touch UIKit. ism_install_js_bridges sets up globals: app/defaults/pasteboard/bundle/process/notif_center as direct Apple objects, plus block-callable helpers key_window()/all_windows()/first_responder()/find_view_by_ax_id/find_view_by_class/find_vc_by_class/post_notification/cls/log. JSExport categories declared on NSBundle, NSProcessInfo, NSUserDefaults, UIPasteboard, UIApplication, UIView, UIWindow, UIViewController, UILabel, UIButton, UITextField, UITextView — all getters declared with @property syntax so JS sees them as value access (bundle.bundleIdentifier), not function calls (bundle.bundleIdentifier()); methods declared with - (return)method: become camelCase JS functions following JSC's selector→name rules (setObject:forKey:setObjectForKey(value, key)). ism_coerce_js_value maps results to {kind, value} with kinds string|number|boolean|null|undefined|array|object|array_described|objc|other — JSON-able objects pass through; ObjC-bridged objects get {class, description}. Tools: eval_js, eval_js_reset. Smoke-tested via test/eval_js.ts: 13/13 covering arithmetic, string ops, bridged property access, ObjC bridged return, state persistence, syntax/runtime exceptions, NSUserDefaults round-trip, helper functions.
    • Caveat: long-running JS blocks the main queue (dispatch_sync). 5s default MCP-side timeout protects the client but the host app's UI freezes for that duration. Don't run infinite loops.
  • 2g ✅ WKWebView eval bridge + open_url deep-link tool. ism_find_webviews() walks all windows DFS and collects every WKWebView. webview_list reports {index, ax_id, url, title, frame, hidden} per webview. webview_eval_js picks one (priority: ax_id > index > first visible > first) and calls -[WKWebView evaluateJavaScript:completionHandler:] on the main queue; the completion handler runs on a background semaphore-waited thread with a 4s cap (below the MCP-side 5s default). Result coercion mirrors eval_js ({kind, value}). MCP-side ergonomic wrappers webview_fill / webview_click / webview_find inline params as JSON and run hardened JS — webview_fill uses Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set.call(el, text) + dispatchEvent(new Event('input'/'change')) so React's synthetic value tracker and Angular's NgModel actually pick up the change. open_url tool wraps xcrun simctl openurl <udid> <url> for delivering deep links / OAuth callback URLs / http(s) URLs. Builds with -framework WebKit.
    • Auth flow recipe — out-of-process web auth (the AppAuth / ASWebAuthenticationSession case). The login UI runs in SafariViewService / AuthenticationServicesAgent, a separate system process. The dylib cannot reach it — no DOM injection, no view tree, no URL-protocol interception (URLSession swizzle is host-process only). Don't try to drive the sheet. Instead, short-circuit it: (1) network_stub the token endpoint with a canned token JSON response, (2) open_url("yourapp://oauth/callback?code=test&state=...") to deliver the redirect URL directly to the app — AppAuth's URL-handler resumes the flow and calls the (now stubbed) /token, login completes without ever rendering the web sheet.
    • Auth flow recipe — in-process WKWebView. If the app uses a custom WKWebView-based external user agent (e.g. OIDExternalUserAgentIOSCustomBrowser, or any embedded-browser sign-in), use webview_list to confirm presence, webview_find('input[name=email]') to verify the field is rendered, then webview_fill({selector:'input[name=email]', text:'…'}) + webview_click({selector:'button[type=submit]'}).
    • Limitation: WKWebView itself runs networking in its own process — the host-process URLProtocol interceptor still won't see resource loads from inside the webview. JS eval against the DOM works fine.
  • 2f ✅ Network stubbing. Extends ISMURLProtocol.startLoading with a stub-match check before the forwarding path. ism_find_matching_stub does first-match-wins substring lookup on URL + optional case-insensitive method filter, guarded by ism_net_stubs_lock. On match, synthesizes NSHTTPURLResponse with the stub's status/headers, feeds the body through didLoadData, calls URLProtocolDidFinishLoading, and records the response via ism_net_record_completed with the request marked stubbed:true + stub_id. delay_ms honored via dispatch_after. Stub body accepted as body (UTF-8 string) or body_base64 (binary). Methods: network_stub_add/list/remove/clear. Tools: network_stub, network_stubs, network_unstub, network_unstub_all. Smoke-tested via test/network_stubs.ts: 13/13 covering synthesis with custom headers + JSON body, tail marking, method filter (POST stub doesn't catch GET), delay_ms timing, single + bulk removal.
  • 2d ✅ Network interception. ISMURLProtocol subclasses NSURLProtocol; we install via [NSURLProtocol registerClass:] (legacy URLConnection path) + swizzle the class methods +[NSURLSessionConfiguration defaultSessionConfiguration] and +ephemeralSessionConfiguration to prepend our protocol class to protocolClasses (modern URLSession path). In startLoading we forward via a fresh ephemeral session whose config is fetched via the ORIGINAL ephemeral IMP (saved in ism_orig_ephemeralConfig_imp) — bypasses the swizzle to break recursion. Re-entry guard: [NSURLProtocol setProperty:@YES forKey:kISMHandledKey inRequest:forward], declined by +canInitWithRequest:. Ring buffer (default 500 records) + side dictionaries for full request/response bodies (default cap 256KB; full bodies retrievable by id). Methods: network_start, network_stop, network_status, network_tail, network_get_body, network_clear, network_self_test. Tools mirror those. Verified end-to-end against httpbin.org (200/405/418), URL filter works, sub-5ms tail latency. Coverage caveats (must be honest about): catches URLSession-based code only — misses raw CFNetwork / nw_connection_t, background URLSessions, gRPC libraries that bypass URLSession, and WKWebView resource loads (separate process). HTTPBodyStream request bodies are noted but not captured. Sessions constructed before network_start are not retro-fitted (relaunch with inject:true to catch app-startup traffic).
    • Critical SwiftUI caveat: accessibilityIdentifier set in SwiftUI (.accessibilityIdentifier("foo")) lives on the SwiftUI AX tree, NOT on the bridged UIView.accessibilityIdentifier. So view_tree's ax_id_contains filter won't find SwiftUI-set ids. Use the AX snapshot tool for SwiftUI ax-id lookups; use view_tree for SwiftUI when you need view class hierarchy, frames, or hit-testing. Native UIKit apps with explicit accessibilityIdentifier on UIView are found correctly by both.
    • view_hit_test returns the topmost hit via [keyWindow hitTest:p withEvent:nil] plus the full nextResponder chain (typically reaches UIApplication / AppDelegate). View controllers in the chain are tagged is_vc: true (rendered as [VC]).
  • 2d URLProtocol-based network interception with bodies (the big unlock).
  • 2e JSContext eval bridge.

Read the full file on GitHub · 85 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 85 lines · 4,311 tokens per session scan A 134bd2bb6082

Subscribe to this mod's changes

ios-sim-mcp CLAUDE.md is an instructions file published in the GitHub repository rmathew1973/ios-sim-mcp (0 stars, last pushed 1mo ago), licensed MIT. It adds 4,311 tokens to every session, about $0.0216 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens