🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@opencode-ai/protocol

Package Overview
Dependencies
Maintainers
2
Versions
502
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencode-ai/protocol - npm Package Compare versions

Comparing version
0.0.0-next-15828
to
0.0.0-next-15830
+6
-0
dist/errors.d.ts

@@ -63,2 +63,8 @@ import { Schema } from "effect";

}
declare const McpServerNotFoundError_base: Schema.Class<McpServerNotFoundError, Schema.TaggedStruct<"McpServerNotFoundError", {
readonly server: Schema.String;
readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class McpServerNotFoundError extends McpServerNotFoundError_base {
}
declare const CommandNotFoundError_base: Schema.Class<CommandNotFoundError, Schema.TaggedStruct<"CommandNotFoundError", {

@@ -65,0 +71,0 @@ readonly command: Schema.String;

@@ -52,2 +52,7 @@ import { Schema } from "effect";

}
export class McpServerNotFoundError extends Schema.TaggedErrorClass()("McpServerNotFoundError", {
server: Schema.String,
message: Schema.String,
}, { httpApiStatus: 404 }) {
}
export class CommandNotFoundError extends Schema.TaggedErrorClass()("CommandNotFoundError", {

@@ -54,0 +59,0 @@ command: Schema.String,

+34
-2

@@ -0,4 +1,6 @@

import { Mcp } from "@opencode-ai/schema/mcp";
import { Location } from "@opencode-ai/schema/location";
import { Schema } from "effect";
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
import { McpServerNotFoundError } from "../errors.js";
export declare const McpGroup: HttpApiGroup.HttpApiGroup<"server.mcp", HttpApiEndpoint.HttpApiEndpoint<"mcp.list", "GET", "/api/mcp", never, Schema.toCodecStringTree<Schema.Struct<{

@@ -30,3 +32,5 @@ readonly location: Schema.optional<Schema.Struct<{

}>>;
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.resource.catalog", "GET", "/api/mcp/resource", never, Schema.toCodecStringTree<Schema.Struct<{
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.add", "PUT", "/api/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
server: Schema.String;
}>>, Schema.toCodecStringTree<Schema.Struct<{
readonly location: Schema.optional<Schema.Struct<{

@@ -36,2 +40,30 @@ readonly directory: Schema.optional<Schema.String>;

}>>;
}>>, Schema.toCodecJson<Schema.Struct<{
readonly config: Schema.toTaggedUnion<"type", readonly [typeof Mcp.LocalConfig, typeof Mcp.RemoteConfig]>;
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.remove", "DELETE", "/api/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
server: Schema.String;
}>>, Schema.toCodecStringTree<Schema.Struct<{
readonly location: Schema.optional<Schema.Struct<{
readonly directory: Schema.optional<Schema.String>;
readonly workspace: Schema.optional<Schema.String>;
}>>;
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.connect", "POST", "/api/mcp/:server/connect", Schema.toCodecStringTree<Schema.Struct<{
server: Schema.String;
}>>, Schema.toCodecStringTree<Schema.Struct<{
readonly location: Schema.optional<Schema.Struct<{
readonly directory: Schema.optional<Schema.String>;
readonly workspace: Schema.optional<Schema.String>;
}>>;
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.disconnect", "POST", "/api/mcp/:server/disconnect", Schema.toCodecStringTree<Schema.Struct<{
server: Schema.String;
}>>, Schema.toCodecStringTree<Schema.Struct<{
readonly location: Schema.optional<Schema.Struct<{
readonly directory: Schema.optional<Schema.String>;
readonly workspace: Schema.optional<Schema.String>;
}>>;
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.resource.catalog", "GET", "/api/mcp/resource", never, Schema.toCodecStringTree<Schema.Struct<{
readonly location: Schema.optional<Schema.Struct<{
readonly directory: Schema.optional<Schema.String>;
readonly workspace: Schema.optional<Schema.String>;
}>>;
}>>, never, never, Schema.toCodecJson<Schema.Struct<{

@@ -38,0 +70,0 @@ readonly location: typeof Location.Info;

import { Mcp } from "@opencode-ai/schema/mcp";
import { Location } from "@opencode-ai/schema/location";
import { Schema } from "effect";
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
import { McpServerNotFoundError } from "../errors.js";
import { LocationQuery, locationQueryOpenApi } from "./location.js";

@@ -17,2 +18,52 @@ export const McpGroup = HttpApiGroup.make("server.mcp")

})))
.add(HttpApiEndpoint.put("mcp.add", "/api/mcp/:server", {
params: { server: Schema.String },
query: LocationQuery,
// Wrapped in a struct because the client codegen flattens payload fields and cannot
// represent a top-level union payload.
payload: Schema.Struct({ config: Mcp.ServerConfig }),
success: HttpApiSchema.NoContent,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(OpenApi.annotations({
identifier: "v2.mcp.add",
summary: "Add MCP server",
description: "Add an MCP server at runtime or replace an existing one, connecting it immediately.",
})))
.add(HttpApiEndpoint.delete("mcp.remove", "/api/mcp/:server", {
params: { server: Schema.String },
query: LocationQuery,
success: HttpApiSchema.NoContent,
error: McpServerNotFoundError,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(OpenApi.annotations({
identifier: "v2.mcp.remove",
summary: "Remove MCP server",
description: "Stop an MCP server and remove it from the runtime set until restart.",
})))
.add(HttpApiEndpoint.post("mcp.connect", "/api/mcp/:server/connect", {
params: { server: Schema.String },
query: LocationQuery,
success: HttpApiSchema.NoContent,
error: McpServerNotFoundError,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(OpenApi.annotations({
identifier: "v2.mcp.connect",
summary: "Connect MCP server",
description: "Connect an MCP server at runtime, overriding a disabled configuration until restart.",
})))
.add(HttpApiEndpoint.post("mcp.disconnect", "/api/mcp/:server/disconnect", {
params: { server: Schema.String },
query: LocationQuery,
success: HttpApiSchema.NoContent,
error: McpServerNotFoundError,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(OpenApi.annotations({
identifier: "v2.mcp.disconnect",
summary: "Disconnect MCP server",
description: "Disconnect an MCP server at runtime, removing its tools until reconnected.",
})))
.add(HttpApiEndpoint.get("mcp.resource.catalog", "/api/mcp/resource", {

@@ -19,0 +70,0 @@ query: LocationQuery,

+2
-2
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/protocol",
"version": "0.0.0-next-15828",
"version": "0.0.0-next-15830",
"type": "module",

@@ -29,3 +29,3 @@ "license": "MIT",

"dependencies": {
"@opencode-ai/schema": "0.0.0-next-15828",
"@opencode-ai/schema": "0.0.0-next-15830",
"effect": "4.0.0-beta.98"

@@ -32,0 +32,0 @@ },