Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

MCP servers API takes "type": "stdio" on a command server

milind-soni72f56613e1e7
diff --git a/docs/custom-mcp-servers.md b/docs/custom-mcp-servers.md
index 0599a7c2e9..f9b9512907 100644
--- a/docs/custom-mcp-servers.md
+++ b/docs/custom-mcp-servers.md
@@ -453,10 +453,11 @@ The same registry lives in `~/.openmausbot/config.json`:
}
```
-`type` is `http` (Streamable HTTP, the default) or `sse`. `oauth` is the
-optional sign-in app; `clientSecret` and `scopes` may be left out. If you edit the file
-by hand, restart OpenMausBot. Every bot whose engine can mount custom MCP
-servers gets the enabled tools on its next task.
+`type` is `http` (Streamable HTTP, the default) or `sse`. A command entry may
+say `"type": "stdio"`, as other MCP clients write it; it changes nothing.
+`oauth` is the optional sign-in app; `clientSecret` and `scopes` may be left
+out. If you edit the file by hand, restart OpenMausBot. Every bot whose
+engine can mount custom MCP servers gets the enabled tools on its next task.
## Rules that keep this safe
diff --git a/server/mcp-registry.test.ts b/server/mcp-registry.test.ts
index 691fc032c5..f5699995e0 100644
--- a/server/mcp-registry.test.ts
+++ b/server/mcp-registry.test.ts
@@ -22,6 +22,14 @@ describe("custom MCP registry", () => {
});
});
+ it("takes a command entry that names its stdio transport, and stores it as before", () => {
+ const plain = parseMcpServerMutation("notes", { command: "npx", args: ["-y", "notes-mcp"] });
+ expect(parseMcpServerMutation("notes", { type: "stdio", command: "npx", args: ["-y", "notes-mcp"] })).toEqual(plain);
+ expect(parseStoredMcpServer("notes", { type: "stdio", command: "npx" })).toEqual(parseStoredMcpServer("notes", { command: "npx" }));
+ expect(parseMcpServerMutation("notes", { type: "local", command: "npx" })).toMatchObject({ ok: false });
+ expect(parseMcpServerMutation("notes", { type: "stdio", url: "https://x.example/mcp" })).toMatchObject({ ok: false });
+ });
+
it("refuses unsafe and reserved routing names", () => {
expect(mcpServerNameError("Bad.Name")).toMatch(/lowercase/);
expect(mcpServerNameError("computer")).toMatch(/reserved/);
diff --git a/server/mcp-registry.ts b/server/mcp-registry.ts
index a24179a089..05332a2ba1 100644
--- a/server/mcp-registry.ts
+++ b/server/mcp-registry.ts
@@ -140,6 +140,8 @@ const runsOnSchema = z.object({
}).strict();
const stdioEntrySchema = z.object({
+ /** Optional, as other MCP clients write it; a command always runs over stdio, so it is not stored. */
+ type: z.literal("stdio").optional(),
command: z.string().trim().min(1).max(1_024),
args: z.array(z.string().max(4_096)).max(MAX_ARGS).optional(),
env: z.record(z.string(), z.string().max(16_384)).optional(),
diff --git a/server/routes/mcp-servers.test.ts b/server/routes/mcp-servers.test.ts
index 0539dcdd26..aec066474d 100644
--- a/server/routes/mcp-servers.test.ts
+++ b/server/routes/mcp-servers.test.ts
@@ -86,6 +86,18 @@ it("says when a server is added, imported or removed on purpose, so a Cloud home
expect(changes).toEqual(["added", "added", "removed"]);
});
+it("adds a command server sent with type stdio, as other MCP clients write it, and keeps the old shape working", async () => {
+ const { cfg, post } = await serve();
+ const typed = await post("/api/mcp/servers", { name: "notes", type: "stdio", command: "npx", args: ["-y", "notes-mcp"] });
+ expect(typed.status, await typed.clone().text()).toBe(201);
+ const plain = await post("/api/mcp/servers", { name: "files", command: "npx", args: ["-y", "files-mcp"] });
+ expect(plain.status, await plain.clone().text()).toBe(201);
+ expect(cfg.mcpServers).toEqual({
+ notes: { command: "npx", args: ["-y", "notes-mcp"], env: {}, enabled: false },
+ files: { command: "npx", args: ["-y", "files-mcp"], env: {}, enabled: false },
+ });
+});
+
it.each([["private", "person"], ["public", "team"]])("lists the scope of %s in reads and mutation responses", async (name, scope) => {
const { post, get } = await serve();
const response = await post("/api/mcp/servers", { name, url: "https://mail.example.com/mcp", headers: { Authorization: "" } });