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

# Serve MCP over stdio

> Let Claude Code, Cursor, Codex, VS Code, and Gemini CLI start the MoleSignal CLI as a stdio MCP server that carries every message to MoleSignal, and add it to them with one command.

`molesignal mcp` serves MoleSignal's MCP tools over stdio. An agent tool starts the command
itself and talks to it on standard input and output; the CLI carries every message to the
**Inbound MCP** endpoint of MoleSignal and every answer back. The tools, their permissions, and
their approvals are MoleSignal's: the CLI adds none of its own.

## Add the server to an agent tool

[Sign in](https://docs.molesignal.com/en-US/cli/sign-in.md) first, then let the CLI add itself to the agent tool:

```bash theme={null}
molesignal mcp setup claude
```

| Agent tool | What `molesignal mcp setup` changes |
| - | - |
| `claude` | Runs `claude mcp add` for Claude Code. `--scope` is `user` (default), `project`, or `local`. |
| `cursor` | `~/.cursor/mcp.json`, or `.cursor/mcp.json` in the current folder with `--scope project`. |
| `codex` | `~/.codex/config.toml`, under `CODEX_HOME` when it is set. |
| `vscode` | `.vscode/mcp.json` in the current folder. |
| `gemini` | `~/.gemini/settings.json`, or `.gemini/settings.json` in the current folder with `--scope project`. |

The command adds a server named `molesignal`, or replaces one of that name, and keeps every other
setting of the file. The server runs `npx -y @molesignal/cli mcp`; `--installed` runs the
installed `molesignal` instead. `--profile` writes the profile into the server, so the agent tool
uses that sign-in whatever profile is current. `--print` prints the configuration instead of
writing it.

[Connect over stdio](https://docs.molesignal.com/en-US/inbound-mcp#connect-over-stdio) lists the same configuration for each
tool, and the setup prompt at **Mole Agent → Settings → Inbound MCP** writes the steps for the
instance.

Where nobody signs in, such as on a build machine, give the server its credentials in the
environment instead:

```json theme={null}
{
  "mcpServers": {
    "molesignal": {
      "command": "npx",
      "args": ["-y", "@molesignal/cli", "mcp"],
      "env": {
        "MOLESIGNAL_URL": "https://molesignal.example.com",
        "MOLESIGNAL_TOKEN": "<token>"
      }
    }
  }
}
```

## How messages are carried

* Until the agent tool sends `notifications/initialized`, messages are carried one at a time, in
  order: MoleSignal opens the session with its answer to `initialize`. After that, messages are
  carried as they come, so a slow tool call does not hold up the others.
* When MoleSignal no longer knows the session, as after it restarted, the CLI opens a new one with
  the agent tool's own `initialize` and sends the message again. The agent tool goes on without a
  restart.
* A request that cannot reach MoleSignal is answered with an error, so the agent tool does not
  wait.
* When the agent tool closes standard input, the CLI ends the session at MoleSignal and exits.
* Messages that the CLI writes for the reader, such as a lost connection, go to standard error.
  Standard output carries MCP messages only.
* `HTTPS_PROXY` and `NO_PROXY` apply, as for every command.

## Check the connection

```bash theme={null}
molesignal status
```

The tool count matches what the agent tool sees. A count of zero usually means that the
organization's Tool Policy or the user's permissions leave no tool available.


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