#
tokens: 15719/50000 6/6 files
lines: off (toggle) GitHub
raw markdown copy
# Directory Structure

```
├── dist
│   └── src
│       ├── index.js
│       ├── simulator-service.js
│       └── types.js
├── node_modules
│   ├── .bin
│   │   ├── resolve
│   │   ├── shjs
│   │   ├── shx
│   │   ├── tsc
│   │   └── tsserver
│   ├── .package-lock.json
│   ├── @modelcontextprotocol
│   │   └── sdk
│   │       ├── dist
│   │       │   ├── cli.d.ts
│   │       │   ├── cli.d.ts.map
│   │       │   ├── cli.js
│   │       │   ├── cli.js.map
│   │       │   ├── client
│   │       │   │   ├── index.d.ts
│   │       │   │   ├── index.d.ts.map
│   │       │   │   ├── index.js
│   │       │   │   ├── index.js.map
│   │       │   │   ├── index.test.d.ts
│   │       │   │   ├── index.test.d.ts.map
│   │       │   │   ├── index.test.js
│   │       │   │   ├── index.test.js.map
│   │       │   │   ├── sse.d.ts
│   │       │   │   ├── sse.d.ts.map
│   │       │   │   ├── sse.js
│   │       │   │   ├── sse.js.map
│   │       │   │   ├── stdio.d.ts
│   │       │   │   ├── stdio.d.ts.map
│   │       │   │   ├── stdio.js
│   │       │   │   ├── stdio.js.map
│   │       │   │   ├── stdio.test.d.ts
│   │       │   │   ├── stdio.test.d.ts.map
│   │       │   │   ├── stdio.test.js
│   │       │   │   ├── stdio.test.js.map
│   │       │   │   ├── websocket.d.ts
│   │       │   │   ├── websocket.d.ts.map
│   │       │   │   ├── websocket.js
│   │       │   │   └── websocket.js.map
│   │       │   ├── inMemory.d.ts
│   │       │   ├── inMemory.d.ts.map
│   │       │   ├── inMemory.js
│   │       │   ├── inMemory.js.map
│   │       │   ├── inMemory.test.d.ts
│   │       │   ├── inMemory.test.d.ts.map
│   │       │   ├── inMemory.test.js
│   │       │   ├── inMemory.test.js.map
│   │       │   ├── server
│   │       │   │   ├── index.d.ts
│   │       │   │   ├── index.d.ts.map
│   │       │   │   ├── index.js
│   │       │   │   ├── index.js.map
│   │       │   │   ├── index.test.d.ts
│   │       │   │   ├── index.test.d.ts.map
│   │       │   │   ├── index.test.js
│   │       │   │   ├── index.test.js.map
│   │       │   │   ├── sse.d.ts
│   │       │   │   ├── sse.d.ts.map
│   │       │   │   ├── sse.js
│   │       │   │   ├── sse.js.map
│   │       │   │   ├── stdio.d.ts
│   │       │   │   ├── stdio.d.ts.map
│   │       │   │   ├── stdio.js
│   │       │   │   ├── stdio.js.map
│   │       │   │   ├── stdio.test.d.ts
│   │       │   │   ├── stdio.test.d.ts.map
│   │       │   │   ├── stdio.test.js
│   │       │   │   └── stdio.test.js.map
│   │       │   ├── shared
│   │       │   │   ├── protocol.d.ts
│   │       │   │   ├── protocol.d.ts.map
│   │       │   │   ├── protocol.js
│   │       │   │   ├── protocol.js.map
│   │       │   │   ├── stdio.d.ts
│   │       │   │   ├── stdio.d.ts.map
│   │       │   │   ├── stdio.js
│   │       │   │   ├── stdio.js.map
│   │       │   │   ├── stdio.test.d.ts
│   │       │   │   ├── stdio.test.d.ts.map
│   │       │   │   ├── stdio.test.js
│   │       │   │   ├── stdio.test.js.map
│   │       │   │   ├── transport.d.ts
│   │       │   │   ├── transport.d.ts.map
│   │       │   │   ├── transport.js
│   │       │   │   └── transport.js.map
│   │       │   ├── types.d.ts
│   │       │   ├── types.d.ts.map
│   │       │   ├── types.js
│   │       │   └── types.js.map
│   │       ├── LICENSE
│   │       ├── package.json
│   │       └── README.md
│   ├── @types
│   │   ├── node
│   │   │   ├── assert
│   │   │   │   └── strict.d.ts
│   │   │   ├── assert.d.ts
│   │   │   ├── async_hooks.d.ts
│   │   │   ├── buffer.buffer.d.ts
│   │   │   ├── buffer.d.ts
│   │   │   ├── child_process.d.ts
│   │   │   ├── cluster.d.ts
│   │   │   ├── compatibility
│   │   │   │   ├── disposable.d.ts
│   │   │   │   ├── index.d.ts
│   │   │   │   ├── indexable.d.ts
│   │   │   │   └── iterators.d.ts
│   │   │   ├── console.d.ts
│   │   │   ├── constants.d.ts
│   │   │   ├── crypto.d.ts
│   │   │   ├── dgram.d.ts
│   │   │   ├── diagnostics_channel.d.ts
│   │   │   ├── dns
│   │   │   │   └── promises.d.ts
│   │   │   ├── dns.d.ts
│   │   │   ├── dom-events.d.ts
│   │   │   ├── domain.d.ts
│   │   │   ├── events.d.ts
│   │   │   ├── fs
│   │   │   │   └── promises.d.ts
│   │   │   ├── fs.d.ts
│   │   │   ├── globals.d.ts
│   │   │   ├── globals.typedarray.d.ts
│   │   │   ├── http.d.ts
│   │   │   ├── http2.d.ts
│   │   │   ├── https.d.ts
│   │   │   ├── index.d.ts
│   │   │   ├── inspector.d.ts
│   │   │   ├── LICENSE
│   │   │   ├── module.d.ts
│   │   │   ├── net.d.ts
│   │   │   ├── os.d.ts
│   │   │   ├── package.json
│   │   │   ├── path.d.ts
│   │   │   ├── perf_hooks.d.ts
│   │   │   ├── process.d.ts
│   │   │   ├── punycode.d.ts
│   │   │   ├── querystring.d.ts
│   │   │   ├── readline
│   │   │   │   └── promises.d.ts
│   │   │   ├── readline.d.ts
│   │   │   ├── README.md
│   │   │   ├── repl.d.ts
│   │   │   ├── sea.d.ts
│   │   │   ├── sqlite.d.ts
│   │   │   ├── stream
│   │   │   │   ├── consumers.d.ts
│   │   │   │   ├── promises.d.ts
│   │   │   │   └── web.d.ts
│   │   │   ├── stream.d.ts
│   │   │   ├── string_decoder.d.ts
│   │   │   ├── test.d.ts
│   │   │   ├── timers
│   │   │   │   └── promises.d.ts
│   │   │   ├── timers.d.ts
│   │   │   ├── tls.d.ts
│   │   │   ├── trace_events.d.ts
│   │   │   ├── ts5.6
│   │   │   │   ├── buffer.buffer.d.ts
│   │   │   │   ├── globals.typedarray.d.ts
│   │   │   │   └── index.d.ts
│   │   │   ├── tty.d.ts
│   │   │   ├── url.d.ts
│   │   │   ├── util.d.ts
│   │   │   ├── v8.d.ts
│   │   │   ├── vm.d.ts
│   │   │   ├── wasi.d.ts
│   │   │   ├── worker_threads.d.ts
│   │   │   └── zlib.d.ts
│   │   └── node-fetch
│   │       ├── externals.d.ts
│   │       ├── index.d.ts
│   │       ├── LICENSE
│   │       ├── package.json
│   │       └── README.md
│   ├── asynckit
│   │   ├── bench.js
│   │   ├── index.js
│   │   ├── lib
│   │   │   ├── abort.js
│   │   │   ├── async.js
│   │   │   ├── defer.js
│   │   │   ├── iterate.js
│   │   │   ├── readable_asynckit.js
│   │   │   ├── readable_parallel.js
│   │   │   ├── readable_serial_ordered.js
│   │   │   ├── readable_serial.js
│   │   │   ├── state.js
│   │   │   ├── streamify.js
│   │   │   └── terminator.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── parallel.js
│   │   ├── README.md
│   │   ├── serial.js
│   │   ├── serialOrdered.js
│   │   └── stream.js
│   ├── balanced-match
│   │   ├── .github
│   │   │   └── FUNDING.yml
│   │   ├── index.js
│   │   ├── LICENSE.md
│   │   ├── package.json
│   │   └── README.md
│   ├── brace-expansion
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── bytes
│   │   ├── History.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── Readme.md
│   ├── combined-stream
│   │   ├── lib
│   │   │   └── combined_stream.js
│   │   ├── License
│   │   ├── package.json
│   │   ├── Readme.md
│   │   └── yarn.lock
│   ├── concat-map
│   │   ├── .travis.yml
│   │   ├── example
│   │   │   └── map.js
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.markdown
│   │   └── test
│   │       └── map.js
│   ├── content-type
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── data-uri-to-buffer
│   │   ├── dist
│   │   │   ├── index.d.ts
│   │   │   ├── index.js
│   │   │   └── index.js.map
│   │   ├── package.json
│   │   ├── README.md
│   │   └── src
│   │       └── index.ts
│   ├── delayed-stream
│   │   ├── .npmignore
│   │   ├── lib
│   │   │   └── delayed_stream.js
│   │   ├── License
│   │   ├── Makefile
│   │   ├── package.json
│   │   └── Readme.md
│   ├── depd
│   │   ├── History.md
│   │   ├── index.js
│   │   ├── lib
│   │   │   └── browser
│   │   │       └── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── Readme.md
│   ├── fetch-blob
│   │   ├── file.d.ts
│   │   ├── file.js
│   │   ├── from.d.ts
│   │   ├── from.js
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── streams.cjs
│   ├── form-data
│   │   ├── index.d.ts
│   │   ├── lib
│   │   │   ├── browser.js
│   │   │   ├── form_data.js
│   │   │   └── populate.js
│   │   ├── License
│   │   ├── package.json
│   │   └── Readme.md
│   ├── formdata-polyfill
│   │   ├── esm.min.d.ts
│   │   ├── esm.min.js
│   │   ├── formdata-to-blob.js
│   │   ├── FormData.js
│   │   ├── formdata.min.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── fs.realpath
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── old.js
│   │   ├── package.json
│   │   └── README.md
│   ├── function-bind
│   │   ├── .eslintrc
│   │   ├── .github
│   │   │   ├── FUNDING.yml
│   │   │   └── SECURITY.md
│   │   ├── .nycrc
│   │   ├── CHANGELOG.md
│   │   ├── implementation.js
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── test
│   │       ├── .eslintrc
│   │       └── index.js
│   ├── glob
│   │   ├── common.js
│   │   ├── glob.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── sync.js
│   ├── hasown
│   │   ├── .eslintrc
│   │   ├── .github
│   │   │   └── FUNDING.yml
│   │   ├── .nycrc
│   │   ├── CHANGELOG.md
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── tsconfig.json
│   ├── http-errors
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── iconv-lite
│   │   ├── .github
│   │   │   └── dependabot.yml
│   │   ├── .idea
│   │   │   ├── codeStyles
│   │   │   │   ├── codeStyleConfig.xml
│   │   │   │   └── Project.xml
│   │   │   ├── iconv-lite.iml
│   │   │   ├── inspectionProfiles
│   │   │   │   └── Project_Default.xml
│   │   │   ├── modules.xml
│   │   │   └── vcs.xml
│   │   ├── Changelog.md
│   │   ├── encodings
│   │   │   ├── dbcs-codec.js
│   │   │   ├── dbcs-data.js
│   │   │   ├── index.js
│   │   │   ├── internal.js
│   │   │   ├── sbcs-codec.js
│   │   │   ├── sbcs-data-generated.js
│   │   │   ├── sbcs-data.js
│   │   │   ├── tables
│   │   │   │   ├── big5-added.json
│   │   │   │   ├── cp936.json
│   │   │   │   ├── cp949.json
│   │   │   │   ├── cp950.json
│   │   │   │   ├── eucjp.json
│   │   │   │   ├── gb18030-ranges.json
│   │   │   │   ├── gbk-added.json
│   │   │   │   └── shiftjis.json
│   │   │   ├── utf16.js
│   │   │   ├── utf32.js
│   │   │   └── utf7.js
│   │   ├── lib
│   │   │   ├── bom-handling.js
│   │   │   ├── index.d.ts
│   │   │   ├── index.js
│   │   │   └── streams.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── inflight
│   │   ├── inflight.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── inherits
│   │   ├── inherits_browser.js
│   │   ├── inherits.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── interpret
│   │   ├── CHANGELOG
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── mjs-stub.js
│   │   ├── package.json
│   │   └── README.md
│   ├── is-core-module
│   │   ├── .eslintrc
│   │   ├── .nycrc
│   │   ├── CHANGELOG.md
│   │   ├── core.json
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── test
│   │       └── index.js
│   ├── mime-db
│   │   ├── db.json
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── mime-types
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── minimatch
│   │   ├── LICENSE
│   │   ├── minimatch.js
│   │   ├── package.json
│   │   └── README.md
│   ├── minimist
│   │   ├── .eslintrc
│   │   ├── .github
│   │   │   └── FUNDING.yml
│   │   ├── .nycrc
│   │   ├── CHANGELOG.md
│   │   ├── example
│   │   │   └── parse.js
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── test
│   │       ├── all_bool.js
│   │       ├── bool.js
│   │       ├── dash.js
│   │       ├── default_bool.js
│   │       ├── dotted.js
│   │       ├── kv_short.js
│   │       ├── long.js
│   │       ├── num.js
│   │       ├── parse_modified.js
│   │       ├── parse.js
│   │       ├── proto.js
│   │       ├── short.js
│   │       ├── stop_early.js
│   │       ├── unknown.js
│   │       └── whitespace.js
│   ├── node-domexception
│   │   ├── .history
│   │   │   ├── index_20210527203842.js
│   │   │   ├── index_20210527203947.js
│   │   │   ├── index_20210527204259.js
│   │   │   ├── index_20210527204418.js
│   │   │   ├── index_20210527204756.js
│   │   │   ├── index_20210527204833.js
│   │   │   ├── index_20210527211208.js
│   │   │   ├── index_20210527211248.js
│   │   │   ├── index_20210527212722.js
│   │   │   ├── index_20210527212731.js
│   │   │   ├── index_20210527212746.js
│   │   │   ├── index_20210527212900.js
│   │   │   ├── index_20210527213022.js
│   │   │   ├── index_20210527213822.js
│   │   │   ├── index_20210527213843.js
│   │   │   ├── index_20210527213852.js
│   │   │   ├── index_20210527213910.js
│   │   │   ├── index_20210527214034.js
│   │   │   ├── index_20210527214643.js
│   │   │   ├── index_20210527214654.js
│   │   │   ├── index_20210527214700.js
│   │   │   ├── package_20210527203733.json
│   │   │   ├── package_20210527203825.json
│   │   │   ├── package_20210527204621.json
│   │   │   ├── package_20210527204913.json
│   │   │   ├── package_20210527204925.json
│   │   │   ├── package_20210527205145.json
│   │   │   ├── package_20210527205156.json
│   │   │   ├── README_20210527203617.md
│   │   │   ├── README_20210527212714.md
│   │   │   ├── README_20210527213345.md
│   │   │   ├── README_20210527213411.md
│   │   │   ├── README_20210527213803.md
│   │   │   ├── README_20210527214323.md
│   │   │   ├── README_20210527214408.md
│   │   │   ├── test_20210527205603.js
│   │   │   ├── test_20210527205957.js
│   │   │   └── test_20210527210021.js
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── node-fetch
│   │   ├── @types
│   │   │   └── index.d.ts
│   │   ├── LICENSE.md
│   │   ├── package.json
│   │   ├── README.md
│   │   └── src
│   │       ├── body.js
│   │       ├── errors
│   │       │   ├── abort-error.js
│   │       │   ├── base.js
│   │       │   └── fetch-error.js
│   │       ├── headers.js
│   │       ├── index.js
│   │       ├── request.js
│   │       ├── response.js
│   │       └── utils
│   │           ├── get-search.js
│   │           ├── is-redirect.js
│   │           ├── is.js
│   │           ├── multipart-parser.js
│   │           └── referrer.js
│   ├── once
│   │   ├── LICENSE
│   │   ├── once.js
│   │   ├── package.json
│   │   └── README.md
│   ├── path-is-absolute
│   │   ├── index.js
│   │   ├── license
│   │   ├── package.json
│   │   └── readme.md
│   ├── path-parse
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── raw-body
│   │   ├── HISTORY.md
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── SECURITY.md
│   ├── rechoir
│   │   ├── .npmignore
│   │   ├── .travis.yml
│   │   ├── CHANGELOG
│   │   ├── index.js
│   │   ├── lib
│   │   │   ├── extension.js
│   │   │   ├── normalize.js
│   │   │   └── register.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── resolve
│   │   ├── .editorconfig
│   │   ├── .eslintrc
│   │   ├── .github
│   │   │   └── FUNDING.yml
│   │   ├── async.js
│   │   ├── bin
│   │   │   └── resolve
│   │   ├── example
│   │   │   ├── async.js
│   │   │   └── sync.js
│   │   ├── index.js
│   │   ├── lib
│   │   │   ├── async.js
│   │   │   ├── caller.js
│   │   │   ├── core.js
│   │   │   ├── core.json
│   │   │   ├── homedir.js
│   │   │   ├── is-core.js
│   │   │   ├── node-modules-paths.js
│   │   │   ├── normalize-options.js
│   │   │   └── sync.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── readme.markdown
│   │   ├── SECURITY.md
│   │   ├── sync.js
│   │   └── test
│   │       ├── core.js
│   │       ├── dotdot
│   │       │   ├── abc
│   │       │   │   └── index.js
│   │       │   └── index.js
│   │       ├── dotdot.js
│   │       ├── faulty_basedir.js
│   │       ├── filter_sync.js
│   │       ├── filter.js
│   │       ├── home_paths_sync.js
│   │       ├── home_paths.js
│   │       ├── mock_sync.js
│   │       ├── mock.js
│   │       ├── module_dir
│   │       │   ├── xmodules
│   │       │   │   └── aaa
│   │       │   │       └── index.js
│   │       │   ├── ymodules
│   │       │   │   └── aaa
│   │       │   │       └── index.js
│   │       │   └── zmodules
│   │       │       └── bbb
│   │       │           ├── main.js
│   │       │           └── package.json
│   │       ├── module_dir.js
│   │       ├── node_path
│   │       │   ├── x
│   │       │   │   ├── aaa
│   │       │   │   │   └── index.js
│   │       │   │   └── ccc
│   │       │   │       └── index.js
│   │       │   └── y
│   │       │       ├── bbb
│   │       │       │   └── index.js
│   │       │       └── ccc
│   │       │           └── index.js
│   │       ├── node_path.js
│   │       ├── node-modules-paths.js
│   │       ├── nonstring.js
│   │       ├── pathfilter
│   │       │   └── deep_ref
│   │       │       └── main.js
│   │       ├── pathfilter.js
│   │       ├── precedence
│   │       │   ├── aaa
│   │       │   │   ├── index.js
│   │       │   │   └── main.js
│   │       │   ├── aaa.js
│   │       │   ├── bbb
│   │       │   │   └── main.js
│   │       │   └── bbb.js
│   │       ├── precedence.js
│   │       ├── resolver
│   │       │   ├── baz
│   │       │   │   ├── doom.js
│   │       │   │   ├── package.json
│   │       │   │   └── quux.js
│   │       │   ├── browser_field
│   │       │   │   ├── a.js
│   │       │   │   ├── b.js
│   │       │   │   └── package.json
│   │       │   ├── cup.coffee
│   │       │   ├── dot_main
│   │       │   │   ├── index.js
│   │       │   │   └── package.json
│   │       │   ├── dot_slash_main
│   │       │   │   ├── index.js
│   │       │   │   └── package.json
│   │       │   ├── false_main
│   │       │   │   ├── index.js
│   │       │   │   └── package.json
│   │       │   ├── foo.js
│   │       │   ├── incorrect_main
│   │       │   │   ├── index.js
│   │       │   │   └── package.json
│   │       │   ├── invalid_main
│   │       │   │   └── package.json
│   │       │   ├── mug.coffee
│   │       │   ├── mug.js
│   │       │   ├── multirepo
│   │       │   │   ├── lerna.json
│   │       │   │   ├── package.json
│   │       │   │   └── packages
│   │       │   │       ├── package-a
│   │       │   │       │   ├── index.js
│   │       │   │       │   └── package.json
│   │       │   │       └── package-b
│   │       │   │           ├── index.js
│   │       │   │           └── package.json
│   │       │   ├── nested_symlinks
│   │       │   │   └── mylib
│   │       │   │       ├── async.js
│   │       │   │       ├── package.json
│   │       │   │       └── sync.js
│   │       │   ├── other_path
│   │       │   │   ├── lib
│   │       │   │   │   └── other-lib.js
│   │       │   │   └── root.js
│   │       │   ├── quux
│   │       │   │   └── foo
│   │       │   │       └── index.js
│   │       │   ├── same_names
│   │       │   │   ├── foo
│   │       │   │   │   └── index.js
│   │       │   │   └── foo.js
│   │       │   ├── symlinked
│   │       │   │   ├── _
│   │       │   │   │   ├── node_modules
│   │       │   │   │   │   └── foo.js
│   │       │   │   │   └── symlink_target
│   │       │   │   │       └── .gitkeep
│   │       │   │   └── package
│   │       │   │       ├── bar.js
│   │       │   │       └── package.json
│   │       │   └── without_basedir
│   │       │       └── main.js
│   │       ├── resolver_sync.js
│   │       ├── resolver.js
│   │       ├── shadowed_core
│   │       │   └── node_modules
│   │       │       └── util
│   │       │           └── index.js
│   │       ├── shadowed_core.js
│   │       ├── subdirs.js
│   │       └── symlinks.js
│   ├── safer-buffer
│   │   ├── dangerous.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── Porting-Buffer.md
│   │   ├── Readme.md
│   │   ├── safer.js
│   │   └── tests.js
│   ├── setprototypeof
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── test
│   │       └── index.js
│   ├── shelljs
│   │   ├── bin
│   │   │   └── shjs
│   │   ├── CHANGELOG.md
│   │   ├── commands.js
│   │   ├── global.js
│   │   ├── LICENSE
│   │   ├── make.js
│   │   ├── package.json
│   │   ├── plugin.js
│   │   ├── README.md
│   │   ├── shell.js
│   │   └── src
│   │       ├── cat.js
│   │       ├── cd.js
│   │       ├── chmod.js
│   │       ├── common.js
│   │       ├── cp.js
│   │       ├── dirs.js
│   │       ├── echo.js
│   │       ├── error.js
│   │       ├── exec-child.js
│   │       ├── exec.js
│   │       ├── find.js
│   │       ├── grep.js
│   │       ├── head.js
│   │       ├── ln.js
│   │       ├── ls.js
│   │       ├── mkdir.js
│   │       ├── mv.js
│   │       ├── popd.js
│   │       ├── pushd.js
│   │       ├── pwd.js
│   │       ├── rm.js
│   │       ├── sed.js
│   │       ├── set.js
│   │       ├── sort.js
│   │       ├── tail.js
│   │       ├── tempdir.js
│   │       ├── test.js
│   │       ├── to.js
│   │       ├── toEnd.js
│   │       ├── touch.js
│   │       ├── uniq.js
│   │       └── which.js
│   ├── shx
│   │   ├── CHANGELOG.md
│   │   ├── lib
│   │   │   ├── cli.js
│   │   │   ├── config.js
│   │   │   ├── help.js
│   │   │   ├── plugin-true-false.js
│   │   │   ├── printCmdRet.js
│   │   │   └── shx.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── statuses
│   │   ├── codes.json
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── supports-preserve-symlinks-flag
│   │   ├── .eslintrc
│   │   ├── .github
│   │   │   └── FUNDING.yml
│   │   ├── .nycrc
│   │   ├── browser.js
│   │   ├── CHANGELOG.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── test
│   │       └── index.js
│   ├── toidentifier
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── typescript
│   │   ├── bin
│   │   │   ├── tsc
│   │   │   └── tsserver
│   │   ├── lib
│   │   │   ├── _tsc.js
│   │   │   ├── _tsserver.js
│   │   │   ├── _typingsInstaller.js
│   │   │   ├── cancellationToken.js
│   │   │   ├── cs
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── de
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── es
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── fr
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── it
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── ja
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── ko
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── lib.d.ts
│   │   │   ├── lib.decorators.d.ts
│   │   │   ├── lib.decorators.legacy.d.ts
│   │   │   ├── lib.dom.asynciterable.d.ts
│   │   │   ├── lib.dom.d.ts
│   │   │   ├── lib.dom.iterable.d.ts
│   │   │   ├── lib.es2015.collection.d.ts
│   │   │   ├── lib.es2015.core.d.ts
│   │   │   ├── lib.es2015.d.ts
│   │   │   ├── lib.es2015.generator.d.ts
│   │   │   ├── lib.es2015.iterable.d.ts
│   │   │   ├── lib.es2015.promise.d.ts
│   │   │   ├── lib.es2015.proxy.d.ts
│   │   │   ├── lib.es2015.reflect.d.ts
│   │   │   ├── lib.es2015.symbol.d.ts
│   │   │   ├── lib.es2015.symbol.wellknown.d.ts
│   │   │   ├── lib.es2016.array.include.d.ts
│   │   │   ├── lib.es2016.d.ts
│   │   │   ├── lib.es2016.full.d.ts
│   │   │   ├── lib.es2016.intl.d.ts
│   │   │   ├── lib.es2017.arraybuffer.d.ts
│   │   │   ├── lib.es2017.d.ts
│   │   │   ├── lib.es2017.date.d.ts
│   │   │   ├── lib.es2017.full.d.ts
│   │   │   ├── lib.es2017.intl.d.ts
│   │   │   ├── lib.es2017.object.d.ts
│   │   │   ├── lib.es2017.sharedmemory.d.ts
│   │   │   ├── lib.es2017.string.d.ts
│   │   │   ├── lib.es2017.typedarrays.d.ts
│   │   │   ├── lib.es2018.asyncgenerator.d.ts
│   │   │   ├── lib.es2018.asynciterable.d.ts
│   │   │   ├── lib.es2018.d.ts
│   │   │   ├── lib.es2018.full.d.ts
│   │   │   ├── lib.es2018.intl.d.ts
│   │   │   ├── lib.es2018.promise.d.ts
│   │   │   ├── lib.es2018.regexp.d.ts
│   │   │   ├── lib.es2019.array.d.ts
│   │   │   ├── lib.es2019.d.ts
│   │   │   ├── lib.es2019.full.d.ts
│   │   │   ├── lib.es2019.intl.d.ts
│   │   │   ├── lib.es2019.object.d.ts
│   │   │   ├── lib.es2019.string.d.ts
│   │   │   ├── lib.es2019.symbol.d.ts
│   │   │   ├── lib.es2020.bigint.d.ts
│   │   │   ├── lib.es2020.d.ts
│   │   │   ├── lib.es2020.date.d.ts
│   │   │   ├── lib.es2020.full.d.ts
│   │   │   ├── lib.es2020.intl.d.ts
│   │   │   ├── lib.es2020.number.d.ts
│   │   │   ├── lib.es2020.promise.d.ts
│   │   │   ├── lib.es2020.sharedmemory.d.ts
│   │   │   ├── lib.es2020.string.d.ts
│   │   │   ├── lib.es2020.symbol.wellknown.d.ts
│   │   │   ├── lib.es2021.d.ts
│   │   │   ├── lib.es2021.full.d.ts
│   │   │   ├── lib.es2021.intl.d.ts
│   │   │   ├── lib.es2021.promise.d.ts
│   │   │   ├── lib.es2021.string.d.ts
│   │   │   ├── lib.es2021.weakref.d.ts
│   │   │   ├── lib.es2022.array.d.ts
│   │   │   ├── lib.es2022.d.ts
│   │   │   ├── lib.es2022.error.d.ts
│   │   │   ├── lib.es2022.full.d.ts
│   │   │   ├── lib.es2022.intl.d.ts
│   │   │   ├── lib.es2022.object.d.ts
│   │   │   ├── lib.es2022.regexp.d.ts
│   │   │   ├── lib.es2022.string.d.ts
│   │   │   ├── lib.es2023.array.d.ts
│   │   │   ├── lib.es2023.collection.d.ts
│   │   │   ├── lib.es2023.d.ts
│   │   │   ├── lib.es2023.full.d.ts
│   │   │   ├── lib.es2023.intl.d.ts
│   │   │   ├── lib.es2024.arraybuffer.d.ts
│   │   │   ├── lib.es2024.collection.d.ts
│   │   │   ├── lib.es2024.d.ts
│   │   │   ├── lib.es2024.full.d.ts
│   │   │   ├── lib.es2024.object.d.ts
│   │   │   ├── lib.es2024.promise.d.ts
│   │   │   ├── lib.es2024.regexp.d.ts
│   │   │   ├── lib.es2024.sharedmemory.d.ts
│   │   │   ├── lib.es2024.string.d.ts
│   │   │   ├── lib.es5.d.ts
│   │   │   ├── lib.es6.d.ts
│   │   │   ├── lib.esnext.array.d.ts
│   │   │   ├── lib.esnext.collection.d.ts
│   │   │   ├── lib.esnext.d.ts
│   │   │   ├── lib.esnext.decorators.d.ts
│   │   │   ├── lib.esnext.disposable.d.ts
│   │   │   ├── lib.esnext.full.d.ts
│   │   │   ├── lib.esnext.intl.d.ts
│   │   │   ├── lib.esnext.iterator.d.ts
│   │   │   ├── lib.scripthost.d.ts
│   │   │   ├── lib.webworker.asynciterable.d.ts
│   │   │   ├── lib.webworker.d.ts
│   │   │   ├── lib.webworker.importscripts.d.ts
│   │   │   ├── lib.webworker.iterable.d.ts
│   │   │   ├── pl
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── pt-br
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── ru
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── tr
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   ├── tsc.js
│   │   │   ├── tsserver.js
│   │   │   ├── tsserverlibrary.d.ts
│   │   │   ├── tsserverlibrary.js
│   │   │   ├── typescript.d.ts
│   │   │   ├── typescript.js
│   │   │   ├── typesMap.json
│   │   │   ├── typingsInstaller.js
│   │   │   ├── watchGuard.js
│   │   │   ├── zh-cn
│   │   │   │   └── diagnosticMessages.generated.json
│   │   │   └── zh-tw
│   │   │       └── diagnosticMessages.generated.json
│   │   ├── LICENSE.txt
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── SECURITY.md
│   │   └── ThirdPartyNoticeText.txt
│   ├── undici-types
│   │   ├── agent.d.ts
│   │   ├── api.d.ts
│   │   ├── balanced-pool.d.ts
│   │   ├── cache.d.ts
│   │   ├── client.d.ts
│   │   ├── connector.d.ts
│   │   ├── content-type.d.ts
│   │   ├── cookies.d.ts
│   │   ├── diagnostics-channel.d.ts
│   │   ├── dispatcher.d.ts
│   │   ├── env-http-proxy-agent.d.ts
│   │   ├── errors.d.ts
│   │   ├── eventsource.d.ts
│   │   ├── fetch.d.ts
│   │   ├── file.d.ts
│   │   ├── filereader.d.ts
│   │   ├── formdata.d.ts
│   │   ├── global-dispatcher.d.ts
│   │   ├── global-origin.d.ts
│   │   ├── handlers.d.ts
│   │   ├── header.d.ts
│   │   ├── index.d.ts
│   │   ├── interceptors.d.ts
│   │   ├── LICENSE
│   │   ├── mock-agent.d.ts
│   │   ├── mock-client.d.ts
│   │   ├── mock-errors.d.ts
│   │   ├── mock-interceptor.d.ts
│   │   ├── mock-pool.d.ts
│   │   ├── package.json
│   │   ├── patch.d.ts
│   │   ├── pool-stats.d.ts
│   │   ├── pool.d.ts
│   │   ├── proxy-agent.d.ts
│   │   ├── readable.d.ts
│   │   ├── README.md
│   │   ├── retry-agent.d.ts
│   │   ├── retry-handler.d.ts
│   │   ├── util.d.ts
│   │   ├── webidl.d.ts
│   │   └── websocket.d.ts
│   ├── unpipe
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── web-streams-polyfill
│   │   ├── dist
│   │   │   ├── polyfill.es2018.js
│   │   │   ├── polyfill.es2018.js.map
│   │   │   ├── polyfill.es2018.min.js
│   │   │   ├── polyfill.es2018.min.js.map
│   │   │   ├── polyfill.es2018.mjs
│   │   │   ├── polyfill.es2018.mjs.map
│   │   │   ├── polyfill.es6.js
│   │   │   ├── polyfill.es6.js.map
│   │   │   ├── polyfill.es6.min.js
│   │   │   ├── polyfill.es6.min.js.map
│   │   │   ├── polyfill.es6.mjs
│   │   │   ├── polyfill.es6.mjs.map
│   │   │   ├── polyfill.js
│   │   │   ├── polyfill.js.map
│   │   │   ├── polyfill.min.js
│   │   │   ├── polyfill.min.js.map
│   │   │   ├── polyfill.mjs
│   │   │   ├── polyfill.mjs.map
│   │   │   ├── ponyfill.es2018.js
│   │   │   ├── ponyfill.es2018.js.map
│   │   │   ├── ponyfill.es2018.mjs
│   │   │   ├── ponyfill.es2018.mjs.map
│   │   │   ├── ponyfill.es6.js
│   │   │   ├── ponyfill.es6.js.map
│   │   │   ├── ponyfill.es6.mjs
│   │   │   ├── ponyfill.es6.mjs.map
│   │   │   ├── ponyfill.js
│   │   │   ├── ponyfill.js.map
│   │   │   ├── ponyfill.mjs
│   │   │   ├── ponyfill.mjs.map
│   │   │   └── types
│   │   │       ├── polyfill.d.ts
│   │   │       ├── ponyfill.d.ts
│   │   │       ├── ts3.6
│   │   │       │   ├── polyfill.d.ts
│   │   │       │   └── ponyfill.d.ts
│   │   │       └── tsdoc-metadata.json
│   │   ├── es2018
│   │   │   └── package.json
│   │   ├── es6
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── ponyfill
│   │   │   ├── es2018
│   │   │   │   └── package.json
│   │   │   ├── es6
│   │   │   │   └── package.json
│   │   │   └── package.json
│   │   └── README.md
│   ├── wrappy
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── wrappy.js
│   ├── zod
│   │   ├── index.d.ts
│   │   ├── lib
│   │   │   ├── __tests__
│   │   │   │   ├── Mocker.d.ts
│   │   │   │   └── Mocker.js
│   │   │   ├── benchmarks
│   │   │   │   ├── datetime.d.ts
│   │   │   │   ├── datetime.js
│   │   │   │   ├── discriminatedUnion.d.ts
│   │   │   │   ├── discriminatedUnion.js
│   │   │   │   ├── index.d.ts
│   │   │   │   ├── index.js
│   │   │   │   ├── ipv4.d.ts
│   │   │   │   ├── ipv4.js
│   │   │   │   ├── object.d.ts
│   │   │   │   ├── object.js
│   │   │   │   ├── primitives.d.ts
│   │   │   │   ├── primitives.js
│   │   │   │   ├── realworld.d.ts
│   │   │   │   ├── realworld.js
│   │   │   │   ├── string.d.ts
│   │   │   │   ├── string.js
│   │   │   │   ├── union.d.ts
│   │   │   │   └── union.js
│   │   │   ├── errors.d.ts
│   │   │   ├── errors.js
│   │   │   ├── external.d.ts
│   │   │   ├── external.js
│   │   │   ├── helpers
│   │   │   │   ├── enumUtil.d.ts
│   │   │   │   ├── enumUtil.js
│   │   │   │   ├── errorUtil.d.ts
│   │   │   │   ├── errorUtil.js
│   │   │   │   ├── parseUtil.d.ts
│   │   │   │   ├── parseUtil.js
│   │   │   │   ├── partialUtil.d.ts
│   │   │   │   ├── partialUtil.js
│   │   │   │   ├── typeAliases.d.ts
│   │   │   │   ├── typeAliases.js
│   │   │   │   ├── util.d.ts
│   │   │   │   └── util.js
│   │   │   ├── index.d.ts
│   │   │   ├── index.js
│   │   │   ├── index.mjs
│   │   │   ├── index.umd.js
│   │   │   ├── locales
│   │   │   │   ├── en.d.ts
│   │   │   │   └── en.js
│   │   │   ├── types.d.ts
│   │   │   ├── types.js
│   │   │   ├── ZodError.d.ts
│   │   │   └── ZodError.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   └── zod-to-json-schema
│       ├── .github
│       │   └── FUNDING.yml
│       ├── .prettierrc.json
│       ├── changelog.md
│       ├── contributing.md
│       ├── createIndex.ts
│       ├── dist
│       │   ├── cjs
│       │   │   ├── errorMessages.js
│       │   │   ├── index.js
│       │   │   ├── Options.js
│       │   │   ├── package.json
│       │   │   ├── parseDef.js
│       │   │   ├── parsers
│       │   │   │   ├── any.js
│       │   │   │   ├── array.js
│       │   │   │   ├── bigint.js
│       │   │   │   ├── boolean.js
│       │   │   │   ├── branded.js
│       │   │   │   ├── catch.js
│       │   │   │   ├── date.js
│       │   │   │   ├── default.js
│       │   │   │   ├── effects.js
│       │   │   │   ├── enum.js
│       │   │   │   ├── intersection.js
│       │   │   │   ├── literal.js
│       │   │   │   ├── map.js
│       │   │   │   ├── nativeEnum.js
│       │   │   │   ├── never.js
│       │   │   │   ├── null.js
│       │   │   │   ├── nullable.js
│       │   │   │   ├── number.js
│       │   │   │   ├── object.js
│       │   │   │   ├── optional.js
│       │   │   │   ├── pipeline.js
│       │   │   │   ├── promise.js
│       │   │   │   ├── readonly.js
│       │   │   │   ├── record.js
│       │   │   │   ├── set.js
│       │   │   │   ├── string.js
│       │   │   │   ├── tuple.js
│       │   │   │   ├── undefined.js
│       │   │   │   ├── union.js
│       │   │   │   └── unknown.js
│       │   │   ├── Refs.js
│       │   │   └── zodToJsonSchema.js
│       │   ├── esm
│       │   │   ├── errorMessages.js
│       │   │   ├── index.js
│       │   │   ├── Options.js
│       │   │   ├── package.json
│       │   │   ├── parseDef.js
│       │   │   ├── parsers
│       │   │   │   ├── any.js
│       │   │   │   ├── array.js
│       │   │   │   ├── bigint.js
│       │   │   │   ├── boolean.js
│       │   │   │   ├── branded.js
│       │   │   │   ├── catch.js
│       │   │   │   ├── date.js
│       │   │   │   ├── default.js
│       │   │   │   ├── effects.js
│       │   │   │   ├── enum.js
│       │   │   │   ├── intersection.js
│       │   │   │   ├── literal.js
│       │   │   │   ├── map.js
│       │   │   │   ├── nativeEnum.js
│       │   │   │   ├── never.js
│       │   │   │   ├── null.js
│       │   │   │   ├── nullable.js
│       │   │   │   ├── number.js
│       │   │   │   ├── object.js
│       │   │   │   ├── optional.js
│       │   │   │   ├── pipeline.js
│       │   │   │   ├── promise.js
│       │   │   │   ├── readonly.js
│       │   │   │   ├── record.js
│       │   │   │   ├── set.js
│       │   │   │   ├── string.js
│       │   │   │   ├── tuple.js
│       │   │   │   ├── undefined.js
│       │   │   │   ├── union.js
│       │   │   │   └── unknown.js
│       │   │   ├── Refs.js
│       │   │   └── zodToJsonSchema.js
│       │   └── types
│       │       ├── errorMessages.d.ts
│       │       ├── index.d.ts
│       │       ├── Options.d.ts
│       │       ├── parseDef.d.ts
│       │       ├── parsers
│       │       │   ├── any.d.ts
│       │       │   ├── array.d.ts
│       │       │   ├── bigint.d.ts
│       │       │   ├── boolean.d.ts
│       │       │   ├── branded.d.ts
│       │       │   ├── catch.d.ts
│       │       │   ├── date.d.ts
│       │       │   ├── default.d.ts
│       │       │   ├── effects.d.ts
│       │       │   ├── enum.d.ts
│       │       │   ├── intersection.d.ts
│       │       │   ├── literal.d.ts
│       │       │   ├── map.d.ts
│       │       │   ├── nativeEnum.d.ts
│       │       │   ├── never.d.ts
│       │       │   ├── null.d.ts
│       │       │   ├── nullable.d.ts
│       │       │   ├── number.d.ts
│       │       │   ├── object.d.ts
│       │       │   ├── optional.d.ts
│       │       │   ├── pipeline.d.ts
│       │       │   ├── promise.d.ts
│       │       │   ├── readonly.d.ts
│       │       │   ├── record.d.ts
│       │       │   ├── set.d.ts
│       │       │   ├── string.d.ts
│       │       │   ├── tuple.d.ts
│       │       │   ├── undefined.d.ts
│       │       │   ├── union.d.ts
│       │       │   └── unknown.d.ts
│       │       ├── Refs.d.ts
│       │       └── zodToJsonSchema.d.ts
│       ├── LICENSE
│       ├── package.json
│       ├── postcjs.ts
│       ├── postesm.ts
│       ├── README.md
│       └── SECURITY.md
├── package-lock.json
├── package.json
├── README.md
├── src
│   ├── index.ts
│   ├── simulator-service.ts
│   └── types.ts
└── tsconfig.json
```

