summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-10-07 04:04:19 -0400
committerDax Raad <[email protected]>2025-10-07 04:04:19 -0400
commita440e09cfe57b955c3cbbdcc43eaf84d33d9c6dc (patch)
tree7c6c7f8e998ebb833ffba6ae3d0041364c98cc2d /packages/sdk
parent27c211ef869cae9d18b3fefc36ba787af75ebde0 (diff)
downloadopencode-a440e09cfe57b955c3cbbdcc43eaf84d33d9c6dc.tar.gz
opencode-a440e09cfe57b955c3cbbdcc43eaf84d33d9c6dc.zip
core: improve MCP reliability and add status monitoring
- Added 5-second timeout to MCP client verification to prevent hanging connections - New GET /mcp endpoint to monitor server connection status - Automatically removes unresponsive MCP clients during initialization
Diffstat (limited to 'packages/sdk')
-rw-r--r--packages/sdk/js/src/gen/sdk.gen.ts15
-rw-r--r--packages/sdk/js/src/gen/types.gen.ts16
2 files changed, 31 insertions, 0 deletions
diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts
index aea90daec..6bb1e115f 100644
--- a/packages/sdk/js/src/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/gen/sdk.gen.ts
@@ -82,6 +82,8 @@ import type {
AppLogResponses,
AppAgentsData,
AppAgentsResponses,
+ McpStatusData,
+ McpStatusResponses,
TuiAppendPromptData,
TuiAppendPromptResponses,
TuiOpenHelpData,
@@ -567,6 +569,18 @@ class App extends _HeyApiClient {
}
}
+class Mcp extends _HeyApiClient {
+ /**
+ * Get MCP server status
+ */
+ public status<ThrowOnError extends boolean = false>(options?: Options<McpStatusData, ThrowOnError>) {
+ return (options?.client ?? this._client).get<McpStatusResponses, unknown, ThrowOnError>({
+ url: "/mcp",
+ ...options,
+ })
+ }
+}
+
class Tui extends _HeyApiClient {
/**
* Append prompt to the TUI
@@ -724,6 +738,7 @@ export class OpencodeClient extends _HeyApiClient {
find = new Find({ client: this._client })
file = new File({ client: this._client })
app = new App({ client: this._client })
+ mcp = new Mcp({ client: this._client })
tui = new Tui({ client: this._client })
auth = new Auth({ client: this._client })
event = new Event({ client: this._client })
diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts
index c255cc69c..cc94c1f1f 100644
--- a/packages/sdk/js/src/gen/types.gen.ts
+++ b/packages/sdk/js/src/gen/types.gen.ts
@@ -2070,6 +2070,22 @@ export type AppAgentsResponses = {
export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]
+export type McpStatusData = {
+ body?: never
+ path?: never
+ query?: {
+ directory?: string
+ }
+ url: "/mcp"
+}
+
+export type McpStatusResponses = {
+ /**
+ * MCP server status
+ */
+ 200: unknown
+}
+
export type TuiAppendPromptData = {
body?: {
text: string