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

@ -299,6 +299,8 @@ import type {
V2IntegrationListResponses,
V2LocationGetErrors,
V2LocationGetResponses,
V2McpListErrors,
V2McpListResponses,
V2ModelListErrors,
V2ModelListResponses,
V2PermissionRequestListErrors,
@ -6412,6 +6414,30 @@ export class Integration extends HeyApiClient {
}
}
export class Mcp2 extends HeyApiClient {
/**
* List MCP servers
*
* Retrieve configured MCP servers and their connection status.
*/
public list<ThrowOnError extends boolean = false>(
parameters?: {
location?: {
directory?: string
workspace?: string
}
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }])
return (options?.client ?? this.client).get<V2McpListResponses, V2McpListErrors, ThrowOnError>({
url: "/api/mcp",
...options,
...params,
})
}
}
export class Credential extends HeyApiClient {
/**
* Remove credential
@ -7435,6 +7461,11 @@ export class V2 extends HeyApiClient {
return (this._integration ??= new Integration({ client: this.client }))
}
private _mcp?: Mcp2
get mcp(): Mcp2 {
return (this._mcp ??= new Mcp2({ client: this.client }))
}
private _credential?: Credential
get credential(): Credential {
return (this._credential ??= new Credential({ client: this.client }))

View file

@ -84,6 +84,7 @@ export type Event =
| EventTuiSessionSelect2
| EventMcpToolsChanged
| EventMcpBrowserOpenFailed
| EventMcpStatusChanged
| EventCommandExecuted
| EventProjectUpdated
| EventSessionStatus
@ -1551,6 +1552,13 @@ export type GlobalEvent = {
url: string
}
}
| {
id: string
type: "mcp.status.changed"
properties: {
server: string
}
}
| {
id: string
type: "command.executed"
@ -3048,6 +3056,7 @@ export type V2Event =
| TuiSessionSelect
| McpToolsChanged
| McpBrowserOpenFailed
| McpStatusChanged
| CommandExecuted
| ProjectUpdated
| SessionStatus2
@ -5254,6 +5263,43 @@ export type IntegrationAttemptStatus =
}
}
export type McpStatusConnected2 = {
status: "connected"
}
export type McpStatusDisconnected = {
status: "disconnected"
}
export type McpStatusDisabled2 = {
status: "disabled"
}
export type McpStatusFailed2 = {
status: "failed"
error: string
}
export type McpStatusNeedsAuth2 = {
status: "needs_auth"
}
export type McpStatusNeedsClientRegistration2 = {
status: "needs_client_registration"
error: string
}
export type McpServer = {
name: string
status:
| McpStatusConnected2
| McpStatusDisconnected
| McpStatusDisabled2
| McpStatusFailed2
| McpStatusNeedsAuth2
| McpStatusNeedsClientRegistration2
}
export type ProjectCurrent = {
id: string
directory: string
@ -6215,6 +6261,23 @@ export type McpBrowserOpenFailed = {
}
}
export type McpStatusChanged = {
id: string
metadata?: {
[key: string]: unknown
}
type: "mcp.status.changed"
durable?: {
aggregateID: string
seq: number
version: number
}
location?: LocationRef
data: {
server: string
}
}
export type CommandExecuted = {
id: string
metadata?: {
@ -7318,6 +7381,14 @@ export type EventMcpBrowserOpenFailed = {
}
}
export type EventMcpStatusChanged = {
id: string
type: "mcp.status.changed"
properties: {
server: string
}
}
export type EventCommandExecuted = {
id: string
type: "command.executed"
@ -13030,6 +13101,43 @@ export type V2IntegrationAttemptCompleteResponses = {
export type V2IntegrationAttemptCompleteResponse =
V2IntegrationAttemptCompleteResponses[keyof V2IntegrationAttemptCompleteResponses]
export type V2McpListData = {
body?: never
path?: never
query?: {
location?: {
directory?: string
workspace?: string
}
}
url: "/api/mcp"
}
export type V2McpListErrors = {
/**
* InvalidRequestError
*/
400: InvalidRequestError
/**
* UnauthorizedError
*/
401: UnauthorizedError
}
export type V2McpListError = V2McpListErrors[keyof V2McpListErrors]
export type V2McpListResponses = {
/**
* Success
*/
200: {
location: LocationInfo
data: Array<McpServer>
}
}
export type V2McpListResponse = V2McpListResponses[keyof V2McpListResponses]
export type V2CredentialRemoveData = {
body?: never
path: {