feat(core): add mcp support (#34513)

This commit is contained in:
Aiden Cline 2026-06-30 08:37:44 -05:00 committed by GitHub
commit b1ca070b3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 1966 additions and 388 deletions

View file

@ -3,6 +3,7 @@ import type {
CommandV2Info,
IntegrationInfo,
LocationRef,
McpServer,
ModelV2Info,
PermissionSavedInfo,
PermissionV2Request,
@ -30,6 +31,7 @@ type LocationData = {
agent?: AgentV2Info[]
command?: CommandV2Info[]
integration?: IntegrationInfo[]
mcp?: McpServer[]
model?: ModelV2Info[]
provider?: ProviderV2Info[]
reference?: ReferenceInfo[]
@ -529,6 +531,11 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
result.location.provider.refresh(event.location),
])
break
// Authenticating an MCP integration reconnects its server, which emits mcp.status.changed,
// so the mcp list refreshes here rather than off integration.updated.
case "mcp.status.changed":
void result.location.mcp.refresh(event.location)
break
}
}
@ -674,6 +681,16 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
setStore("location", key, { ...store.location[key], integration: mutable(result.data) })
},
},
mcp: {
list(location?: LocationRef) {
return store.location[locationKey(location ?? defaultLocation())]?.mcp
},
async refresh(ref?: LocationRef) {
const result = await sdk.client.v2.mcp.list({ location: locationQuery(ref) }, { throwOnError: true })
const key = locationKey(result.data.location)
setStore("location", key, { ...store.location[key], mcp: result.data.data })
},
},
model: {
list(location?: LocationRef) {
return store.location[locationKey(location ?? defaultLocation())]?.model
@ -747,6 +764,7 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
result.location.refresh(),
result.location.agent.refresh(),
result.location.integration.refresh(),
result.location.mcp.refresh(),
result.location.model.refresh(),
result.location.provider.refresh(),
result.location.reference.refresh(),