# MCP

> Let AI agents such as Claude Code debug your app through Xerlock, with a local MCP server. It is off by default.

**MCP** runs a local MCP server that lets AI agents, such as Claude Code, read your app’s logs, requests and state through Xerlock, and change them where you allow it. The server only accepts connections from your own computer.

![The MCP section with the server on, the connection details and the permissions list](/_astro/settings-mcp-light.BY-1MEBe_Znr6zx.webp)![The MCP section with the server on, the connection details and the permissions list](/_astro/settings-mcp-dark.DNuOyTNS_6v7U8.webp)

The MCP section with the server on, the connection details and the permissions list

## Turning it on

Turn on **Enable the MCP server**. It is off by default. The line under the switch shows the server’s state:

| State                   | Meaning                                                               |
| ----------------------- | --------------------------------------------------------------------- |
| **Off**                 | The server isn’t running                                              |
| **Listening on port …** | Agents can connect                                                    |
| **Couldn’t start: …**   | The server couldn’t start, with the reason. The switch turns back off |

**MCP port** defaults to `9341` and takes a number from 1024 to 65535. A running server restarts on the new port, so update the URL in your agents.

## Connecting an agent

**Connect a client** shows the server’s URL and the command that adds it to Claude Code, each with a copy button:

**

```sh
claude mcp add --transport http xerlock http://127.0.0.1:9341/mcp
```

For other agents, add an MCP server with the **Server URL** and the HTTP (Streamable HTTP) transport.

## Permissions

**Permissions** sets what agents can do in each area: **Off**, **Read** or **Read & write**. Changes reach connected agents straight away. To change several areas at once, tick them and pick a level from the bar at the top.

| Area               | Default          | Read                                                | Write                                        |
| ------------------ | ---------------- | --------------------------------------------------- | -------------------------------------------- |
| **Console**        | **Read & write** | Console output                                      | Clear the log                                |
| **Native logs**    | **Read & write** | Native iOS and Android logs                         | Clear the log                                |
| **Network**        | **Read & write** | Requests, headers and bodies                        | Clear the log                                |
| **Filters**        | **Read**         | Your console and network filters                    | Add, change and remove them                  |
| **React**          | **Read & write** | Component tree, props, state and profiler results   | Highlight components and record profiles     |
| **Redux**          | **Read & write** | State and action history                            | Dispatch actions, edit state and time travel |
| **Zustand**        | **Read & write** | Stores and change history                           | Edit state, call actions and time travel     |
| **TanStack Query** | **Read & write** | Queries, mutations and cached data                  | Set data, remove, refetch and invalidate     |
| **Storage**        | **Read**         | Keys and values                                     | Set and delete keys                          |
| **Database**       | **Read**         | Schema, rows and read-only SQL                      | Run any SQL                                  |
| **Navigation**     | **Read**         | The current screen, its params and the app’s routes | Navigate, go back and dispatch actions       |
| **Commands**       | **Read**         | The app’s custom commands                           | Run them                                     |
| **Variables**      | **Read**         | Environments and non-secret variable values         | None                                         |

Writes that last, such as storage, database and commands, start as **Read**. Writes that a reload undoes start as **Read & write**.

Two areas have an extra switch, off by default:

