Skip to content

Collapse MCP-server rendering behind one filtered seam #95

Description

@ChipWolf

Context

A single source of truth — home/.chezmoidata/mcps/{00-base,10-chipwolf}.yaml — is rendered into MCP config for six+ tools. Each renderer independently re-implements the same filtering and resolution logic:

  • conditions matching (e.g. private: true/false)
  • per-target gating via targets.<tool>.enabled
  • server.enabled gating
  • $data.* placeholder resolution (hasPrefix "$data." | trimPrefix | index $root)

That's ~150 lines of near-identical conditional logic spread across the renderers. Each renderer is shallow: its interface (one tool's MCP config) is nearly as complex as its implementation because the filtering dominates and only the output format differs per tool.

Files

Source:

  • home/.chezmoidata/mcps/00-base.yaml
  • home/.chezmoidata/mcps/10-chipwolf.yaml

Renderers (each re-implements the filtering):

  • home/dot_cursor/mcp.json.tmpl
  • home/modify_dot_claude.json
  • home/private_dot_mcpproxy/modify_mcp_config.json (also translates streamableHttpstreamable-http)
  • home/dot_pi/agent/mcp.json.tmpl
  • home/AppData/Roaming/Claude/modify_claude_desktop_config.json
  • home/dot_config/opencode/* (partially centralised already)
  • home/dot_config/zed/modify_settings.json + .chezmoitemplates/zed-context-servers.tmpl

What to do

  1. Load the update-mcp-servers skill (.agents/skills/update-mcp-servers/SKILL.md) first — these files are governed by it.
  2. Add home/.chezmoitemplates/mcp-servers-resolved.tmpl that takes the target name + root and yields the filtered, $data-resolved server set (one place for conditions / targets.<tool>.enabled / server.enabled / $data.*).
  3. Rewrite each renderer to call the partial once and handle only its own output format (Cursor transport, Claude Code type, mcpproxy transport translation, etc.).
  4. Verify byte-identical output before/after for every target with chezmoi cat / chezmoi execute-template and diff. No behaviour change is intended.

Out of scope

  • Changing which servers are enabled or any server's config.
  • Touching the YAML schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions