Skip to content

Explore: project- and directory-scoped MCP servers #271

Description

@mcpmini

mini's servers are all user-scoped (~/.mini/servers/). Clients also support servers scoped to a project or directory: Claude Code's local scope (projects[<path>].mcpServers in ~/.claude.json) and project scope (.mcp.json in the repo). mini has no equivalent, so those servers either get flattened into the user scope or left behind. This issue is to explore whether mini should support directory-scoped servers, how, and what it would cost. The direction for now is to stay focused on user-scoped servers.

What happens today

mini init and mini add --from-claude read ~/.claude.json through ExtractClaudeMCPServers:

  • If there are any user-scope servers (top-level mcpServers), only those are imported, and every project's servers are ignored without a message.
  • If there are none, every project's servers are merged into one global set. On a name clash between projects the code keeps the "first seen", but Go map iteration is random, so which project's server (URL, headers, token) wins can change between runs. The one that loses is reported only as a stderr warning.

In both cases, a server configured for one project either never reaches mini or becomes available in every project.

.mcp.json (Claude Code's in-repo project scope) is not read at all.

Can mini tell which project a client is in?

Observed on macOS, 2026-10-01:

Client Working directory of the mini connect it spawns
Claude Code (CLI) The directory claude was started in.
ChatGPT desktop → Codex One set of MCP servers per session, each running in that session's chosen folder; / for a session with no folder.
Claude Desktop Not checked yet.

No client passed the project through environment variables. MCP's roots feature, which lets a client report its workspace folders, is deprecated as of protocol 2026-07-28 (SEP-2577). The spec points servers to tool parameters, resource URIs, or server configuration instead.

ChatGPT desktop starts a fresh mini connect for every session, so several projects can share one daemon at the same time.

Questions to answer

  • Demand: how often do users rely on project-scoped servers, versus user-scoped ones?
  • Where project config would live:
    • private to the machine, like Claude Code's local scope;
    • in the repo, like .mcp.json. Config from a cloned repo can launch stdio commands, so it needs a trust and approval step;
    • or both.
  • How a session learns its project: the working directory (verified above for Claude Code and ChatGPT's Codex), an explicit flag such as --project DIR for clients that don't spawn in the project, or something else. How do nested directories resolve?
  • Daemon sessions: one shared daemon serves sessions from different projects. What does each session see?
    • name-clash precedence between project and user servers;
    • when project upstreams start and stop;
    • tool-list changes per session;
    • token and OAuth storage per scope.
  • Import and init: how project-scoped servers in other clients map into mini, and what a "move these servers into mini" step would remove from each client's scope.
  • Effort:

Related: #265 (per-server load isolation), #270 (Codex import).

Activity

  1. mcpmini commented on Oct 2, 2026

    @mcpmini
    OwnerAuthor

    How the two main clients resolve the same server name at more than one scope, checked 2026-10-01.

    Claude Code (MCP docs):

    • Precedence: local > project (.mcp.json) > user > plugin-provided > claude.ai connectors.
    • The whole entry from the winning scope is used: "The entire server entry from that source is used; fields are not merged across scopes."
    • .mcp.json servers need approval in interactive sessions. claude -p, Agent SDK and cloud sessions load them without asking.

    Codex (config basics; merge behavior from the source, openai/codex at 88e9a8329d):

    • Precedence: CLI flags > project .codex/config.toml, where the closest directory wins and only trusted projects are loaded > --profile file > user ~/.codex/config.toml > system > defaults.
    • Layers are deep-merged key by key. merge_toml_values in codex-rs/config/src/merge.rs recurses into tables, and MCP servers are read from the merged config with no special case. A project [mcp_servers.github] that sets only url keeps the user layer's other fields, such as bearer_token_env_var. The docs don't state this.

    Open points this raises:

    • Which rule mini follows. Should a project definition replace the user one wholesale, like Claude Code, or merge with it, like Codex?
    • Importing a Codex project server. It needs Codex's merged view; reading one layer alone can drop fields that come from another layer.
    • Trust. Both clients gate in-repo config behind approval or trust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions