Skip to main content

Module import

Module import 

Source
Expand description

Discovering MCP servers already configured in other agent harnesses.

Someone installing Leviath has usually already wired up MCP servers somewhere else - Claude Code, Cursor, Codex, Zed. Making them retype each one is busywork, and the entries are close enough in shape to convert mechanically, so lev setup offers to import them.

§Layering

Two halves, deliberately separated:

  • formats turns file contents into candidates. Pure, no filesystem, no #[cfg] - every harness’s format is testable on every platform, including ones whose files could never exist there.
  • This module knows where those files live - the only platform-dependent part. It takes its roots as an injected Roots rather than reading the environment, so the whole table is testable against tempdirs, and the one genuine per-OS branch is #[cfg]-gated in a single place, per the rule daemon_service follows.

Nothing here is prescribed to Leviath as a whole. Scanning a user’s home directory for other tools’ config is a desktop-shaped idea; a future mobile host would simply have no sources and offer no import step, with everything downstream unchanged.

§What is deliberately not done

Discovery never connects to a server, never runs a command, and never reads anything outside the specific files listed below.

Re-exports§

pub use formats::Candidate;

Modules§

formats
Turning another harness’s config file contents into Leviath MCPServerConfigs.

Structs§

Roots
Where to look. Everything is derived from injected roots rather than read from the environment, so the whole table is testable against tempdirs.
Scan
The result of reading one source.
Source
One harness Leviath knows how to read.

Enums§

Layout
How a source file’s servers are laid out.

Functions§

already_configured
Whether name is already configured in Leviath.
dedup_name
A name that does not collide with anything already configured, by appending -2, -3, … Used when the user chooses to keep both.
known_sources
Every harness config file Leviath knows about, whether or not it exists.
scan
Read and parse every known source that exists.