* **Storage › Reveal SecureStore values**: agents only see the SecureStore keys you’ve looked up in Xerlock, and their values stay masked unless this is on.
* **Variables › Allow secret variables**: agents can use `{{name}}` references to [secret variables](/docs/desktop/settings/environments/#secrets). They never see the value, but your app, and anything it logs, can. See [Keychain](/docs/keychain/#agents).

Agents can use `{{name}}` references to your [variables](/docs/desktop/settings/environments/) in any tool’s arguments, and Xerlock fills them in before the tool runs.

## Tools

An agent only sees the tools its permission allows: an area on **Read** offers its read tools, and **Read & write** offers all of them.

Console

| Tool                | Access | Does                                                                      |
| ------------------- | ------ | ------------------------------------------------------------------------- |
| `console_list`      | Read   | Lists console output, newest first, leaving out entries your filters hide |
| `console_get_entry` | Read   | Returns one entry with its full logged values                             |
| `console_clear`     | Write  | Clears Xerlock’s console log. The app isn’t affected                      |

Native logs

| Tool                    | Access | Does                                                                          |
| ----------------------- | ------ | ----------------------------------------------------------------------------- |
| `native_logs_list`      | Read   | Lists native logs, newest first, with the Native logs panel’s filters applied |
| `native_logs_get_entry` | Read   | Returns one log entry with its full message                                   |
| `native_logs_clear`     | Write  | Clears Xerlock’s native log view. The device isn’t affected                   |

Network

| Tool                  | Access | Does                                                                 |
| --------------------- | ------ | -------------------------------------------------------------------- |
| `network_list`        | Read   | Lists requests, newest first, leaving out requests your filters hide |
| `network_get_request` | Read   | Returns one request with its headers and bodies                      |
| `network_clear`       | Write  | Clears Xerlock’s network log. The app isn’t affected                 |

Filters

| Tool                     | Access | Does                                            |
| ------------------------ | ------ | ----------------------------------------------- |
| `filters_list`           | Read   | Lists your console filters                      |
| `filters_add`            | Write  | Adds a console filter                           |
| `filters_update`         | Write  | Changes a console filter, or turns it on or off |
| `filters_remove`         | Write  | Deletes a console filter                        |
| `network_filters_list`   | Read   | Lists your network include and exclude filters  |
| `network_filters_add`    | Write  | Adds a network filter                           |
| `network_filters_update` | Write  | Changes a network filter, or turns it on or off |
| `network_filters_remove` | Write  | Deletes a network filter                        |

React

| Tool                    | Access | Does                                                                    |
| ----------------------- | ------ | ----------------------------------------------------------------------- |
| `react_get_tree`        | Read   | Returns the component tree, or finds components by name                 |
| `react_inspect`         | Read   | Returns one component’s props, state, hooks, owners and source location |
| `react_get_profile`     | Read   | Summarises the last profiler recording                                  |
| `react_highlight`       | Write  | Highlights a component on the device                                    |
| `react_start_profiling` | Write  | Starts recording renders                                                |
| `react_stop_profiling`  | Write  | Stops recording and returns the summary                                 |

Redux

| Tool                     | Access | Does                                                              |
| ------------------------ | ------ | ----------------------------------------------------------------- |
| `redux_get_state`        | Read   | Reads the state, or part of it                                    |
| `redux_list_actions`     | Read   | Lists the actions dispatched since the app connected              |
| `redux_get_action_types` | Read   | Lists the action types your app registered, with example payloads |
| `redux_dispatch`         | Write  | Dispatches an action                                              |
| `redux_set_value`        | Write  | Sets one value in the state                                       |
| `redux_time_travel`      | Write  | Goes back to just after an action, dropping the later ones        |

Zustand

| Tool                   | Access | Does                                                      |
| ---------------------- | ------ | --------------------------------------------------------- |
| `zustand_list_stores`  | Read   | Lists your stores and their top-level keys                |
| `zustand_get_state`    | Read   | Reads a store’s state, or part of it                      |
| `zustand_list_changes` | Read   | Lists state changes since the app connected               |
| `zustand_list_actions` | Read   | Lists each store’s actions, with example arguments        |
| `zustand_set_value`    | Write  | Sets one value in a store                                 |
| `zustand_call_action`  | Write  | Calls a store’s action                                    |
| `zustand_time_travel`  | Write  | Goes back to just after a change, dropping the later ones |

TanStack Query

| Tool                      | Access | Does                                                     |
| ------------------------- | ------ | -------------------------------------------------------- |
| `tanstack_list_queries`   | Read   | Lists the cached queries, without their data             |
| `tanstack_list_mutations` | Read   | Lists the mutations, newest first                        |
| `tanstack_get_query`      | Read   | Reads one query’s status, error and data                 |
| `tanstack_set_data`       | Write  | Replaces a query’s data, like `queryClient.setQueryData` |
| `tanstack_remove_query`   | Write  | Removes a query, like `queryClient.removeQueries`        |
| `tanstack_refetch`        | Write  | Refetches a query, or every query under a key            |
| `tanstack_invalidate`     | Write  | Marks a query, or every query under a key, as stale      |

Storage

| Tool                    | Access | Does                                                               |
| ----------------------- | ------ | ------------------------------------------------------------------ |
| `storage_list_backends` | Read   | Lists your storage backends                                        |
| `storage_list_keys`     | Read   | Lists a backend’s keys. For SecureStore, the keys you’ve looked up |
| `storage_get`           | Read   | Reads one value. SecureStore values are masked unless revealed     |
| `storage_set`           | Write  | Writes one value                                                   |
| `storage_delete`        | Write  | Deletes one key                                                    |

Database

| Tool                  | Access | Does                                              |
| --------------------- | ------ | ------------------------------------------------- |
| `database_list`       | Read   | Lists your databases                              |
| `database_get_schema` | Read   | Lists a database’s tables and views, with columns |
| `database_get_rows`   | Read   | Reads a page of rows from a table or view         |
| `database_query`      | Read   | Runs one read-only SQL statement                  |
| `database_execute`    | Write  | Runs one SQL statement that may write             |

Navigation

| Tool                     | Access | Does                                                        |
| ------------------------ | ------ | ----------------------------------------------------------- |
| `navigation_get_route`   | Read   | Returns the current screen, its params and the previous one |
| `navigation_list_routes` | Read   | Lists the routes the app can navigate to                    |
| `navigation_navigate`    | Write  | Navigates to a route                                        |
| `navigation_go_back`     | Write  | Goes back                                                   |
| `navigation_pop`         | Write  | Pops screens off the current stack                          |
| `navigation_pop_to_top`  | Write  | Pops the current stack back to its first screen             |
| `navigation_dispatch`    | Write  | Dispatches a React Navigation action                        |

Commands

| Tool            | Access | Does                                           |
| --------------- | ------ | ---------------------------------------------- |
| `commands_list` | Read   | Lists your custom commands and their arguments |
| `commands_run`  | Write  | Runs a command                                 |

Variables

| Tool             | Access | Does                                                                    |
| ---------------- | ------ | ----------------------------------------------------------------------- |
| `variables_list` | Read   | Lists your environments and variables. Secret values are never returned |

## Limits and Troubleshooting

* **Couldn’t start: …**: usually another program is using the port. Change **MCP port**, or quit the other program, and turn the server on again.
* An agent says a tool is turned off in Xerlock’s MCP settings: raise that area’s permission.
* Native logs are only collected while the Native logs panel is open.
