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

# MCP

> OASM on both sides of the Model Context Protocol: the built-in MCP server that exposes read-only workspace tools to external AI clients, and the MCP client that brings tools from external servers into the agent

OASM speaks the [Model Context Protocol](https://modelcontextprotocol.io) in both directions:

* as an **MCP server**, so assistants such as Claude Desktop, Cursor or VS Code can query a workspace;
* as an **MCP client**, so the Security Agent can use tools from MCP servers the workspace connects.

```mermaid theme={null}
flowchart LR
    subgraph Ext["Outside OASM"]
        Client["MCP client<br/>Claude, Cursor, VS Code"]
        Server["External MCP server<br/>ticketing, cloud, threat intel"]
    end

    subgraph Core["Core API"]
        MS["MCP server<br/>/api/mcp"]
        RO["Read-only tool subset"]
        Agent["Security Agent run"]
        MC["MCP client"]
    end

    Client -->|"x-oasm-api-key"| MS
    MS --> RO
    Agent --> MC
    MC -->|"SSE or streamable HTTP"| Server
```

## OASM as an MCP server

The MCP server is not a separate service: it is an endpoint of the core API (`/api/mcp`, with messages posted to `/api/mcp/message`), so it uses the same services, scoping and query engine as the console and the agent.

### Authentication and scope

A client authenticates with the **workspace API key** in the `x-oasm-api-key` header. The key maps the session to its workspace; nothing the client sends can choose another one. The API key is accepted on the MCP endpoint only — it cannot call the REST API. There is no user behind the key, so actions are recorded in the audit log with the API key as the actor. See [API keys](https://docs.oasm.io/api-keys.md).

Each MCP session is held by the API process that opened it, expires after 30 minutes of inactivity, and a process keeps at most 100 sessions, dropping the oldest first.

### Read-only by construction

The MCP server has no approval flow — there is no human in the loop to ask — so it exposes **read-only tools only**. A tool is on the MCP surface only if its declaration marks it both `mcp` and read-only with a static input schema, and the core API refuses to start if any declaration breaks that rule. The surface is:

* `describe_attack_surface` and `query_attack_surface` — the full [Attack Surface Query](https://docs.oasm.io/attack-surface-query/ai-agent-and-mcp.md) language over the inventory,
* `investigate_vulnerability`, `gather_statistics`,
* `enumerate_open_issues`, `inspect_issue`,
* `list_active_workers`, `review_jobs`,
* `list_projects`, `inspect_project`, `list_project_assets`, `list_project_runs`, `read_project_file`,
* `list_workflow_templates`, `list_pipeline_tools`.

Nothing on this list can start a scan, run a command, change scope or write a finding. A leaked API key therefore exposes workspace data — which is why it should be rotated like a password — but cannot be used to act on the infrastructure.

Client setup is described in [MCP Server](https://docs.oasm.io/settings/mcp.md).

## OASM as an MCP client

Members with `agent.write` can connect external MCP servers to the workspace in [AI Studio](https://docs.oasm.io/ai-studio/connectors.md#external-mcp-servers). The configuration is workspace-wide: one set of servers for every member's agent.

* **Transports** — SSE and streamable HTTP, with custom headers for authentication. Servers can be switched off without deleting them, and each can be limited to an allow-list of its tools.
* **Discovery** — at the start of a run, the agent lists the tools of every enabled server. Lists are cached per server configuration, so editing a server's URL, headers or allowed tools takes effect at once.
* **Naming** — external tools appear as `<server>_<tool>`. A built-in tool always wins a name clash, so an external server cannot replace a platform tool.
* **Gating** — external tools are offered to the main agent in both modes (subagents do not get them), behind the same [guard and approval gate](https://docs.oasm.io/architecture/ai-agent/safety.md) as built-in write tools: the built-in deny list and workspace tool rules apply to them, and they ask for approval unless the server marks them read-only and not reaching the outside world.
* **Connection test** — the **ping** action refuses private and internal addresses before connecting, so the test cannot be turned into a probe of the internal network.

External tools act with the credentials configured on the server, not with the member's OASM permissions; the approval gate is the control. Connect only servers you trust, and prefer giving them narrowly scoped credentials.

## Related

> [card] [MCP Server](https://docs.oasm.io/settings/mcp.md)
>
> Connect Claude Desktop, Cursor, VS Code and other clients

> [card] [Connectors and MCP in AI Studio](https://docs.oasm.io/ai-studio/connectors.md)
>
> Connect external MCP servers to the agent

> [card] [ASQ for the AI agent and MCP](https://docs.oasm.io/attack-surface-query/ai-agent-and-mcp.md)
>
> The query language the MCP surface is built around


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