# kosa8 mcp serve

Serve the MCP endpoint over stdio, or HTTP with --http

Every tool call through a gateway server (kosa8 mcp add) is decided by the
org MCP policy and recorded in the audit log with a digest of its arguments
and of its result. --session and --sandbox attribute those records to an AI
session and the sandbox the agent works in, so `kosa8 ai bom` and `kosa8
evidence export` can find them.

--http serves the same tools over streamable HTTP. Every request must carry
`Authorization: Bearer TOKEN`: the token is KOSA8_MCP_TOKEN when set, else a
random one printed once to stderr. Only loopback addresses are accepted unless
--insecure-listen is given.

Agents may share host directories into sandboxes only below an --allow-mount
directory, read-only unless it is given as DIR:rw.

## Flags

| Flag | Type | What it does | Default |
|---|---|---|---|
| `--allow-mount` | stringArray | host directory agents may share into sandboxes, DIR (read-only) or DIR:rw (repeatable; default none) | `[]` |
| `--http` | string | serve streamable HTTP on this address instead of stdio, e.g. 127.0.0.1:7433 (bearer-token authenticated) |  |
| `--insecure-listen` | bool | allow --http on a non-loopback address |  |
| `--sandbox` | string | the sandbox the agent using this endpoint works in |  |
| `--session` | string | AI session id the audit records belong to (default: a new one) |  |

## Example

```
  kosa8 mcp serve
  kosa8 mcp serve --http 127.0.0.1:7879
  kosa8 mcp serve --sandbox dev
```

---
Source: https://docs.kosa8.com/reference/mcp-serve/
