You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: MCP for every CLI agent via sync and per-run scoping (#124) - #164
[[mcp_servers]] in ~/.secfoo/config.toml reached claude automatically via ephemeral --mcp-config and gemini/agent via secfoo mcp sync, but all other adapters had no MCP handling (codex.py noted it as a follow-up, and copilot, opencode, droid, devin, and agy did not handle MCP at all). As a result, Confluence, Jira, and enterprise context sources could not be reached across most CLI agents.
Codex: Merges [mcp_servers.<name>] tables into ~/.codex/config.toml (stdio command/args/env and remote url/transport/headers), preserving existing settings without leaking secrets into process argv via -c.
Copilot CLI: Merges into ~/.copilot/mcp-config.json with "type": "local"|"http" and tools: ["*"].
OpenCode: Merges into ~/.config/opencode/opencode.json with "type": "local"|"remote", array command format, and environment mapping.
Droid: Merges into ~/.factory/mcp.json following the standard mcpServers schema.
Devin: Merges into ~/.config/devin/mcp_config.json (%APPDATA%\devin\mcp_config.json on Windows).
All sync_* functions write safely, preserve existing unrelated top-level keys and user-defined servers, and are strictly idempotent.
secfoo mcp sync supports --agent <id> or running without --agent to sync all supported agents.
Single Source of Truth (docs/REFERENCE.md):
The MCP support table in docs/REFERENCE.md serves as the single source of truth for agent capabilities.
secfoo mcp sync --agent <unsupported> prints the exact support table and guidance from docs/REFERENCE.md rather than a hardcoded error.
secfoo agents displays an MCP column (per-run, sync, or none).
Added automated consistency test (test_reference_md_mcp_matrix_consistency) to ensure code and documentation never drift.
Documentation:
Updated docs/REFERENCE.md, docs/agents.md, and README.md ("Context, not just code") with the full 10-agent support matrix, verified CLI versions, and notes as of 2026-11-20 (including Antigravity CLI 2.0 note).
Verification
Targeted unit & CLI tests: 111 passed (tests/test_mcp.py & tests/test_cli.py).
Adapter test suite: 139 passed (tests/test_agents).
Full test suite: 1873 passed (0 regressions against main baseline).
Thanks for taking on #124. The adapter coverage and the docs matrix are a useful start. We're closing this PR without merging because several issues need a different approach rather than small fixes. #124 stays open, and a new PR that addresses the points below is very welcome.
Blocking
Secrets are written to readable files.mcp sync uses effective_servers(), which includes the default secfoo-memory server and its bearer key, plus any user env/headers. write_claude_mcp_config sets 0600 on purpose. The five new sync_* functions create files at the default permissions (usually 0644). Any file that holds env/headers should be 0600.
secfoo mcp sync without --agent will fail for most users. It now targets all 7 agents whether or not their CLIs are installed:
sync_gemini and sync_cursor call gemini / agent via subprocess.run and don't handle FileNotFoundError, so a missing CLI produces a traceback.
Before that, it creates ~/.codex, ~/.copilot, ~/.factory and ~/.config/{opencode,devin} and writes credentials into tools the user may not use.
Please limit the "all" mode to agents where adapter.is_available() is true, or keep --agent required.
Codex sync rewrites the user's whole ~/.codex/config.toml. It parses with tomllib and re-serializes with a custom _dumps_toml, which:
drops all comments;
raises an uncaught TypeError on TOML datetimes;
drops empty tables such as [features];
writes in place with no temp file + os.replace and no backup.
That conflicts with "without clobbering other settings". Please use a format-preserving editor (e.g. tomlkit) and write atomically.
The Codex remote server shape looks wrong. The PR writes transport and headers. Codex's streamable-HTTP config uses url with http_headers / bearer_token_env_var, has no transport key, and doesn't support SSE. Please check this against the Codex config reference. As written, authenticated remote servers (including secfoo-memory) would likely fail.
Should fix
Cursor behavior changes. Existing same-named entries used to be skipped. Now they're overwritten if they differ at all, which drops user fields like disabled, and the result is still reported as "added". User-defined servers need to be preserved (or the update reported clearly as an update).
Copilot maps sse to "type": "http". Copilot has its own "sse" type.
get_mcp_support_matrix() parses docs/REFERENCE.md at runtime.
In an installed wheel that path doesn't exist, so the code always falls back to CANONICAL_MCP_SUPPORT, but the error still says "from docs/REFERENCE.md".
secfoo agents re-reads and re-parses the file once per agent.
Please make the code the source of truth and keep the parser only in the consistency test, which already prevents drift.
A JSON root that isn't an object (e.g. []) makes every JSON sync_* crash with TypeError on existing_root["mcpServers"] = ....
We need evidence from the real CLIs. All tests mock the CLIs. Please include evidence (CLI version + output) that each agent actually loads the synced servers during a secfoo run. Specifically: does opencode run --pure still load MCP servers, and is ~/.config/devin/mcp_config.json the path Devin CLI reads?
Security consideration
copilot runs with --allow-all-tools, and the sync sets tools: ["*"]. Many enterprise MCP servers (Jira, Confluence) expose write tools, so a review that's meant to be read-only could create or edit tickets. Claude avoids this with its per-run --allowedTools list. A new PR should explain how write-capable MCP tools are restricted for each agent, or at least document the risk.
Nits
sync_cursor/copilot/opencode/droid/devin are near-duplicates. One helper taking (path, root_key, shape_fn) would remove most of the repetition.
Silently swallowing OSError on the Claude config chmod hides a failure to protect a secrets file. Please log a warning at least.
The branch currently conflicts with main, so a new PR should start from current main.
Thanks again for the work here. We'd be glad to review a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
[[mcp_servers]]in~/.secfoo/config.tomlreachedclaudeautomatically via ephemeral--mcp-configandgemini/agentviasecfoo mcp sync, but all other adapters had no MCP handling (codex.pynoted it as a follow-up, andcopilot,opencode,droid,devin, andagydid not handle MCP at all). As a result, Confluence, Jira, and enterprise context sources could not be reached across most CLI agents.Solution
Fixes #124.
Persistent Sync Adapters (
src/secfoo/mcp.py):[mcp_servers.<name>]tables into~/.codex/config.toml(stdiocommand/args/envand remoteurl/transport/headers), preserving existing settings without leaking secrets into process argv via-c.~/.copilot/mcp-config.jsonwith"type": "local"|"http"andtools: ["*"].~/.config/opencode/opencode.jsonwith"type": "local"|"remote", array command format, andenvironmentmapping.~/.factory/mcp.jsonfollowing the standardmcpServersschema.~/.config/devin/mcp_config.json(%APPDATA%\devin\mcp_config.jsonon Windows).sync_*functions write safely, preserve existing unrelated top-level keys and user-defined servers, and are strictly idempotent.secfoo mcp syncsupports--agent <id>or running without--agentto sync all supported agents.Single Source of Truth (
docs/REFERENCE.md):docs/REFERENCE.mdserves as the single source of truth for agent capabilities.secfoo mcp sync --agent <unsupported>prints the exact support table and guidance fromdocs/REFERENCE.mdrather than a hardcoded error.secfoo agentsdisplays anMCPcolumn (per-run,sync, ornone).test_reference_md_mcp_matrix_consistency) to ensure code and documentation never drift.Documentation:
docs/REFERENCE.md,docs/agents.md, andREADME.md("Context, not just code") with the full 10-agent support matrix, verified CLI versions, and notes as of 2026-11-20 (including Antigravity CLI 2.0 note).Verification
tests/test_mcp.py&tests/test_cli.py).tests/test_agents).mainbaseline).ruff check: 0 lint errors.