@@ -34,6 +34,38 @@ type ClientClaudeCodeProps = {
3434 mcpServer : MCPServer ;
3535} ;
3636
37+ // Single source of truth for the scope picker: drives the Select's `items` (so
38+ // `<SelectValue>` resolves the label without flashing the raw value), the
39+ // rendered `<SelectItem>`s, the config file shown in step 4, and the help text.
40+ const SCOPE_OPTIONS = [
41+ {
42+ value : 'local' ,
43+ label : 'Local' ,
44+ configFile : '~/.claude.json' ,
45+ description : 'Configuration stored locally for this project only' ,
46+ } ,
47+ {
48+ value : 'user' ,
49+ label : 'User' ,
50+ configFile : '~/.claude.json' ,
51+ description : (
52+ < Text as = "span" >
53+ Configuration available across all your projects in < InlineCode > ~/.claude.json</ InlineCode >
54+ </ Text >
55+ ) ,
56+ } ,
57+ {
58+ value : 'project' ,
59+ label : 'Project' ,
60+ configFile : '.mcp.json' ,
61+ description : (
62+ < Text as = "span" >
63+ Configuration shared with team using < InlineCode > .mcp.json</ InlineCode > file in project
64+ </ Text >
65+ ) ,
66+ } ,
67+ ] as const ;
68+
3769export const ClientClaudeCode = ( { mcpServer } : ClientClaudeCodeProps ) => {
3870 const [ selectedScope , setSelectedScope ] = useState < string > ( 'local' ) ;
3971
@@ -56,6 +88,8 @@ export const ClientClaudeCode = ({ mcpServer }: ClientClaudeCodeProps) => {
5688 isServerless : config . isServerless ,
5789 } ) ;
5890
91+ const selectedScopeOption = SCOPE_OPTIONS . find ( ( option ) => option . value === selectedScope ) ;
92+
5993 return (
6094 < div className = "space-y-4" >
6195 < div className = "flex flex-col gap-4" >
@@ -74,36 +108,24 @@ export const ClientClaudeCode = ({ mcpServer }: ClientClaudeCodeProps) => {
74108 </ div >
75109 < Label className = "font-medium text-sm" > Scope</ Label >
76110 < div >
77- < Select
78- items = { { local : 'Local' , user : 'User' , project : 'Project' } }
79- onValueChange = { setSelectedScope }
80- value = { selectedScope }
81- >
111+ < Select items = { SCOPE_OPTIONS } onValueChange = { setSelectedScope } value = { selectedScope } >
82112 < SelectTrigger className = "w-[180px]" >
83113 < SelectValue placeholder = "Select scope" />
84114 </ SelectTrigger >
85115 < SelectContent >
86116 < SelectGroup >
87117 < SelectLabel > Configuration Scope</ SelectLabel >
88- < SelectItem value = "local" > Local</ SelectItem >
89- < SelectItem value = "user" > User</ SelectItem >
90- < SelectItem value = "project" > Project</ SelectItem >
118+ { SCOPE_OPTIONS . map ( ( option ) => (
119+ < SelectItem key = { option . value } value = { option . value } >
120+ { option . label }
121+ </ SelectItem >
122+ ) ) }
91123 </ SelectGroup >
92124 </ SelectContent >
93125 </ Select >
94126 </ div >
95127 < Text className = "text-muted-foreground" variant = "small" >
96- { selectedScope === 'local' && 'Configuration stored locally for this project only' }
97- { selectedScope === 'project' && (
98- < Text as = "span" >
99- Configuration shared with team using < InlineCode > .mcp.json</ InlineCode > file in project
100- </ Text >
101- ) }
102- { selectedScope === 'user' && (
103- < Text as = "span" >
104- Configuration available across all your projects in < InlineCode > ~/.claude.json</ InlineCode >
105- </ Text >
106- ) }
128+ { selectedScopeOption ?. description }
107129 </ Text >
108130 </ div >
109131 </ ListItem >
@@ -116,9 +138,7 @@ export const ClientClaudeCode = ({ mcpServer }: ClientClaudeCodeProps) => {
116138 < ListItem >
117139 < div className = "flex flex-wrap items-center gap-1" >
118140 < span > Alternatively, you can manually update</ span >
119- { selectedScope === 'local' && < InlineCode className = "whitespace-nowrap" > ~/.claude.json</ InlineCode > }
120- { selectedScope === 'user' && < InlineCode className = "whitespace-nowrap" > ~/.claude.json</ InlineCode > }
121- { selectedScope === 'project' && < InlineCode className = "whitespace-nowrap" > .mcp.json</ InlineCode > }
141+ < InlineCode className = "whitespace-nowrap" > { selectedScopeOption ?. configFile } </ InlineCode >
122142 < span > with:</ span >
123143 </ div >
124144 < DynamicCodeBlock code = { claudeCodeConfigJson } lang = "json" />
0 commit comments