can1357/oh-my-pi · error · Error

Only stdio transport is implemented in the TypeScript port

Error message

Only stdio transport is implemented in the TypeScript port

What it means

runMcpServer() only supports the stdio transport in the TypeScript port; any other transport value (e.g. 'http', 'sse', 'tcp') throws this error immediately. The port/host options exist in the signature for API compatibility but are unused until another transport is implemented.

Source

Thrown at packages/mnemopi/src/mcp-server.ts:134

						continue;
					}
					const response = await handleJsonRpc(parsed as JsonRpcRequest);
					if (response !== null) output.write(`${JSON.stringify(response)}\n`);
				}
				newline = buffer.indexOf("\n");
			}
		}
	} finally {
		reader.releaseLock();
	}
}

export function runMcpServer(
	transport = "stdio",
	options: { port?: number; bank?: string; host?: string } = {},
): Promise<void> {
	if (options.bank !== undefined && options.bank.length > 0) process.env.MNEMOPI_MCP_BANK = options.bank;
	if (transport !== "stdio") throw new Error("Only stdio transport is implemented in the TypeScript port");
	return runStdio();
}

export function main(argv: readonly string[] = Bun.argv.slice(2)): Promise<void> {
	let transport = "stdio";
	let port: number | undefined;
	let bank: string | undefined;
	let host: string | undefined;
	for (let i = 0; i < argv.length; i++) {
		const arg = argv[i];
		if (arg === "--transport") transport = argv[++i] ?? "stdio";
		else if (arg === "--port") {
			const parsed = Number(argv[++i] ?? "");
			if (Number.isFinite(parsed)) port = parsed;
		} else if (arg === "--bank") bank = argv[++i] ?? "";
		else if (arg === "--host") host = argv[++i] ?? "";
	}
	return runMcpServer(transport, { port, bank, host });

View on GitHub (pinned to 9690622007)

Solutions

  1. Use the default stdio transport: runMcpServer() or runMcpServer('stdio') and have the client spawn the process.
  2. Remove --transport/--port flags from the launch command so defaults apply.
  3. If a network transport is required, keep the Python server or implement/contribute an HTTP transport in the TS port.

Example fix

// before
await runMcpServer('http', { port: 8080 });
// after
await runMcpServer('stdio'); // client spawns: omp-mcp | your-mcp-client
Defensive patterns

Strategy: validation

Validate before calling

const transport = process.env.MNEMOPI_TRANSPORT ?? 'stdio';
if (transport !== 'stdio') {
  throw new Error(`Transport '${transport}' not supported by TS port; use stdio`);
}
await runMcpServer(transport);

Type guard

function isSupportedTransport(t) {
  return t === 'stdio';
}

Try / catch

try {
  await runMcpServer(transport);
} catch (err) {
  if (err instanceof Error && err.message.includes('Only stdio transport')) {
    console.error('TS port supports stdio only; spawn the server as a subprocess');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Calling runMcpServer('http') / runMcpServer('sse') or invoking main() with --transport http (or equivalent CLI flag), or passing a port expecting an HTTP server to start.

Common situations: Porting configs from the Python implementation that used an HTTP/SSE transport, following docs or examples written for the original version, or wiring the MCP server into a network-based client instead of spawning it over stdio.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/24186c9a615da2db. Report an issue: GitHub.