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: "codebuddy",
27        display_name: "CodeBuddy",
28        mcp_instructions_max_chars: Some(2048),
29        supports_auto_approve: false,
30    },
31    ClientConstraints {
32        id: "vscode-copilot",
33        display_name: "VS Code / GitHub Copilot",
34        mcp_instructions_max_chars: None,
35        supports_auto_approve: false,
36    },
37    ClientConstraints {
38        id: "windsurf",
39        display_name: "Windsurf",
40        mcp_instructions_max_chars: None,
41        supports_auto_approve: false,
42    },
43    ClientConstraints {
44        id: "zed",
45        display_name: "Zed",
46        mcp_instructions_max_chars: None,
47        supports_auto_approve: false,
48    },
49    ClientConstraints {
50        id: "jetbrains",
51        display_name: "JetBrains IDEs",
52        mcp_instructions_max_chars: None,
53        supports_auto_approve: false,
54    },
55    ClientConstraints {
56        id: "opencode",
57        display_name: "OpenCode",
58        mcp_instructions_max_chars: None,
59        supports_auto_approve: false,
60    },
61    ClientConstraints {
62        id: "crush",
63        display_name: "Crush",
64        mcp_instructions_max_chars: None,
65        supports_auto_approve: false,
66    },
67    ClientConstraints {
68        id: "amp",
69        display_name: "Amp",
70        mcp_instructions_max_chars: None,
71        supports_auto_approve: false,
72    },
73    ClientConstraints {
74        id: "hermes",
75        display_name: "Hermes Agent",
76        mcp_instructions_max_chars: None,
77        supports_auto_approve: false,
78    },
79    ClientConstraints {
80        id: "kiro",
81        display_name: "AWS Kiro",
82        mcp_instructions_max_chars: None,
83        supports_auto_approve: true,
84    },
85    ClientConstraints {
86        id: "amazonq",
87        display_name: "Amazon Q Developer",
88        mcp_instructions_max_chars: None,
89        supports_auto_approve: false,
90    },
91    ClientConstraints {
92        id: "gemini-cli",
93        display_name: "Gemini CLI",
94        mcp_instructions_max_chars: None,
95        supports_auto_approve: false,
96    },
97    ClientConstraints {
98        id: "antigravity",
99        display_name: "Antigravity",
100        mcp_instructions_max_chars: None,
101        supports_auto_approve: false,
102    },
103    ClientConstraints {
104        id: "codex",
105        display_name: "Codex CLI",
106        mcp_instructions_max_chars: None,
107        supports_auto_approve: false,
108    },
109    ClientConstraints {
110        id: "grok",
111        display_name: "Grok",
112        mcp_instructions_max_chars: None,
113        supports_auto_approve: false,
114    },
115    ClientConstraints {
116        id: "trae",
117        display_name: "Trae",
118        mcp_instructions_max_chars: None,
119        supports_auto_approve: false,
120    },
121    ClientConstraints {
122        id: "qwen-code",
123        display_name: "Qwen Code",
124        mcp_instructions_max_chars: None,
125        supports_auto_approve: false,
126    },
127    ClientConstraints {
128        id: "verdent",
129        display_name: "Verdent",
130        mcp_instructions_max_chars: None,
131        supports_auto_approve: false,
132    },
133    ClientConstraints {
134        id: "pi",
135        display_name: "Pi Coding Agent",
136        mcp_instructions_max_chars: None,
137        supports_auto_approve: false,
138    },
139    ClientConstraints {
140        id: "cline",
141        display_name: "Cline",
142        mcp_instructions_max_chars: None,
143        supports_auto_approve: false,
144    },
145    ClientConstraints {
146        id: "roo",
147        display_name: "Roo Code",
148        mcp_instructions_max_chars: None,
149        supports_auto_approve: false,
150    },
151];
152
153pub fn by_client_id(id: &str) -> Option<&'static ClientConstraints> {
154    let id = id.trim();
155    ALL_CLIENTS.iter().find(|c| c.id == id)
156}
157
158pub fn by_editor_name(name: &str) -> Option<&'static ClientConstraints> {
159    match name {
160        "Cursor" => by_client_id("cursor"),
161        "Claude Code" => by_client_id("claude-code"),
162        "VS Code" => by_client_id("vscode-copilot"),
163        "Copilot CLI" => by_client_id("copilot-cli"),
164        "Windsurf" => by_client_id("windsurf"),
165        "Zed" => by_client_id("zed"),
166        "JetBrains IDEs" => by_client_id("jetbrains"),
167        "OpenCode" => by_client_id("opencode"),
168        "Crush" => by_client_id("crush"),
169        "Amp" => by_client_id("amp"),
170        "Hermes Agent" => by_client_id("hermes"),
171        "AWS Kiro" => by_client_id("kiro"),
172        "Amazon Q Developer" => by_client_id("amazonq"),
173        "Gemini CLI" => by_client_id("gemini-cli"),
174        "Antigravity" => by_client_id("antigravity"),
175        "Codex CLI" => by_client_id("codex"),
176        "Grok" => by_client_id("grok"),
177        "Trae" => by_client_id("trae"),
178        "Qwen Code" => by_client_id("qwen-code"),
179        "Verdent" => by_client_id("verdent"),
180        "Pi Coding Agent" => by_client_id("pi"),
181        "Cline" => by_client_id("cline"),
182        "Roo Code" => by_client_id("roo"),
183        _ => None,
184    }
185}