> ## Documentation Index
> Fetch the complete documentation index at: https://flux.emreb.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code and MCP

> Let an agent read your logs with Flux's own tools.

While Flux is open it can run an MCP server, so an agent in your terminal — Claude Code, or any MCP client — reads the same logs through the same connections.

<Steps>
  <Step title="Turn it on">
    Click the MCP icon in the status bar and tick **Enable MCP Server**. The server listens on `127.0.0.1` only, behind a token Flux makes for you.
  </Step>

  <Step title="Add it to Claude Code">
    **Copy command** gives you the one line to paste:

    ```sh theme={null}
    claude mcp add --transport http flux http://127.0.0.1:4319/mcp --header "Authorization: Bearer …"
    ```
  </Step>

  <Step title="Ask">
    `claude`, then a question. The agent calls Flux's tools and tells you what it found; `open_query` opens the query in Flux in front of you.
  </Step>
</Steps>

## Tools

| tool | what it answers |
| - | - |
| `list_connections` | the connections Flux has |
| `list_streams` | a connection's streams |
| `search_logs` | lines matching a Lucene query, over the last minutes |
| `count_logs` | how many lines match |
| `list_endpoints` | a stream's endpoints with request counts and error rates |
| `current_view` | what is open in Flux right now |
| `open_query` | opens a query in Flux |
| `save_query` | saves a query in Flux, watched unless told otherwise |

Every tool reads; only `save_query` writes, and only to Flux's own saved queries, never to a source. Tokens are never part of an answer.

## Leave a watch behind

After a deploy, ask the agent to keep an eye on what the change could break. It calls `save_query` with the connection, the streams and a Lucene query, and the query appears in the **Queries** tool window, watched: while Flux runs it is asked every round and new matches are announced on the island and as a notification, exactly as a watch you set yourself.

```sh theme={null}
› I just deployed the retry change to payments. Watch for charge errors for me.
● flux · save_query(connection: "acme", streams: ["payments"], query: "level:ERROR AND route:/v1/charges", name: "Charge errors after #418")
```

`every` sets how often it asks, between 15 seconds and an hour; `quiet_below` turns it into a silence watch, for a cron or a webhook that should keep arriving; `watch: false` saves it without watching. Saving the same query on the same streams again updates it rather than adding a second.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.