Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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>]:

FieldTypeRequiredNotes
enabledboolnoDefaults to true.
typestringnostdio default; allowed: stdio, http, sse.
commandstringstdioRequired for stdio transport.
argsarray(string)noOptional stdio args.
urlstringhttp/sseRequired for http/sse.
headerstablenoOptional HTTP/SSE headers.
envtablenoOptional 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:

  • stdio requires command.
  • http requires url.
  • sse requires url.
  • Unknown type is 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 McpServers and McpServerToggled updates (crates/core/src/submission/op_handlers.rs).
  • Enabled state is persisted via config update (set_mcp_server_enabled).