# Files

--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------

```markdown
# iOS Simulator MCP Server

A Model Context Protocol (MCP) server that provides programmatic control over iOS simulators. This server implements the MCP specification to expose simulator functionality through a standardized interface.

## Features

- List available iOS simulators
- Boot and shutdown simulators
- Install .app bundles on simulators
- Launch installed apps by bundle ID

## Installation
Add the following to your Claude Config JSON file
```
{
  "mcpServers": {
    "simulator": {
      "command": "npx",
      "args": [
        "y",
        "@joshuarileydev/simulator-mcp-server"
      ]
    }
  }
}
```
```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
{
    "compilerOptions": {
        "target": "ES2022",
        "module": "Node16",
        "moduleResolution": "Node16",
        "strict": true,
        "esModuleInterop": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true,
        "resolveJsonModule": true,
        "outDir": "./dist",
        "rootDir": "."
    },
    "exclude": [
        "node_modules"
    ],
    "include": [
        "./**/*.ts"
    ]
}
```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
{
    "name": "@joshuarileydev/simulator-mcp-server",
    "version": "0.0.1",
    "description": "An MCP server for controlling iOS simulators",
    "license": "MIT",
    "type": "module",
    "private": false,
    "bin": {
        "simulator-server": "dist/index.js"
    },
    "files": [
        "dist"
    ],
    "scripts": {
        "build": "tsc && shx chmod +x dist/src/*.js",
        "prepare": "npm run build",
        "watch": "tsc --watch"
    },
    "dependencies": {
        "@modelcontextprotocol/sdk": "0.6.0",
        "@types/node-fetch": "^2.6.12",
        "node-fetch": "^3.3.2",
        "zod": "^3.22.4",
        "zod-to-json-schema": "^3.23.5"
    },
    "devDependencies": {
        "shx": "^0.3.4",
        "typescript": "^5.6.2"
    }
}
```

