MCP
Swarmie supports Model Context Protocol servers with stdio, http, and sse transports.
Schema sources:
- TOML config:
crates/core/src/config/toml_types.rs - Runtime transport types:
crates/mcp/src/config.rs - Resolution/validation:
crates/core/src/config/resolve.rs
Config Format
[mcp.servers.github]
enabled = true
type = "http"
url = "https://api.githubcopilot.com/mcp/"
headers = { Authorization = "Bearer ${GITHUB_TOKEN}" }
[mcp.servers.local_db]
type = "stdio"
command = "npx"
args = ["-y", "@bytebase/dbhub"]
env = { DB_URL = "sqlite:///tmp/app.db" }
[mcp.servers.stream]
type = "sse"
url = "https://example.com/events"Fields for [mcp.servers.<name>]:
| Field | Type | Required | Notes |
|---|---|---|---|
enabled | bool | no | Defaults to true. |
type | string | no | stdio default; allowed: stdio, http, sse. |
command | string | stdio | Required for stdio transport. |
args | array(string) | no | Optional stdio args. |
url | string | http/sse | Required for http/sse. |
headers | table | no | Optional HTTP/SSE headers. |
env | table | no | Optional environment vars for stdio processes. |
Transport Semantics
McpTransport enum (crates/mcp/src/config.rs):
Stdio { command, args }: spawn child process and speak MCP over stdio.Http { url, headers }: connect over streamable HTTP.Sse { url, headers }: connect over server-sent events.
Validation Rules
resolve_toml_mcp_servers() enforces:
stdiorequirescommand.httprequiresurl.sserequiresurl.- Unknown
typeis rejected with validation error.
/mcps Management in TUI
/mcps (or /mcp) opens the MCP picker modal (crates/tui/src/input/slash.rs, crates/tui/src/app/update/pickers.rs).
Behavior:
- Requests server list via
Op::McpList. - Shows grouped server states (
Running/Stopped) with transport labels. - Enter toggles selected server via
Op::McpToggle. - Core emits
McpServersandMcpServerToggledupdates (crates/core/src/submission/op_handlers.rs). - Enabled state is persisted via config update (
set_mcp_server_enabled).