Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions apps/server/src/mcp/McpHttpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import * as McpInvocationContext from "./McpInvocationContext.ts";
import * as McpSessionRegistry from "./McpSessionRegistry.ts";
import { ThreadToolkitHandlersLive } from "./toolkits/thread/handlers.ts";
import { ThreadToolkit } from "./toolkits/thread/tools.ts";
import { SubagentToolkitHandlersLive } from "./toolkits/subagent/handlers.ts";
import {
installPeerSubagentCompatibility,
SubagentToolkitHandlersLive,
} from "./toolkits/subagent/handlers.ts";
import { SubagentToolkit } from "./toolkits/subagent/tools.ts";
import { NotifyToolkitHandlersLive } from "./toolkits/notify/handlers.ts";
import { NotifyToolkit } from "./toolkits/notify/tools.ts";
Expand Down Expand Up @@ -91,9 +94,12 @@ export const ThreadToolkitRegistrationLive = McpServer.toolkit(ThreadToolkit).pi
Layer.provide(ThreadToolkitHandlersLive),
);

export const SubagentToolkitRegistrationLive = McpServer.toolkit(SubagentToolkit).pipe(
Layer.provide(SubagentToolkitHandlersLive),
);
export const SubagentToolkitRegistrationLive = Layer.effectDiscard(
Effect.gen(function* () {
yield* McpServer.registerToolkit(SubagentToolkit);
yield* installPeerSubagentCompatibility;
}),
).pipe(Layer.provide(SubagentToolkitHandlersLive), Layer.provide(McpServer.McpServer.layer));

export const NotifyToolkitRegistrationLive = McpServer.toolkit(NotifyToolkit).pipe(
Layer.provide(NotifyToolkitHandlersLive),
Expand Down
35 changes: 31 additions & 4 deletions apps/server/src/mcp/McpOfficialClientConformance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,23 @@ const environmentId = EnvironmentId.make("environment-mcp-conformance");
const threadId = ThreadId.make("thread-mcp-conformance");
const providerInstanceId = ProviderInstanceId.make("codex");

const expectedToolNamesAfterPreviewRemoval = [
"t3_check_subagent",
const expectedToolNamesAfterSpawnTrim = [
"t3_get_usage",
"t3_list_backends",
"t3_list_subagents",
"t3_notify",
"t3_schedule_create",
"t3_schedule_delete",
"t3_schedule_list",
"t3_schedule_update",
"t3_spawn_subagent",
"t3_steer_subagent",
"t3_subagents",
"t3_thread_start",
] as const;

const removedSubagentToolNames = [
"t3_check_subagent",
"t3_list_subagents",
"t3_wait_subagent",
] as const;

Expand Down Expand Up @@ -275,12 +279,35 @@ it.effect("conforms to the official streamable HTTP MCP client", () =>
const toolsResult = yield* Effect.promise(() => client.listTools());
ListToolsResultSchema.parse(toolsResult);
const toolNames = new Set(toolsResult.tools.map((tool) => tool.name));
expect([...toolNames].toSorted()).toEqual([...expectedToolNamesAfterPreviewRemoval]);
expect([...toolNames].toSorted()).toEqual([...expectedToolNamesAfterSpawnTrim]);
for (const removedName of removedPreviewToolNames) {
expect(toolNames.has(removedName), `${removedName} must be absent from tools/list`).toBe(
false,
);
}
for (const removedName of removedSubagentToolNames) {
expect(toolNames.has(removedName), `${removedName} must be absent from tools/list`).toBe(
false,
);
}

for (const toolName of ["t3_spawn_subagent", "t3_thread_start"] as const) {
const tool = toolsResult.tools.find((candidate) => candidate.name === toolName);
expect(tool, `${toolName} must be present`).toBeDefined();
expect(Object.keys(tool?.inputSchema.properties ?? {}).toSorted()).toEqual([
"branch",
"directory",
"model",
"prompt",
"reasoningEffort",
"title",
]);
expect([...(tool?.inputSchema.required ?? [])].toSorted()).toEqual([
"model",
"prompt",
"title",
]);
}

for (const tool of toolsResult.tools) {
expect(tool.inputSchema.type, `${tool.name} input schema must be an object`).toBe("object");
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/toolSchemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ it("every MCP tool advertises a top-level object input schema", () => {
}
// Guard the guard: if toolkit wiring changes shape, this test must not
// silently pass on an empty list.
expect(checked).toHaveLength(13);
expect(checked).toHaveLength(11);
expect(checked).toContain("t3_list_backends");
});
Loading
Loading