--------------------------------------------------------------------------------
/src/types.ts:
--------------------------------------------------------------------------------

```typescript
export interface SimulatorDevice {
  udid: string;
  name: string;
  state: string;
  runtime: string;
}

export interface AppLaunchOptions {
  deviceId: string;
  bundleId: string;
}

export interface AppInstallOptions {
  deviceId: string;
  appPath: string;
}

export interface SimulatorBootOptions {
  deviceId: string;
}

// Type guards
export function isAppLaunchOptions(args: any): args is AppLaunchOptions {
  return (
    typeof args === 'object' &&
    args !== null &&
    typeof args.deviceId === 'string' &&
    typeof args.bundleId === 'string'
  );
}

export function isAppInstallOptions(args: any): args is AppInstallOptions {
  return (
    typeof args === 'object' &&
    args !== null &&
    typeof args.deviceId === 'string' &&
    typeof args.appPath === 'string'
  );
}

export function isSimulatorBootOptions(args: any): args is SimulatorBootOptions {
  return (
    typeof args === 'object' &&
    args !== null &&
    typeof args.deviceId === 'string'
  );
} 
```

--------------------------------------------------------------------------------
/src/simulator-service.ts:
--------------------------------------------------------------------------------

```typescript
import { exec } from 'child_process';
import { promisify } from 'util';
import { SimulatorDevice } from './types.js';

const execAsync = promisify(exec);

export class SimulatorService {
  async listDevices(): Promise<SimulatorDevice[]> {
    const { stdout } = await execAsync('xcrun simctl list devices --json');
    const result = JSON.parse(stdout) as { devices: Record<string, any[]> };
    
    const devices: SimulatorDevice[] = [];
    Object.entries(result.devices).forEach(([runtime, deviceList]) => {
      deviceList.forEach(device => {
        devices.push({
          udid: device.udid,
          name: device.name,
          state: device.state,
          runtime: runtime.replace('com.apple.CoreSimulator.SimRuntime.', '')
        });
      });
    });
    
    return devices;
  }

  async bootDevice(deviceId: string): Promise<void> {
    await execAsync(`xcrun simctl boot ${deviceId}`);
  }

  async shutdownDevice(deviceId: string): Promise<void> {
    await execAsync(`xcrun simctl shutdown ${deviceId}`);
  }

  async installApp(deviceId: string, appPath: string): Promise<void> {
    await execAsync(`xcrun simctl install ${deviceId} "${appPath}"`);
  }

  async launchApp(deviceId: string, bundleId: string): Promise<void> {
    await execAsync(`xcrun simctl launch ${deviceId} ${bundleId}`);
  }
} 
```

