Skip to main content

lean_ctx/core/
client_constraints.rs

1#[derive(Debug, Clone, Copy)]
2pub struct ClientConstraints {
3    pub id: &'static str,
4    pub display_name: &'static str,
5    /// Max chars accepted by MCP `instructions` field, if documented.
6    pub mcp_instructions_max_chars: Option<usize>,
7    /// Whether the client documents `autoApprove` in its MCP config schema.
8    pub supports_auto_approve: bool,
9}
10
11// Keep this aligned with `docs/integrations/client-constraints-matrix-v1.md`.
12pub const ALL_CLIENTS: &[ClientConstraints] = &[
13    ClientConstraints {
14        id: "cursor",
15        display_name: "Cursor",
16        mcp_instructions_max_chars: None,
17        supports_auto_approve: true,
18    },
19    ClientConstraints {
20        id: "claude-code",
21        display_name: "Claude Code",
22        mcp_instructions_max_chars: Some(2048),
23        supports_auto_approve: false,
24    },
25    ClientConstraints {
26        id: "vscode-copilot",
27        display_name: "VS Code / GitHub Copilot",
28        mcp_instructions_max_chars: None,
29        supports_auto_approve: false,
30    },
31    ClientConstraints {
32        id: "windsurf",
33        display_name: "Windsurf",
34        mcp_instructions_max_chars: None,
35        supports_auto_approve: false,
36    },
37    ClientConstraints {
38        id: "zed",
39        display_name: "Zed",
40        mcp_instructions_max_chars: None,
41        supports_auto_approve: false,
42    },
43    ClientConstraints {
44        id: "jetbrains",
45        display_name: "JetBrains IDEs",
46        mcp_instructions_max_chars: None,
47        supports_auto_approve: false,
48    },
49    ClientConstraints {
50        id: "opencode",
51        display_name: "OpenCode",
52        mcp_instructions_max_chars: None,
53        supports_auto_approve: false,
54    },
55    ClientConstraints {
56        id: "crush",
57        display_name: "Crush",
58        mcp_instructions_max_chars: None,
59        supports_auto_approve: false,
60    },
61    ClientConstraints {
62        id: "amp",
63        display_name: "Amp",
64        mcp_instructions_max_chars: None,
65        supports_auto_approve: false,
66    },
67    ClientConstraints {
68        id: "hermes",
69        display_name: "Hermes Agent",
70        mcp_instructions_max_chars: None,
71        supports_auto_approve: false,
72    },
73    ClientConstraints {
74        id: "kiro",
75        display_name: "AWS Kiro",
76        mcp_instructions_max_chars: None,
77        supports_auto_approve: true,
78    },
79    ClientConstraints {
80        id: "amazonq",
81        display_name: "Amazon Q Developer",
82        mcp_instructions_max_chars: None,
83        supports_auto_approve: false,
84    },
85    ClientConstraints {
86        id: "gemini-cli",
87        display_name: "Gemini CLI",
88        mcp_instructions_max_chars: None,
89        supports_auto_approve: false,
90    },
91    ClientConstraints {
92        id: "antigravity",
93        display_name: "Antigravity",
94        mcp_instructions_max_chars: None,
95        supports_auto_approve: false,
96    },
97    ClientConstraints {
98        id: "codex",
99        display_name: "Codex CLI",
100        mcp_instructions_max_chars: None,
101        supports_auto_approve: false,
102    },
103    ClientConstraints {
104        id: "trae",
105        display_name: "Trae",
106        mcp_instructions_max_chars: None,
107        supports_auto_approve: false,
108    },
109    ClientConstraints {
110        id: "qwen-code",
111        display_name: "Qwen Code",
112        mcp_instructions_max_chars: None,
113        supports_auto_approve: false,
114    },
115    ClientConstraints {
116        id: "verdent",
117        display_name: "Verdent",
118        mcp_instructions_max_chars: None,
119        supports_auto_approve: false,
120    },
121    ClientConstraints {
122        id: "pi",
123        display_name: "Pi Coding Agent",
124        mcp_instructions_max_chars: None,
125        supports_auto_approve: false,
126    },
127    ClientConstraints {
128        id: "cline",
129        display_name: "Cline",
130        mcp_instructions_max_chars: None,
131        supports_auto_approve: false,
132    },
133    ClientConstraints {
134        id: "roo",
135        display_name: "Roo Code",
136        mcp_instructions_max_chars: None,
137        supports_auto_approve: false,
138    },
139];
140
141pub fn by_client_id(id: &str) -> Option<&'static ClientConstraints> {
142    let id = id.trim();
143    ALL_CLIENTS.iter().find(|c| c.id == id)
144}
145
146pub fn by_editor_name(name: &str) -> Option<&'static ClientConstraints> {
147    match name {
148        "Cursor" => by_client_id("cursor"),
149        "Claude Code" => by_client_id("claude-code"),
150        "VS Code / Copilot" => by_client_id("vscode-copilot"),
151        "Windsurf" => by_client_id("windsurf"),
152        "Zed" => by_client_id("zed"),
153        "JetBrains IDEs" => by_client_id("jetbrains"),
154        "OpenCode" => by_client_id("opencode"),
155        "Crush" => by_client_id("crush"),
156        "Amp" => by_client_id("amp"),
157        "Hermes Agent" => by_client_id("hermes"),
158        "AWS Kiro" => by_client_id("kiro"),
159        "Amazon Q Developer" => by_client_id("amazonq"),
160        "Gemini CLI" => by_client_id("gemini-cli"),
161        "Antigravity" => by_client_id("antigravity"),
162        "Codex CLI" => by_client_id("codex"),
163        "Trae" => by_client_id("trae"),
164        "Qwen Code" => by_client_id("qwen-code"),
165        "Verdent" => by_client_id("verdent"),
166        "Pi Coding Agent" => by_client_id("pi"),
167        "Cline" => by_client_id("cline"),
168        "Roo Code" => by_client_id("roo"),
169        _ => None,
170    }
171}