Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1ay1 Agentty MCP Import

From Leeroopedia
Knowledge Sources
Domains MCP, Configuration
Last Updated 2026-10-28 12:00 GMT

Overview

Adopts another tool's MCP server configs into agentty's own `~/.agentty/mcp.json` via a one-time import, rather than live-reading foreign config files.

Description

The agentty::mcp::import_ module adopts other tools' MCP server configs (Junie, Claude Code, Cursor, VS Code) into agentty's own `~/.agentty/mcp.json`. The key design decision: import, don't read. MCP configs spawn processes — live-reading a file we don't own, can't validate, and whose edits we never observe would let another tool's config change what we execute silently. Import shows a diff, writes it down, and owns it.

Config entries are copied verbatim (the whole source JSON object, not field-by-field) — translating fields is how an import silently loses the API key that made the server work. Name collisions are never silently replaced — that would swap the command under an approved name (the MCPoison shape). User scope on purpose: an imported server came from the user's global config, not the repo's.

Usage

Import this when you need to: scan foreign MCP configs, adopt servers into agentty's config, or implement the `agentty mcp import` CLI.

Code Reference

Source Location

Signature

namespace agentty::mcp::import_ {

enum class Tool : std::uint8_t { Junie, ClaudeCode, Cursor, VsCode };

struct Locations { fs::path user, project; };
[[nodiscard]] Locations locations_of(Tool, const fs::path& home, const fs::path& project);

struct Found {
    std::string name, command, url;
    nlohmann::json entry;   // whole source object, copied as-is
    fs::path from;
    bool conflicts = false;
};

struct Scan {
    Tool tool{};
    std::vector<fs::path> looked_in;
    std::vector<Found> servers;
    std::string error;
    int skipped = 0;
};

[[nodiscard]] Scan scan(Tool, const fs::path& home, const fs::path& project);
[[nodiscard]] std::vector<Scan> scan_all(const fs::path& home, const fs::path& project);

struct Options { bool dry_run = false; bool force = false; };
struct Outcome { int imported = 0, skipped = 0, failed = 0; fs::path into; };

[[nodiscard]] Outcome adopt(Io, const lock_levels::below_file_lane&, const std::vector<Found>&, const Options&);
int cli(Io, const maya::unlocked&, const std::vector<std::string>& argv);
}

Import

#include "agentty/mcp/import.hpp"

I/O Contract

Inputs

Name Type Required Description
Tool enum Yes Which tool's config to scan (Junie, ClaudeCode, Cursor, VsCode)
home/project fs::path Yes Home and project root for locating foreign configs
Options struct No dry_run (print only), force (adopt conflicts)

Outputs

Name Type Description
scan() Scan All servers found in a tool's configs
adopt() Outcome imported/skipped/failed counts + file written

Usage Examples

Scan and Adopt All Tools

#include "agentty/mcp/import.hpp"

auto scans = agentty::mcp::import_::scan_all(home, project);
std::vector<agentty::mcp::import_::Found> all;
for (const auto& s : scans)
    for (const auto& srv : s.servers)
        all.push_back(srv);

auto outcome = agentty::mcp::import_::adopt(io, file_lane, all, {});
// outcome.imported, outcome.skipped, outcome.into

CLI

# Scan all known tools and report:
agentty mcp import

# Import from a specific tool:
agentty mcp import --from cursor

# Dry run (show what would happen):
agentty mcp import --dry-run

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment