Skip to main content

Module connect

Module connect 

Source
Expand description

Wiring murk mcp into AI-editor MCP client configs — the engine behind murk agent connect / murk agent disconnect.

Every client stores MCP servers in its own file with its own root key (mcpServers, or servers for VS Code) and its own formatting, and those files are frequently hand-edited and full of // comments. So we never reserialize the whole document: we surgically upsert (or remove) only the murk entry, leaving every other server, key, and comment byte-for-byte intact. The only thing written into a config is a MURK_KEY_FILE path plus MURK_AGENT=1 — never inline key material — so even a committed config leaks nothing but a machine-local path.

Structs§

ClientAdapter
A supported MCP client: where its project-local config lives, the root key its server map uses (or table namespace for TOML), whether an entry needs a typed "type": "stdio", the on-disk format, and a marker directory whose presence signals the client is used in a project.
ConnectOutcome
Outcome of wiring one client.

Enums§

ConfigFormat
The on-disk format of a client’s MCP config.

Constants§

ADAPTERS
Supported clients. Each writes a project-local config so a repo’s grant never leaks into a global, cross-repo config.

Functions§

adapter
Look up an adapter by id (case-insensitive).
connect_client
Upsert the murk server into adapter’s config under project_dir, writing only a MURK_KEY_FILE path (key_file) + MURK_AGENT=1 and any extra_args after mcp. Preserves every other server and comment; atomic (temp+rename).
detect
Adapters whose config file or marker directory already exists under project_dir — the clients this repo actually uses.
disconnect_client
Remove the murk server from adapter’s config. Returns the path when a change was written, None when there was nothing to remove.