feat(core): add mcp support (#34513)
This commit is contained in:
parent
12887e572e
commit
b1ca070b3b
30 changed files with 1966 additions and 388 deletions
|
|
@ -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)
|
||||
|
|
|
|||
39
packages/schema/src/mcp.ts
Normal file
39
packages/schema/src/mcp.ts
Normal 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" })
|
||||
Loading…
Add table
Add a link
Reference in a new issue