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

@ -18,4 +18,13 @@ export const BrowserOpenFailed = Event.define({
},
})
export const Definitions = Event.inventory(ToolsChanged, BrowserOpenFailed)
// Emitted whenever a server's connection status settles (connected, failed, needs_auth, closed) so
// observers can refresh status without polling.
export const StatusChanged = Event.define({
type: "mcp.status.changed",
schema: {
server: Schema.String,
},
})
export const Definitions = Event.inventory(ToolsChanged, BrowserOpenFailed, StatusChanged)

View file

@ -0,0 +1,39 @@
export * as Mcp from "./mcp"
import { Schema } from "effect"
const Connected = Schema.Struct({ status: Schema.Literal("connected") }).annotate({
identifier: "Mcp.Status.Connected",
})
const Disconnected = Schema.Struct({ status: Schema.Literal("disconnected") }).annotate({
identifier: "Mcp.Status.Disconnected",
})
const Disabled = Schema.Struct({ status: Schema.Literal("disabled") }).annotate({
identifier: "Mcp.Status.Disabled",
})
const Failed = Schema.Struct({ status: Schema.Literal("failed"), error: Schema.String }).annotate({
identifier: "Mcp.Status.Failed",
})
const NeedsAuth = Schema.Struct({ status: Schema.Literal("needs_auth") }).annotate({
identifier: "Mcp.Status.NeedsAuth",
})
const NeedsClientRegistration = Schema.Struct({
status: Schema.Literal("needs_client_registration"),
error: Schema.String,
}).annotate({ identifier: "Mcp.Status.NeedsClientRegistration" })
export type Status = typeof Status.Type
export const Status = Schema.Union([
Connected,
Disconnected,
Disabled,
Failed,
NeedsAuth,
NeedsClientRegistration,
]).pipe(Schema.toTaggedUnion("status"))
export interface Server extends Schema.Schema.Type<typeof Server> {}
export const Server = Schema.Struct({
name: Schema.String,
status: Status,
}).annotate({ identifier: "Mcp.Server" })