@nightowlsdev/mcp-server
Adapter/ToolingExpose a Night Owls swarm AS an MCP server, ask-only `ask_<agent>` tools, no workflow execution.
What it does
@nightowlsdev/mcp-server turns a running Night Owls swarm into an MCP server so other agents/tools can call your agents. createSwarmMcpServer takes the SwarmEngine, a StorageAdapter, the list of agents to expose, and a resolveContext function that derives the caller's tenant/user identity from the MCP request (identity comes only from the transport, never from attacker-controllable tool args). Each agent becomes a single ask_<slug> tool; calling it runs the agent and drains the event stream to one JSON result (done with the answer, needs_input for a durably-suspended HITL ask that you answer via a follow-up call with the followupId, or failed). runSwarmMcpStdio wires it over stdio. By the engine-wall contract it imports only the raw MCP SDK plus @nightowlsdev/core TYPES, never the engine vendor, and exposes ONLY ask_<agent> tools, never run_<workflow>.
Install
pnpm add @nightowlsdev/mcp-serverKey exports
- createSwarmMcpServer
- runSwarmMcpStdio
- types: SwarmMcpServerOpts, SwarmMcpAgent, SwarmMcpContext
Usage
import { createSwarmMcpServer, runSwarmMcpStdio } from "@nightowlsdev/mcp-server";
const server = createSwarmMcpServer({
engine,
storage,
agents: [{ slug: "editor" }], // becomes the ask_editor tool
resolveContext: (req) => ({ tenantId: req.tenantId, userId: req.userId }),
});
await runSwarmMcpStdio(server); // expose over stdio