feat: add setting to enable/disable MCP server creation

- Add enableMcpServerCreation setting to control whether MCP server creation is allowed
- Add UI toggle in settings view for this feature
- Update system prompt to conditionally include MCP server creation documentation
- Add tests for new functionality
This commit is contained in:
sam hoang
2025-02-01 09:34:53 +07:00
parent 8ce5f9a890
commit f906755d90
12 changed files with 1263 additions and 12 deletions

View File

@@ -61,6 +61,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
setExperimentEnabled,
alwaysAllowModeSwitch,
setAlwaysAllowModeSwitch,
enableMcpServerCreation,
setEnableMcpServerCreation,
} = useExtensionState()
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
const [modelIdErrorMessage, setModelIdErrorMessage] = useState<string | undefined>(undefined)
@@ -108,6 +110,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
})
vscode.postMessage({ type: "alwaysAllowModeSwitch", bool: alwaysAllowModeSwitch })
vscode.postMessage({ type: "enableMcpServerCreation", bool: enableMcpServerCreation })
onDone()
}
}
@@ -357,6 +360,17 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
</p>
</div>
<div style={{ marginBottom: 5 }}>
<VSCodeCheckbox
checked={enableMcpServerCreation}
onChange={(e: any) => setEnableMcpServerCreation(e.target.checked)}>
<span style={{ fontWeight: "500" }}>Enable MCP Server Creation</span>
</VSCodeCheckbox>
<p style={{ fontSize: "12px", marginTop: "5px", color: "var(--vscode-descriptionForeground)" }}>
This option allow user to enable and disable MCP server creation for saved tokens usage
</p>
</div>
<div style={{ marginBottom: 15 }}>
<VSCodeCheckbox
checked={alwaysAllowModeSwitch}