feat: configure built-in MCP access
Built-in MCP servers were always granted to supported runtimes without per-server controls. They now have persistent enablement and runtime assignments for direct models, managed OpenCode, and Continue, while DeepSeek Harness remains visibly unsupported and cannot be assigned. MCP settings are reorganized into Built-in MCP, Direct model, Custom MCP, and Computer control tabs. Direct-model web search now uses the same accessible collapsible inventory pattern as other tool groups. Release note: 内置 MCP 现在可分别启停并分配给直连模型、OpenCode 和 Continue;MCP 设置分类与直连模型工具列表也更清晰,DeepSeek Harness 会明确显示为暂不支持。
This commit is contained in:
@@ -474,6 +474,14 @@ const api: DesktopApi = {
|
||||
skills: [],
|
||||
mcpServers: []
|
||||
})),
|
||||
setBuiltinMcpServerEnabled: vi.fn(async () => ({
|
||||
skills: [],
|
||||
mcpServers: []
|
||||
})),
|
||||
setBuiltinMcpServerAssignments: vi.fn(async () => ({
|
||||
skills: [],
|
||||
mcpServers: []
|
||||
})),
|
||||
saveMcpServer: vi.fn(async () => ({
|
||||
skills: [],
|
||||
mcpServers: []
|
||||
|
||||
@@ -19,6 +19,7 @@ import { useTranslation } from 'react-i18next'
|
||||
import { builtinMcpServers } from '../../shared/builtin-mcp-servers'
|
||||
import { builtinModelToolGroups } from '../../shared/builtin-model-tools'
|
||||
import type {
|
||||
BuiltinMcpServerId,
|
||||
CapabilityDiagnosticReport,
|
||||
CapabilityAssignments,
|
||||
CapabilitySnapshot,
|
||||
@@ -43,7 +44,11 @@ const configurableMcpTargets: RuntimeTarget[] = [
|
||||
'continue',
|
||||
'deepseek-harness'
|
||||
]
|
||||
type McpSettingsTab = 'builtin' | 'computer' | 'custom'
|
||||
type McpSettingsTab =
|
||||
| 'builtin'
|
||||
| 'custom'
|
||||
| 'model-tools'
|
||||
| 'computer'
|
||||
|
||||
type McpEditor = {
|
||||
id?: string
|
||||
@@ -342,6 +347,23 @@ export function McpSettingsSection({
|
||||
})
|
||||
}
|
||||
|
||||
const updateBuiltinAssignment = (
|
||||
serverId: BuiltinMcpServerId,
|
||||
assignments: CapabilityAssignments,
|
||||
target: RuntimeTarget,
|
||||
checked: boolean
|
||||
): void => {
|
||||
const next = checked
|
||||
? [...assignments, target]
|
||||
: assignments.filter((item) => item !== target)
|
||||
void run(`builtin:assign:${serverId}`, () =>
|
||||
window.goodbuddy.capabilities.setBuiltinMcpServerAssignments(
|
||||
serverId,
|
||||
next
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
const openEditor = (
|
||||
nextEditor: McpEditor,
|
||||
trigger: HTMLButtonElement
|
||||
@@ -374,11 +396,8 @@ export function McpSettingsSection({
|
||||
}
|
||||
|
||||
const computerCapabilities = snapshot?.computerCapabilities ?? []
|
||||
const visibleComputerCapabilities = computerCapabilities.filter(
|
||||
(capability) =>
|
||||
activeTab === 'builtin'
|
||||
? capability.id === 'host-browser-control'
|
||||
: capability.id !== 'host-browser-control'
|
||||
const builtinMcpStates = new Map(
|
||||
snapshot?.builtinMcpServers?.map((server) => [server.id, server])
|
||||
)
|
||||
const browserProfiles = snapshot?.browserProfiles ?? {
|
||||
profiles: [],
|
||||
@@ -414,24 +433,43 @@ export function McpSettingsSection({
|
||||
headingId="mcp-settings-heading"
|
||||
/>
|
||||
<SettingsWarningList warnings={snapshot?.warnings} />
|
||||
<PageTabs
|
||||
ariaLabel={t('mcp.tabs.ariaLabel')}
|
||||
idPrefix="mcp-settings"
|
||||
onChange={(tab) => {
|
||||
setError(undefined)
|
||||
setActiveTab(tab)
|
||||
}}
|
||||
tabs={[
|
||||
{ id: 'builtin', label: t('mcp.tabs.builtin') },
|
||||
{ id: 'computer', label: t('mcp.tabs.computer') },
|
||||
{ id: 'custom', label: t('mcp.tabs.custom') }
|
||||
]}
|
||||
value={activeTab}
|
||||
variant="segmented"
|
||||
/>
|
||||
<div className="mcp-settings__tabs">
|
||||
<PageTabs
|
||||
ariaLabel={t('mcp.tabs.ariaLabel')}
|
||||
idPrefix="mcp-settings"
|
||||
onChange={(tab) => {
|
||||
setError(undefined)
|
||||
setActiveTab(tab)
|
||||
}}
|
||||
tabs={[
|
||||
{
|
||||
id: 'builtin',
|
||||
icon: <Database size={14} />,
|
||||
label: t('mcp.tabs.builtin')
|
||||
},
|
||||
{
|
||||
id: 'model-tools',
|
||||
icon: <Wrench size={14} />,
|
||||
label: t('mcp.tabs.modelTools')
|
||||
},
|
||||
{
|
||||
id: 'custom',
|
||||
icon: <Network size={14} />,
|
||||
label: t('mcp.tabs.custom')
|
||||
},
|
||||
{
|
||||
id: 'computer',
|
||||
icon: <MonitorCog size={14} />,
|
||||
label: t('mcp.tabs.computer')
|
||||
}
|
||||
]}
|
||||
value={activeTab}
|
||||
variant="segmented"
|
||||
/>
|
||||
</div>
|
||||
<section
|
||||
aria-labelledby={`mcp-settings-tab-${activeTab}`}
|
||||
className="settings-section"
|
||||
className="settings-section mcp-settings__panel"
|
||||
id={`mcp-settings-panel-${activeTab}`}
|
||||
role="tabpanel"
|
||||
>
|
||||
@@ -446,36 +484,24 @@ export function McpSettingsSection({
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{activeTab !== 'custom' && (
|
||||
{activeTab === 'computer' && (
|
||||
<section
|
||||
aria-labelledby="computer-capabilities-heading"
|
||||
className="mcp-tool-section"
|
||||
>
|
||||
<div className="mcp-subsection-heading">
|
||||
<div>
|
||||
{activeTab === 'builtin' ? (
|
||||
<Globe2 size={15} />
|
||||
) : (
|
||||
<MonitorCog size={15} />
|
||||
)}
|
||||
<MonitorCog size={15} />
|
||||
<strong id="computer-capabilities-heading">
|
||||
{t(
|
||||
activeTab === 'builtin'
|
||||
? 'mcp.computer.browserTitle'
|
||||
: 'mcp.computer.title'
|
||||
)}
|
||||
{t('mcp.computer.title')}
|
||||
</strong>
|
||||
</div>
|
||||
<small>
|
||||
{t(
|
||||
activeTab === 'builtin'
|
||||
? 'mcp.computer.browserSubtitle'
|
||||
: 'mcp.computer.subtitle'
|
||||
)}
|
||||
{t('mcp.computer.subtitle')}
|
||||
</small>
|
||||
</div>
|
||||
<div className="capability-list">
|
||||
{visibleComputerCapabilities.map((capability) => {
|
||||
{computerCapabilities.map((capability) => {
|
||||
const report = diagnostics[capability.id]
|
||||
return (
|
||||
<article className="capability-card" key={capability.id}>
|
||||
@@ -601,8 +627,7 @@ export function McpSettingsSection({
|
||||
</section>
|
||||
)}
|
||||
|
||||
{activeTab === 'builtin' && (
|
||||
<>
|
||||
{activeTab === 'computer' && (
|
||||
<section
|
||||
aria-labelledby="browser-profiles-heading"
|
||||
className="mcp-tool-section"
|
||||
@@ -748,7 +773,9 @@ export function McpSettingsSection({
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{activeTab === 'builtin' && (
|
||||
<section
|
||||
aria-labelledby="builtin-mcp-heading"
|
||||
className="mcp-tool-section"
|
||||
@@ -777,16 +804,126 @@ export function McpSettingsSection({
|
||||
const expansionId = `builtin:${server.id}`
|
||||
const expanded = expandedItemIds.has(expansionId)
|
||||
const panelId = `mcp-server-tools-${server.id}`
|
||||
const enabled =
|
||||
const state = builtinMcpStates.get(server.id) ?? {
|
||||
id: server.id,
|
||||
enabled: true,
|
||||
assignments:
|
||||
[...server.supportedAssignments] as CapabilityAssignments
|
||||
}
|
||||
const featureAvailable =
|
||||
!('requiresFeature' in server) ||
|
||||
magicNotesEnabled === true
|
||||
return (
|
||||
<article
|
||||
className={`mcp-server-card${
|
||||
enabled ? '' : ' mcp-server-card--disabled'
|
||||
className={`capability-card builtin-mcp-card${
|
||||
state.enabled && featureAvailable
|
||||
? ''
|
||||
: ' capability-card--disabled'
|
||||
}`}
|
||||
key={server.id}
|
||||
>
|
||||
<div className="capability-card__header">
|
||||
<div>
|
||||
<strong>{server.name}</strong>
|
||||
<small>
|
||||
{!state.enabled
|
||||
? t('mcp.builtin.disabled')
|
||||
: !featureAvailable
|
||||
? t('mcp.builtin.serverSummaryDisabled')
|
||||
: server.access === 'mixed'
|
||||
? t('mcp.builtin.serverSummaryMixed')
|
||||
: t('mcp.builtin.serverSummaryReadOnly')}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<label className="toggle-row">
|
||||
<input
|
||||
aria-label={t('mcp.builtin.enableAriaLabel', {
|
||||
name: server.name
|
||||
})}
|
||||
checked={state.enabled}
|
||||
disabled={Boolean(busy)}
|
||||
onChange={(event) =>
|
||||
void run(`builtin:toggle:${server.id}`, () =>
|
||||
window.goodbuddy.capabilities.setBuiltinMcpServerEnabled(
|
||||
server.id,
|
||||
event.target.checked
|
||||
)
|
||||
)
|
||||
}
|
||||
role="switch"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span>
|
||||
{state.enabled
|
||||
? t('mcp.builtin.enabled')
|
||||
: t('mcp.builtin.disabled')}
|
||||
</span>
|
||||
</label>
|
||||
<p>{server.description}</p>
|
||||
{!featureAvailable && (
|
||||
<p className="computer-capability-risk">
|
||||
<CircleAlert aria-hidden="true" size={13} />
|
||||
{t('mcp.builtin.featureDisabled')}
|
||||
</p>
|
||||
)}
|
||||
<div className="runtime-assignments">
|
||||
<small>{t('mcp.builtin.assignedTo')}</small>
|
||||
{configurableMcpTargets.map((target) => {
|
||||
const unsupported =
|
||||
!server.supportedAssignments.some(
|
||||
(supportedTarget) =>
|
||||
supportedTarget === target
|
||||
)
|
||||
return (
|
||||
<label
|
||||
className={
|
||||
unsupported
|
||||
? 'runtime-assignment--unsupported'
|
||||
: undefined
|
||||
}
|
||||
key={target}
|
||||
title={
|
||||
unsupported
|
||||
? t('mcp.builtin.runtimeUnsupported')
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={
|
||||
unsupported
|
||||
? t(
|
||||
'mcp.builtin.runtimeAssignmentUnsupportedAriaLabel',
|
||||
{
|
||||
name: server.name,
|
||||
runtime: runtimeLabels[target]
|
||||
}
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
checked={
|
||||
!unsupported &&
|
||||
state.assignments.includes(target)
|
||||
}
|
||||
disabled={Boolean(busy) || unsupported}
|
||||
onChange={(event) =>
|
||||
updateBuiltinAssignment(
|
||||
server.id,
|
||||
state.assignments,
|
||||
target,
|
||||
event.target.checked
|
||||
)
|
||||
}
|
||||
type="checkbox"
|
||||
/>
|
||||
{runtimeLabels[target]}
|
||||
{unsupported
|
||||
? t('mcp.builtin.unsupportedSuffix')
|
||||
: ''}
|
||||
</label>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<button
|
||||
aria-controls={panelId}
|
||||
aria-expanded={expanded}
|
||||
@@ -796,43 +933,28 @@ export function McpSettingsSection({
|
||||
: 'mcp.builtin.expandServer',
|
||||
{ name: server.name }
|
||||
)}
|
||||
className="mcp-server-card__toggle"
|
||||
className="secondary-button builtin-mcp-card__details"
|
||||
onClick={() => toggleItem(expansionId)}
|
||||
type="button"
|
||||
>
|
||||
<div>
|
||||
<strong>{server.name}</strong>
|
||||
<small>
|
||||
{!enabled
|
||||
? t('mcp.builtin.serverSummaryDisabled')
|
||||
: server.access === 'mixed'
|
||||
? t('mcp.builtin.serverSummaryMixed')
|
||||
: t('mcp.builtin.serverSummaryReadOnly')}
|
||||
</small>
|
||||
</div>
|
||||
<span className="mcp-server-card__summary">
|
||||
{t('mcp.builtin.toolCount', {
|
||||
count: server.tools.length
|
||||
})}
|
||||
<ChevronDown
|
||||
aria-hidden="true"
|
||||
className={
|
||||
expanded
|
||||
? 'mcp-server-card__chevron mcp-server-card__chevron--expanded'
|
||||
: 'mcp-server-card__chevron'
|
||||
}
|
||||
size={15}
|
||||
/>
|
||||
</span>
|
||||
{t('mcp.builtin.toolCount', {
|
||||
count: server.tools.length
|
||||
})}
|
||||
<ChevronDown
|
||||
aria-hidden="true"
|
||||
className={
|
||||
expanded
|
||||
? 'mcp-server-card__chevron mcp-server-card__chevron--expanded'
|
||||
: 'mcp-server-card__chevron'
|
||||
}
|
||||
size={15}
|
||||
/>
|
||||
</button>
|
||||
{expanded && (
|
||||
<div className="mcp-server-card__body" id={panelId}>
|
||||
{!enabled && (
|
||||
<p className="mcp-server-card__disabled-notice">
|
||||
{t('mcp.builtin.featureDisabled')}
|
||||
</p>
|
||||
)}
|
||||
<p>{server.description}</p>
|
||||
<div
|
||||
className="builtin-mcp-card__tools"
|
||||
id={panelId}
|
||||
>
|
||||
<section
|
||||
aria-label={t('mcp.builtin.toolsAriaLabel', {
|
||||
name: server.name
|
||||
@@ -870,7 +992,9 @@ export function McpSettingsSection({
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{activeTab === 'model-tools' && (
|
||||
<div className="mcp-tool-section">
|
||||
<div className="mcp-subsection-heading">
|
||||
<div>
|
||||
@@ -884,89 +1008,142 @@ export function McpSettingsSection({
|
||||
</small>
|
||||
</div>
|
||||
<div className="mcp-server-list">
|
||||
<article className="capability-card">
|
||||
<div className="capability-card__header">
|
||||
<div>
|
||||
<strong>{t('mcp.webSearch.title')}</strong>
|
||||
<small>{t('mcp.webSearch.subtitle')}</small>
|
||||
</div>
|
||||
</div>
|
||||
<label className="toggle-row">
|
||||
<input
|
||||
aria-label={t('mcp.webSearch.enableAriaLabel')}
|
||||
checked={webSearch.enabled}
|
||||
disabled={Boolean(busy)}
|
||||
onChange={(event) =>
|
||||
void run('web-search:toggle', () =>
|
||||
window.goodbuddy.capabilities.setWebSearchEnabled?.(
|
||||
event.target.checked
|
||||
) ??
|
||||
Promise.reject(
|
||||
new Error(t('mcp.webSearch.unsupported'))
|
||||
)
|
||||
)
|
||||
}
|
||||
role="switch"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span>
|
||||
{webSearch.enabled
|
||||
? t('mcp.webSearch.enabled')
|
||||
: t('mcp.webSearch.disabled')}
|
||||
</span>
|
||||
</label>
|
||||
<p>{t('mcp.webSearch.description')}</p>
|
||||
<p className="computer-capability-risk">
|
||||
<CircleAlert aria-hidden="true" size={13} />
|
||||
{t('mcp.webSearch.privacy')}
|
||||
</p>
|
||||
<div className="capability-card__actions">
|
||||
<button
|
||||
className="secondary-button"
|
||||
disabled={Boolean(busy)}
|
||||
onClick={() => void testDirectModelWebSearch()}
|
||||
type="button"
|
||||
>
|
||||
<FlaskConical aria-hidden="true" size={13} />
|
||||
{busy === 'test:web-search'
|
||||
? t('mcp.webSearch.testing')
|
||||
: t('mcp.webSearch.test')}
|
||||
</button>
|
||||
</div>
|
||||
{webSearchTestResult && (
|
||||
<div
|
||||
aria-label={t('mcp.webSearch.resultAriaLabel')}
|
||||
className="capability-diagnostic__result"
|
||||
>
|
||||
<strong>
|
||||
{t('mcp.webSearch.result', {
|
||||
duration: webSearchTestResult.durationMs
|
||||
})}
|
||||
</strong>
|
||||
<p>{webSearchTestResult.preview}</p>
|
||||
</div>
|
||||
)}
|
||||
<section
|
||||
aria-label={t('mcp.webSearch.toolsAriaLabel')}
|
||||
className="mcp-server-tools"
|
||||
>
|
||||
<ul>
|
||||
{builtinModelToolGroups
|
||||
.find((group) => group.id === 'web')
|
||||
?.tools.map((tool) => (
|
||||
<li key={tool.name}>
|
||||
<div>
|
||||
<code>{tool.name}</code>
|
||||
<span className="builtin-tool-badge">
|
||||
{t('mcp.builtin.readOnly')}
|
||||
{builtinModelToolGroups
|
||||
.filter((group) => group.id === 'web')
|
||||
.map((group) => {
|
||||
const expansionId = `model-tools:${group.id}`
|
||||
const expanded = expandedItemIds.has(expansionId)
|
||||
const panelId = `model-tool-group-${group.id}`
|
||||
return (
|
||||
<article className="mcp-server-card" key={group.id}>
|
||||
<button
|
||||
aria-controls={panelId}
|
||||
aria-expanded={expanded}
|
||||
aria-label={t(
|
||||
expanded
|
||||
? 'mcp.modelTools.collapseGroup'
|
||||
: 'mcp.modelTools.expandGroup',
|
||||
{ name: t('mcp.webSearch.title') }
|
||||
)}
|
||||
className="mcp-server-card__toggle"
|
||||
onClick={() => toggleItem(expansionId)}
|
||||
type="button"
|
||||
>
|
||||
<div>
|
||||
<strong>{t('mcp.webSearch.title')}</strong>
|
||||
<small>{t('mcp.webSearch.subtitle')}</small>
|
||||
</div>
|
||||
<span className="mcp-server-card__summary">
|
||||
{t('mcp.builtin.toolCount', {
|
||||
count: group.tools.length
|
||||
})}
|
||||
<ChevronDown
|
||||
aria-hidden="true"
|
||||
className={
|
||||
expanded
|
||||
? 'mcp-server-card__chevron mcp-server-card__chevron--expanded'
|
||||
: 'mcp-server-card__chevron'
|
||||
}
|
||||
size={15}
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
{expanded && (
|
||||
<div className="mcp-server-card__body" id={panelId}>
|
||||
<label className="toggle-row">
|
||||
<input
|
||||
aria-label={t('mcp.webSearch.enableAriaLabel')}
|
||||
checked={webSearch.enabled}
|
||||
disabled={Boolean(busy)}
|
||||
onChange={(event) =>
|
||||
void run('web-search:toggle', () =>
|
||||
window.goodbuddy.capabilities.setWebSearchEnabled?.(
|
||||
event.target.checked
|
||||
) ??
|
||||
Promise.reject(
|
||||
new Error(t('mcp.webSearch.unsupported'))
|
||||
)
|
||||
)
|
||||
}
|
||||
role="switch"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span>
|
||||
{webSearch.enabled
|
||||
? t('mcp.webSearch.enabled')
|
||||
: t('mcp.webSearch.disabled')}
|
||||
</span>
|
||||
</label>
|
||||
<p>{t('mcp.webSearch.description')}</p>
|
||||
<p className="computer-capability-risk">
|
||||
<CircleAlert aria-hidden="true" size={13} />
|
||||
{t('mcp.webSearch.privacy')}
|
||||
</p>
|
||||
<div className="capability-card__actions">
|
||||
<button
|
||||
className="secondary-button"
|
||||
disabled={Boolean(busy)}
|
||||
onClick={() => void testDirectModelWebSearch()}
|
||||
type="button"
|
||||
>
|
||||
<FlaskConical aria-hidden="true" size={13} />
|
||||
{busy === 'test:web-search'
|
||||
? t('mcp.webSearch.testing')
|
||||
: t('mcp.webSearch.test')}
|
||||
</button>
|
||||
</div>
|
||||
<p>{tool.description}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
</article>
|
||||
{webSearchTestResult && (
|
||||
<div
|
||||
aria-label={t(
|
||||
'mcp.webSearch.resultAriaLabel'
|
||||
)}
|
||||
className="capability-diagnostic__result"
|
||||
>
|
||||
<strong>
|
||||
{t('mcp.webSearch.result', {
|
||||
duration:
|
||||
webSearchTestResult.durationMs
|
||||
})}
|
||||
</strong>
|
||||
<p>{webSearchTestResult.preview}</p>
|
||||
</div>
|
||||
)}
|
||||
<section
|
||||
aria-label={t(
|
||||
'mcp.webSearch.toolsAriaLabel'
|
||||
)}
|
||||
className="mcp-server-tools"
|
||||
>
|
||||
<div className="mcp-server-tools__heading">
|
||||
<strong>{t('mcp.builtin.tools')}</strong>
|
||||
<small>
|
||||
{t('mcp.profiles.count', {
|
||||
count: group.tools.length
|
||||
})}
|
||||
</small>
|
||||
</div>
|
||||
<ul>
|
||||
{group.tools.map((tool) => (
|
||||
<li key={tool.name}>
|
||||
<div>
|
||||
<span className="mcp-server-tool__identity">
|
||||
<strong>{tool.displayName}</strong>
|
||||
<code>{tool.name}</code>
|
||||
</span>
|
||||
<span className="builtin-tool-badge">
|
||||
{t('mcp.builtin.readOnly')}
|
||||
</span>
|
||||
</div>
|
||||
<p>{tool.description}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
)}
|
||||
</article>
|
||||
)
|
||||
})}
|
||||
{builtinModelToolGroups
|
||||
.filter((group) => group.id !== 'web')
|
||||
.map((group) => {
|
||||
@@ -1050,7 +1227,6 @@ export function McpSettingsSection({
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{editor &&
|
||||
|
||||
@@ -15,7 +15,10 @@ import type {
|
||||
DesktopApi,
|
||||
RuntimeSettings
|
||||
} from '../../shared/contracts'
|
||||
import type { CapabilitySnapshot } from '../../shared/capability-contracts'
|
||||
import type {
|
||||
CapabilityAssignments,
|
||||
CapabilitySnapshot
|
||||
} from '../../shared/capability-contracts'
|
||||
import type { ApplicationSettings } from '../../shared/application-settings-contracts'
|
||||
import type {
|
||||
EmbeddingDiagnosticResult,
|
||||
@@ -191,6 +194,35 @@ const capabilitySnapshot = {
|
||||
)[]
|
||||
}
|
||||
],
|
||||
builtinMcpServers: [
|
||||
{
|
||||
id: 'knowledge-base' as const,
|
||||
enabled: true,
|
||||
assignments: ['model', 'opencode', 'continue'] as (
|
||||
| 'model'
|
||||
| 'opencode'
|
||||
| 'continue'
|
||||
)[]
|
||||
},
|
||||
{
|
||||
id: 'magic-notes' as const,
|
||||
enabled: true,
|
||||
assignments: ['model', 'opencode', 'continue'] as (
|
||||
| 'model'
|
||||
| 'opencode'
|
||||
| 'continue'
|
||||
)[]
|
||||
},
|
||||
{
|
||||
id: 'goodbuddy-config' as const,
|
||||
enabled: true,
|
||||
assignments: ['model', 'opencode', 'continue'] as (
|
||||
| 'model'
|
||||
| 'opencode'
|
||||
| 'continue'
|
||||
)[]
|
||||
}
|
||||
],
|
||||
mcpServers: [] as CapabilitySnapshot['mcpServers'],
|
||||
webSearch: {
|
||||
provider: 'exa' as const,
|
||||
@@ -254,6 +286,24 @@ const setSkillEnabled = vi.fn(async (_skillId: string, enabled: boolean) => ({
|
||||
enabled
|
||||
}))
|
||||
}))
|
||||
const setBuiltinMcpServerEnabled = vi.fn(
|
||||
async (serverId: string, enabled: boolean) => ({
|
||||
...capabilitySnapshot,
|
||||
builtinMcpServers: capabilitySnapshot.builtinMcpServers.map(
|
||||
(server) =>
|
||||
server.id === serverId ? { ...server, enabled } : server
|
||||
)
|
||||
})
|
||||
)
|
||||
const setBuiltinMcpServerAssignments = vi.fn(
|
||||
async (serverId: string, assignments: CapabilityAssignments) => ({
|
||||
...capabilitySnapshot,
|
||||
builtinMcpServers: capabilitySnapshot.builtinMcpServers.map(
|
||||
(server) =>
|
||||
server.id === serverId ? { ...server, assignments } : server
|
||||
)
|
||||
})
|
||||
)
|
||||
const setComputerCapabilityEnabled = vi.fn(
|
||||
async (_capabilityId: string, enabled: boolean) => ({
|
||||
...capabilitySnapshot,
|
||||
@@ -539,6 +589,8 @@ describe('SettingsPanel runtime files', () => {
|
||||
removeSkill: vi.fn(async () => capabilitySnapshot),
|
||||
setSkillEnabled,
|
||||
setSkillAssignments: vi.fn(async () => capabilitySnapshot),
|
||||
setBuiltinMcpServerEnabled,
|
||||
setBuiltinMcpServerAssignments,
|
||||
saveMcpServer,
|
||||
removeMcpServer: vi.fn(async () => capabilitySnapshot),
|
||||
testMcpServer: vi.fn(async () => ({
|
||||
@@ -1042,7 +1094,7 @@ describe('SettingsPanel runtime files', () => {
|
||||
name: '展开服务器 笔记'
|
||||
})
|
||||
expect(noteServerToggle.closest('article')).toHaveClass(
|
||||
'mcp-server-card--disabled'
|
||||
'capability-card--disabled'
|
||||
)
|
||||
|
||||
fireEvent.click(screen.getByRole('tab', { name: '平台功能' }))
|
||||
@@ -1063,7 +1115,7 @@ describe('SettingsPanel runtime files', () => {
|
||||
screen
|
||||
.getByRole('button', { name: '展开服务器 笔记' })
|
||||
.closest('article')
|
||||
).not.toHaveClass('mcp-server-card--disabled')
|
||||
).not.toHaveClass('capability-card--disabled')
|
||||
)
|
||||
expect(
|
||||
screen.getAllByText('内置 MCP Server · 按模式读写 · 按对话授权')
|
||||
@@ -1089,6 +1141,9 @@ describe('SettingsPanel runtime files', () => {
|
||||
expect(navigation.parentElement).toHaveClass('settings-panel__body')
|
||||
expect(content.parentElement).toBe(navigation.parentElement)
|
||||
expect(content).toHaveClass('settings-panel__content')
|
||||
expect(
|
||||
screen.getByRole('tab', { name: 'Agent Runtime' })
|
||||
).toHaveTextContent('配置 Agent Runtime、默认工作区与原生能力')
|
||||
})
|
||||
|
||||
it('omits the redundant close-only footer on passive settings pages', () => {
|
||||
@@ -3470,12 +3525,11 @@ describe('SettingsPanel runtime files', () => {
|
||||
within(mcpTabs)
|
||||
.getAllByRole('tab')
|
||||
.map((tab) => tab.textContent)
|
||||
).toEqual(['内置能力', '电脑控制', '自定义 MCP'])
|
||||
).toEqual(['内置 MCP', '直连模型', '自定义 MCP', '电脑控制'])
|
||||
expect(
|
||||
within(mcpTabs).getByRole('tab', { name: '内置能力' })
|
||||
within(mcpTabs).getByRole('tab', { name: '内置 MCP' })
|
||||
).toHaveAttribute('aria-selected', 'true')
|
||||
expect(await screen.findByText('浏览器能力')).toBeInTheDocument()
|
||||
expect(screen.getAllByText('托管浏览器配置').length).toBeGreaterThan(0)
|
||||
expect(await screen.findByText('GoodBuddy 内置 MCP')).toBeInTheDocument()
|
||||
expect(
|
||||
screen.queryByRole('switch', {
|
||||
name: '启用 Linux 桌面控制'
|
||||
@@ -3484,6 +3538,43 @@ describe('SettingsPanel runtime files', () => {
|
||||
expect(
|
||||
screen.queryByRole('button', { name: /添加 Server/ })
|
||||
).not.toBeInTheDocument()
|
||||
const knowledgeBuiltinCard = screen
|
||||
.getByRole('switch', { name: '启用 知识库 内置 MCP' })
|
||||
.closest('article')
|
||||
expect(knowledgeBuiltinCard).not.toBeNull()
|
||||
expect(
|
||||
within(knowledgeBuiltinCard!).getByLabelText(
|
||||
/知识库 无法分配给 DeepSeek Harness/
|
||||
)
|
||||
).toBeDisabled()
|
||||
expect(
|
||||
within(knowledgeBuiltinCard!).getByLabelText(
|
||||
/知识库 无法分配给 DeepSeek Harness/
|
||||
)
|
||||
).not.toBeChecked()
|
||||
fireEvent.click(
|
||||
within(knowledgeBuiltinCard!).getByLabelText('Continue')
|
||||
)
|
||||
await waitFor(() =>
|
||||
expect(setBuiltinMcpServerAssignments).toHaveBeenCalledWith(
|
||||
'knowledge-base',
|
||||
['model', 'opencode']
|
||||
)
|
||||
)
|
||||
fireEvent.click(
|
||||
screen.getByRole('switch', { name: '启用 知识库 内置 MCP' })
|
||||
)
|
||||
await waitFor(() =>
|
||||
expect(setBuiltinMcpServerEnabled).toHaveBeenCalledWith(
|
||||
'knowledge-base',
|
||||
false
|
||||
)
|
||||
)
|
||||
fireEvent.click(
|
||||
within(mcpTabs).getByRole('tab', { name: '电脑控制' })
|
||||
)
|
||||
expect(await screen.findByText('电脑控制能力')).toBeInTheDocument()
|
||||
expect(screen.getAllByText('托管浏览器配置').length).toBeGreaterThan(0)
|
||||
fireEvent.click(
|
||||
screen.getByRole('switch', { name: '启用 浏览器控制' })
|
||||
)
|
||||
@@ -3529,24 +3620,28 @@ describe('SettingsPanel runtime files', () => {
|
||||
await waitFor(() =>
|
||||
expect(removeBrowserProfile).toHaveBeenCalledWith(browserProfileId)
|
||||
)
|
||||
fireEvent.click(
|
||||
within(mcpTabs).getByRole('tab', { name: '电脑控制' })
|
||||
)
|
||||
expect(await screen.findByText('电脑控制能力')).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('switch', {
|
||||
name: '启用 Linux 桌面控制'
|
||||
})
|
||||
).toBeDisabled()
|
||||
expect(
|
||||
screen.queryByRole('switch', { name: '启用 浏览器控制' })
|
||||
).not.toBeInTheDocument()
|
||||
screen.getByRole('switch', { name: '启用 浏览器控制' })
|
||||
).toBeInTheDocument()
|
||||
fireEvent.click(
|
||||
within(mcpTabs).getByRole('tab', { name: '内置能力' })
|
||||
within(mcpTabs).getByRole('tab', { name: '直连模型' })
|
||||
)
|
||||
expect(await screen.findByText('文件系统操作')).toBeInTheDocument()
|
||||
expect(screen.getByText('浏览器操作')).toBeInTheDocument()
|
||||
expect(screen.getByText('联网搜索')).toBeInTheDocument()
|
||||
expect(screen.queryByText('web_search')).not.toBeInTheDocument()
|
||||
expect(screen.queryByText('web_fetch')).not.toBeInTheDocument()
|
||||
const webSearchToggle = screen.getByRole('button', {
|
||||
name: '展开工具组 联网搜索'
|
||||
})
|
||||
expect(webSearchToggle).toHaveAttribute('aria-expanded', 'false')
|
||||
fireEvent.click(webSearchToggle)
|
||||
expect(webSearchToggle).toHaveAttribute('aria-expanded', 'true')
|
||||
expect(screen.getByText('web_search')).toBeInTheDocument()
|
||||
expect(screen.getByText('web_fetch')).toBeInTheDocument()
|
||||
expect(
|
||||
@@ -3569,6 +3664,9 @@ describe('SettingsPanel runtime files', () => {
|
||||
expect(screen.getByText('GoodBuddy search result')).toBeInTheDocument()
|
||||
expect(testWebSearch).toHaveBeenCalledOnce()
|
||||
expect(screen.queryByText('读取工作区文本')).not.toBeInTheDocument()
|
||||
fireEvent.click(
|
||||
within(mcpTabs).getByRole('tab', { name: '内置 MCP' })
|
||||
)
|
||||
expect(screen.getByText('知识库')).toBeInTheDocument()
|
||||
expect(screen.queryByText('knowledge_list')).not.toBeInTheDocument()
|
||||
expect(screen.queryByText('knowledge_search')).not.toBeInTheDocument()
|
||||
@@ -3599,7 +3697,7 @@ describe('SettingsPanel runtime files', () => {
|
||||
)
|
||||
).toBeInTheDocument()
|
||||
expect(noteServerToggle.closest('article')).toHaveClass(
|
||||
'mcp-server-card--disabled'
|
||||
'capability-card--disabled'
|
||||
)
|
||||
fireEvent.click(noteServerToggle)
|
||||
expect(
|
||||
@@ -3614,11 +3712,14 @@ describe('SettingsPanel runtime files', () => {
|
||||
})
|
||||
).toHaveLength(builtinMcpServers.length)
|
||||
expect(
|
||||
screen.getByText('可用于:模型、OpenCode、Continue')
|
||||
screen.getByText(/按请求提供,可分别控制启停与 Runtime 分配/)
|
||||
).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByText(/不公开服务地址或凭据/)
|
||||
).toBeInTheDocument()
|
||||
fireEvent.click(
|
||||
within(mcpTabs).getByRole('tab', { name: '直连模型' })
|
||||
)
|
||||
const filesystemToggle = screen.getByRole('button', {
|
||||
name: '展开工具组 文件系统操作'
|
||||
})
|
||||
@@ -3633,9 +3734,7 @@ describe('SettingsPanel runtime files', () => {
|
||||
expect(screen.getByText('浏览器导航')).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getAllByRole('button', { name: /工具组/u })
|
||||
).toHaveLength(
|
||||
builtinModelToolGroups.filter((group) => group.id !== 'web').length
|
||||
)
|
||||
).toHaveLength(builtinModelToolGroups.length)
|
||||
fireEvent.click(
|
||||
within(mcpTabs).getByRole('tab', { name: '自定义 MCP' })
|
||||
)
|
||||
|
||||
@@ -174,7 +174,8 @@ export const integrations = {
|
||||
sectionAriaLabel: 'MCP configuration',
|
||||
tabs: {
|
||||
ariaLabel: 'MCP settings categories',
|
||||
builtin: 'Built-in capabilities',
|
||||
builtin: 'Built-in MCP',
|
||||
modelTools: 'Direct model',
|
||||
computer: 'Computer control',
|
||||
custom: 'Custom MCP'
|
||||
},
|
||||
@@ -222,9 +223,19 @@ export const integrations = {
|
||||
},
|
||||
builtin: {
|
||||
title: 'Built-in GoodBuddy MCP',
|
||||
availableTo: 'Available to: Model, OpenCode, Continue',
|
||||
availableTo:
|
||||
'Provided per request with independent enablement and runtime assignment',
|
||||
notice:
|
||||
'GoodBuddy grants built-in MCP short-lived permissions for the current conversation in the main process without exposing service addresses or credentials.',
|
||||
'GoodBuddy grants built-in MCP short-lived permissions for the current conversation in the main process without exposing service addresses or credentials. Changes apply to subsequent requests, while Ask and Execute access boundaries remain enforced by the system.',
|
||||
enabled: 'Enabled',
|
||||
disabled: 'Disabled',
|
||||
enableAriaLabel: 'Enable the built-in {{name}} MCP',
|
||||
assignedTo: 'Assign to',
|
||||
runtimeUnsupported:
|
||||
'This runtime does not currently support request-scoped built-in MCP',
|
||||
runtimeAssignmentUnsupportedAriaLabel:
|
||||
'{{name}} cannot be assigned to {{runtime}} because this runtime does not support built-in MCP',
|
||||
unsupportedSuffix: ' (not supported yet)',
|
||||
serverSummaryMixed:
|
||||
'Built-in MCP server · Access depends on mode · Authorized per conversation',
|
||||
serverSummaryReadOnly:
|
||||
|
||||
@@ -43,9 +43,9 @@ export const settings = {
|
||||
runtime: {
|
||||
label: 'Agent Runtime',
|
||||
navigationDescription:
|
||||
'OpenCode, Continue, DeepSeek Harness, and workspace settings',
|
||||
'Configure Agent Runtimes, the default workspace, and native capabilities',
|
||||
description:
|
||||
'OpenCode, Continue, DeepSeek Harness, and workspace settings'
|
||||
'Configure Agent Runtimes, the default workspace, and native capabilities'
|
||||
},
|
||||
security: {
|
||||
label: 'Security and data',
|
||||
|
||||
@@ -161,7 +161,8 @@ export const integrations = {
|
||||
sectionAriaLabel: 'MCP 配置',
|
||||
tabs: {
|
||||
ariaLabel: 'MCP 设置分类',
|
||||
builtin: '内置能力',
|
||||
builtin: '内置 MCP',
|
||||
modelTools: '直连模型',
|
||||
computer: '电脑控制',
|
||||
custom: '自定义 MCP'
|
||||
},
|
||||
@@ -209,9 +210,17 @@ export const integrations = {
|
||||
},
|
||||
builtin: {
|
||||
title: 'GoodBuddy 内置 MCP',
|
||||
availableTo: '可用于:模型、OpenCode、Continue',
|
||||
availableTo: '按请求提供,可分别控制启停与 Runtime 分配',
|
||||
notice:
|
||||
'内置 MCP 由 GoodBuddy 在主进程按当前对话签发短期权限,不公开服务地址或凭据。',
|
||||
'内置 MCP 由 GoodBuddy 在主进程按当前对话签发短期权限,不公开服务地址或凭据。设置更改会应用到后续请求,Ask / Execute 的读写边界仍由系统强制。',
|
||||
enabled: '已启用',
|
||||
disabled: '已停用',
|
||||
enableAriaLabel: '启用 {{name}} 内置 MCP',
|
||||
assignedTo: '分配给',
|
||||
runtimeUnsupported: '当前 Runtime 不支持请求级内置 MCP',
|
||||
runtimeAssignmentUnsupportedAriaLabel:
|
||||
'{{name}} 无法分配给 {{runtime}},当前 Runtime 不支持内置 MCP',
|
||||
unsupportedSuffix: '(暂不支持)',
|
||||
serverSummaryMixed: '内置 MCP Server · 按模式读写 · 按对话授权',
|
||||
serverSummaryReadOnly: '内置 MCP Server · 只读 · 按对话授权',
|
||||
serverSummaryDisabled:
|
||||
|
||||
@@ -35,8 +35,8 @@ export const settings = {
|
||||
},
|
||||
runtime: {
|
||||
label: 'Agent Runtime',
|
||||
navigationDescription: 'OpenCode、Continue、DeepSeek Harness 与工作区',
|
||||
description: 'OpenCode、Continue、DeepSeek Harness 与工作区'
|
||||
navigationDescription: '配置 Agent Runtime、默认工作区与原生能力',
|
||||
description: '配置 Agent Runtime、默认工作区与原生能力'
|
||||
},
|
||||
security: {
|
||||
label: '安全与数据',
|
||||
|
||||
@@ -6812,6 +6812,27 @@ details.settings-section > :not(summary) + :not(summary) {
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.mcp-settings__tabs {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.mcp-settings__tabs > .page-tabs {
|
||||
width: 100%;
|
||||
min-width: max-content;
|
||||
}
|
||||
|
||||
.mcp-settings__tabs .page-tabs__tab {
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.mcp-settings__panel {
|
||||
min-width: 0;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.mcp-server-list {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
@@ -6833,6 +6854,32 @@ details.settings-section > :not(summary) + :not(summary) {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.capability-card--disabled {
|
||||
border-style: dashed;
|
||||
background: var(--surface-muted);
|
||||
}
|
||||
|
||||
.builtin-mcp-card__details {
|
||||
display: inline-flex;
|
||||
width: fit-content;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.builtin-mcp-card__tools {
|
||||
display: grid;
|
||||
padding-top: var(--space-3);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.runtime-assignment--unsupported {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.runtime-assignment--unsupported input {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.mcp-server-card__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user