From ba0dc9d4bf4b8c9e4c35f85c0096d3bd2b27b464 Mon Sep 17 00:00:00 2001 From: Raj Gahoi Date: Mon, 9 Nov 2026 20:58:43 +0530 Subject: [PATCH] feat(agent): support Windsurf coding agent in MCP installer --- README.md | 2 +- src/agent.rs | 3 +++ src/agent/config.rs | 2 +- src/agent/tests.rs | 28 +++++++++++++++++++++++----- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index eea0165..28c251f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ set as `PROOFLINE_TOKEN`. A token that works in one organization needs no ### MCP agent registration -To register MCP without a prompt, run `proofline agent install CLIENT --yes`. Supported clients include `claude-code` (or `claude`), `cursor`, `codex`, `gemini`, and `kiro`. Without `--yes`, the command previews the entry and asks for confirmation, while `--print` previews without writing. Existing Proofline entries remain unchanged. New entries use this executable's absolute path and store no credentials. Claude Code uses the top-level `mcpServers` in `~/.claude.json`; a custom `CLAUDE_CONFIG_DIR` requires manual configuration with `--print`. +To register MCP without a prompt, run `proofline agent install CLIENT --yes`. Supported clients include `claude-code` (or `claude`), `cursor`, `codex`, `gemini`, `kiro`, and `windsurf`. Without `--yes`, the command previews the entry and asks for confirmation, while `--print` previews without writing. Existing Proofline entries remain unchanged. New entries use this executable's absolute path and store no credentials. Claude Code uses the top-level `mcpServers` in `~/.claude.json`; a custom `CLAUDE_CONFIG_DIR` requires manual configuration with `--print`. Native knowledge, plan, fix and configuration commands send the selected organization as `organization_id` in each MCP tool call. With a `PROOFLINE_TOKEN` that works in more than one organization, select an authorized UUID using `--org ORGANIZATION_ID` or `PROOFLINE_ORGANIZATION_ID`; the flag takes precedence. A token that works in exactly one, such as a personal token, needs neither. A stored device sign-in uses its approved organization and refuses a different selection. For example, `proofline --org ORGANIZATION_ID wiki list --repo owner/name` and `proofline --org ORGANIZATION_ID config get` target that organization with a shared MCP OAuth credential. Selection grants no authority: the server checks each call, and a foreign target returns its refusal with a nonzero exit. MCP OAuth credentials remain limited to MCP and cannot use REST commands. The raw `proofline mcp` bridge preserves the caller's messages and per-call target unchanged. diff --git a/src/agent.rs b/src/agent.rs index c9629d2..e1851c3 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -48,6 +48,7 @@ enum Client { Cursor, Gemini, Kiro, + Windsurf, } impl Client { @@ -58,6 +59,7 @@ impl Client { Self::Cursor => ".cursor/mcp.json", Self::Gemini => ".gemini/settings.json", Self::Kiro => ".kiro/settings/mcp.json", + Self::Windsurf => ".codeium/windsurf/mcp_config.json", } } } @@ -70,6 +72,7 @@ impl fmt::Display for Client { Self::Cursor => "Cursor", Self::Gemini => "Gemini CLI", Self::Kiro => "Kiro", + Self::Windsurf => "Windsurf", }) } } diff --git a/src/agent/config.rs b/src/agent/config.rs index 43b20c6..49450b0 100644 --- a/src/agent/config.rs +++ b/src/agent/config.rs @@ -46,7 +46,7 @@ pub(super) fn prepare( ) -> Result { match client { Client::Codex => codex(original, origin), - Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => { + Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro | Client::Windsurf => { json(client, original, origin) } } diff --git a/src/agent/tests.rs b/src/agent/tests.rs index 8a67e1d..c5bdbed 100644 --- a/src/agent/tests.rs +++ b/src/agent/tests.rs @@ -19,12 +19,13 @@ use crate::origin::Origin; use crate::{Cli, Command as CliCommand}; const PRIVATE: &str = "installer-private-config-canary"; -const CLIENTS: [Client; 5] = [ +const CLIENTS: [Client; 6] = [ Client::ClaudeCode, Client::Codex, Client::Cursor, Client::Gemini, Client::Kiro, + Client::Windsurf, ]; #[derive(Debug)] @@ -95,7 +96,11 @@ fn configuration(client: Client) -> Vec { Client::Codex => format!( "# keep this comment\nmodel = \"chosen-model\"\nlabels = [\"one\", \"two\"]\n\n[mcp_servers.other]\ncommand = \"other-server\"\nargs = [\"a b\"]\n\n[mcp_servers.other.env]\nSECRET = \"{PRIVATE}\"\n" ).into_bytes(), - Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => serde_json::to_vec_pretty(&json!({ + Client::ClaudeCode + | Client::Cursor + | Client::Gemini + | Client::Kiro + | Client::Windsurf => serde_json::to_vec_pretty(&json!({ "theme": "chosen-theme", "policy": {"trust": false, "autoApprove": [], "excluded": ["untrusted"]}, "mcpServers": { @@ -191,7 +196,11 @@ fn all_clients_preserve_private_settings_and_add_only_the_launcher() { assert_eq!(server.as_table().unwrap().len(), 2); assert_eq!(parsed, expected); } - Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => { + Client::ClaudeCode + | Client::Cursor + | Client::Gemini + | Client::Kiro + | Client::Windsurf => { let expected: Value = serde_json::from_slice(&original).unwrap(); let mut parsed: Value = serde_json::from_str(&actual).unwrap(); let server = parsed["mcpServers"] @@ -308,7 +317,11 @@ fn custom_existing_entries_and_codex_home_are_never_overwritten() { let home = TempDir::new().unwrap(); let original = match client { Client::Codex => format!("# {PRIVATE}\nmcp_servers.proofline = {{ command = \"custom-launcher\", args = [\"custom\"] }}\n").into_bytes(), - Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => format!("{{\"mcpServers\":{{\"proofline\":null}},\"private\":\"{PRIVATE}\"}}").into_bytes(), + Client::ClaudeCode + | Client::Cursor + | Client::Gemini + | Client::Kiro + | Client::Windsurf => format!("{{\"mcpServers\":{{\"proofline\":null}},\"private\":\"{PRIVATE}\"}}").into_bytes(), }; let path = seed(home.path(), client, &original); let modified = fs::metadata(&path).unwrap().modified().unwrap(); @@ -416,6 +429,7 @@ fn toml_inline_tables_and_separate_arguments_round_trip_in_unicode_homes() { Client::Cursor, Client::Gemini, Client::Kiro, + Client::Windsurf, ] { let precision = "{\"mcpServers\":{\"other\":{\"value\":184467440737095516170}},\"precision\":1.2345678901234567890123456789}"; seed(&home, client, precision.as_bytes()); @@ -698,7 +712,11 @@ fn invalid_duplicate_oversized_and_readonly_documents_stay_private_and_intact() "mcp_servers = 42\n".to_owned(), "mcp_servers = []\nmcp_servers = {}\n".to_owned(), ], - Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => vec![ + Client::ClaudeCode + | Client::Cursor + | Client::Gemini + | Client::Kiro + | Client::Windsurf => vec![ format!("{{\"private\":\"{PRIVATE}\", \"unfinished\": "), "[]".to_owned(), "{\"mcpServers\": []}".to_owned(),