--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------

```typescript
#!/usr/bin/env node
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
import { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';
import { SimulatorService } from './simulator-service.js';

// Input schemas
const ListSimulatorsSchema = z.object({});

const BootSimulatorSchema = z.object({
  deviceId: z.string().describe("The UDID of the simulator to boot")
});

const ShutdownSimulatorSchema = z.object({
  deviceId: z.string().describe("The UDID of the simulator to shutdown")
});

const InstallAppSchema = z.object({
  deviceId: z.string().describe("The UDID of the target simulator"),
  appPath: z.string().describe("Path to the .app bundle to install")
});

const LaunchAppSchema = z.object({
  deviceId: z.string().describe("The UDID of the target simulator"),
  bundleId: z.string().describe("Bundle identifier of the app to launch")
});

// Initialize simulator service
const simulatorService = new SimulatorService();

// Initialize server
const server = new Server({
  name: "ios-simulator-server",
  version: "1.0.0"
}, {
  capabilities: {
    tools: {}
  }
});

// List available tools
server.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: [
      {
        name: "list_simulators",
        description: "List all available iOS simulators",
        inputSchema: zodToJsonSchema(ListSimulatorsSchema)
      },
      {
        name: "boot_simulator",
        description: "Boot an iOS simulator",
        inputSchema: zodToJsonSchema(BootSimulatorSchema)
      },
      {
        name: "shutdown_simulator",
        description: "Shutdown an iOS simulator",
        inputSchema: zodToJsonSchema(ShutdownSimulatorSchema)
      },
      {
        name: "install_app",
        description: "Install an app on a simulator",
        inputSchema: zodToJsonSchema(InstallAppSchema)
      },
      {
        name: "launch_app",
        description: "Launch an installed app on a simulator",
        inputSchema: zodToJsonSchema(LaunchAppSchema)
      }
    ]
  };
});

// Handle tool calls
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  try {
    if (!request.params.arguments) {
      throw new Error("Arguments are required");
    }

    switch (request.params.name) {
      case "list_simulators": {
        const devices = await simulatorService.listDevices();
        return { toolResult: { devices } };
      }
      case "boot_simulator": {
        const args = BootSimulatorSchema.parse(request.params.arguments);
        await simulatorService.bootDevice(args.deviceId);
        return { toolResult: { success: true } };
      }
      case "shutdown_simulator": {
        const args = ShutdownSimulatorSchema.parse(request.params.arguments);
        await simulatorService.shutdownDevice(args.deviceId);
        return { toolResult: { success: true } };
      }
      case "install_app": {
        const args = InstallAppSchema.parse(request.params.arguments);
        await simulatorService.installApp(args.deviceId, args.appPath);
        return { toolResult: { success: true } };
      }
      case "launch_app": {
        const args = LaunchAppSchema.parse(request.params.arguments);
        await simulatorService.launchApp(args.deviceId, args.bundleId);
        return { toolResult: { success: true } };
      }
      default:
        throw new Error(`Unknown tool: ${request.params.name}`);
    }
  } catch (error) {
    if (error instanceof z.ZodError) {
      throw new Error(`Invalid arguments: ${error.message}`);
    }
    throw error;
  }
});

// Start the server
async function runServer() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error("iOS Simulator MCP Server running on stdio");
}

runServer().catch((error) => {
  console.error("Fatal error in main():", error);
  process.exit(1);
});
```