Docs
Mikoshi MCP server
Run Mikoshi as a local MCP tool server for Claude Code, Cursor and other MCP clients
mikoshi mcp turns Mikoshi into a tool server for an MCP client such as Claude Code or the
Claude desktop app. The client's model runs the test. Mikoshi provides the Docker sandbox,
its testing playbooks, and its reporting. No LLM key is needed: the model usage is the
client's own (for example, a Claude subscription used in Claude's apps).
Local setup (stdio)
The local stdio server is the supported way to use Mikoshi over MCP. It runs on your machine, is started by the MCP client, and talks to it over stdin/stdout.
Requirements
- The
mikoshiCLI on yourPATH(or run it from a source checkout withuv run --project /path/to/Mikoshi mikoshi mcp). - Docker running, with access to the sandbox image (the default from Mikoshi's settings;
override it with
MIKOSHI_IMAGEor--image). - No LLM key: the MCP client's model drives the test.
Check that the server starts: mikoshi mcp --help.
Claude Code, from the project you want to test:
claude mcp add mikoshi -- mikoshi mcp
# Also authorize a live target (repeat --allow-target as needed):
claude mcp add mikoshi -- mikoshi mcp --allow-target staging.example.comClaude Code starts the server in the project directory, so that directory is the
authorized source root and mikoshi_runs/ is written there. Check it with claude mcp list.
Cursor (.cursor/mcp.json in the project, or ~/.cursor/mcp.json for all projects):
{
"mcpServers": {
"mikoshi": {
"command": "mikoshi",
"args": ["mcp",
"--allow-path", "/path/to/repo",
"--allow-target", "staging.example.com",
"--runs-dir", "/path/to/reports"]
}
}
}Pass --allow-path and --runs-dir explicitly for Cursor and other clients that may not
start the server in your project directory. If the working directory is the filesystem
root, no source path is authorized by default and runs go to ~/.mikoshi/mcp.
Claude desktop (claude_desktop_config.json) uses the same mcpServers block as
Cursor above.
If mikoshi is not on the client's PATH, use its absolute path (which mikoshi) as
command. Set MIKOSHI_MCP_LOG_LEVEL=INFO (in the client's env block) to get server
logs on stderr; stdout carries the protocol.
Then ask the model to "run a quick Mikoshi pentest of staging.example.com", or use the
pentest prompt.
Scope
The model is not trusted to decide what it may attack. start_engagement refuses any
target outside the operator's scope, and nothing starts:
| Target | Allowed when |
|---|---|
| Local directory | It is under an --allow-path root (default: the working directory). It is mounted read-only. |
| URL, domain, IP | Its host matches --allow-target or MIKOSHI_MCP_ALLOWED_TARGETS (host, *.domain, IP, or CIDR). |
localhost, loopback | Always, unless --no-loopback. Inside the sandbox it is host.docker.internal. |
sandbox_exec also warns when a command names a URL outside scope. That check is advisory:
on your own machine you are the operator. A hosted deployment must enforce egress at the
network level instead.
Tools
| Tool | Purpose |
|---|---|
start_engagement | Authorize targets, start the sandbox, return the methodology briefing |
sandbox_exec | Run a bash command in the sandbox |
engagement_status, end_engagement | Inspect or stop the engagement |
list_skills, load_skill | Mikoshi's testing playbooks |
create_vulnerability_report and the other report tools | File and manage findings, with Mikoshi's validation |
record_coverage, update_coverage, list_coverage | Track what was tested |
create_note and the other note tools | Working notes |
finish_scan | Write the final report and shut the sandbox down |
Output lands in mikoshi_runs/<run>/ under --runs-dir, the same as a CLI scan:
penetration_test_report.md, vulnerabilities.json, findings.sarif, run.json.
Limits
- One engagement per server process (Mikoshi's report state is process-wide).
- The HTTP proxy (Caido) is not started; use curl, the browser, or scripts in the sandbox.
- Repository URLs are not accepted yet; clone locally and pass the directory.
- There is no dollar budget: usage counts against the client's own plan limits.
Hosted service (mikoshi mcp serve): not yet available
Not yet available. The hosted, multi-tenant service and its Kubernetes deployment (
deploy/k8s/,containers/mcp/) are deferred. The code is kept for future work but is not supported or deployed, and nothing in the local server, the CLI, or the tests needs a cluster. The rest of this section describes the intended design.
The same engine, served over Streamable HTTP to many customers. Customers add the
service to their LLM app (in Claude: Settings → Connectors → Add custom connector,
URL https://<your-host>/mcp) and sign in through your identity provider.
MCP client --HTTPS + OAuth--> gateway --> one worker per engagement --Docker--> sandbox
(local process over stdio, or a Kubernetes
pod over HTTP with a per-engagement token)# Keep this stable: it signs the domain challenges.
export MIKOSHI_MCP_SECRET="$(openssl rand -hex 32)"
# --issuer takes any OIDC provider (Auth0, Clerk, WorkOS, Cognito, Keycloak, ...).
mikoshi mcp serve \
--public-url https://mcp.example.com \
--issuer https://<tenant>.auth0.com/ \
--required-scope mikoshi \
--data-dir /var/lib/mikoshi \
--host 0.0.0.0 --port 8765 --egress-enforcedFor local development, skip the identity provider with fixed tokens:
MIKOSHI_MCP_STATIC_TOKENS="<24+ char token>:<tenant>" and the default --host 127.0.0.1.
What the gateway enforces
| Control | How |
|---|---|
| Authentication | OAuth 2.1 resource server: JWT access tokens checked against the provider's JWKS (issuer, audience, expiry, scopes). Clients discover the provider at /.well-known/oauth-protected-resource/mcp. |
| Tenancy | The token subject is the tenant. Verified domains, engagements and reports are scoped to it. |
| Domain ownership | verify_domain gives a DNS TXT record (_mikoshi-challenge.<domain>, covers subdomains) or a /.well-known/mikoshi-verification.txt file (that host only). The token is an HMAC of tenant and domain, so it cannot be reused across accounts. |
| Target scope | start_engagement accepts only domains and URLs covered by the tenant's verified domains. No IPs, local paths, or loopback. Targets must resolve to public addresses (blocks cloud metadata and internal ranges). |
| Isolation | Each engagement runs in its own worker process with exactly the verified hosts as scope, and its own report directory. Workers get no gateway secrets. |
| Limits | One engagement per tenant, --max-engagements overall, ended after --idle-timeout-min idle or --max-engagement-hours. |
| Reports | list_engagements and download_report (report with findings, JSON, SARIF, run record), path-checked to the tenant's directory. |
Network egress control
The sandbox user has root (sudo) and NET_ADMIN, so firewall rules inside the
container do not hold. Egress is enforced outside the sandbox:
- Kubernetes (
--launcher kubernetes, recommended). Each engagement runs in its own pod (worker plus a Docker-in-Docker sidecar that hosts the sandbox), created only after a per-engagementNetworkPolicythat allows the targets' resolved public addresses, cluster DNS, and the in-cluster image registry, and nothing else. All sandbox traffic leaves through the pod, so the policy holds whatever the tester does inside it. With Cilium, aCiliumNetworkPolicyalso allows the verified names (toFQDNs). Seedeploy/k8s/README.md. - Single host (
--launcher subprocess). Workers are local processes and sandboxes share the host's network. Restrict them with host firewall rules (DOCKER-USER) yourself;mikoshi mcp serverefuses to listen on a non-loopback address until you pass--egress-enforcedto confirm it.
The target checks stop the model from being asked to attack someone else's host; egress control stops a sandbox from reaching one.
Also needed in production
- The service image (
containers/mcp/Dockerfile) and the sandbox image (containers/Dockerfile) published where the cluster can pull them. - TLS termination in front of the gateway, and persistent storage for
--data-dir. - An identity provider;
deploy/k8s/README.mdwalks through Auth0. - Customer terms covering authorized testing (the website's acceptable-use page).