• Start

SurrealDB CLI

/

CLI commands

mcp

Start SurrealDB's Model Context Protocol server over stdio for local IDE and agent integrations.

Available since: v3.1.0

The surreal mcp subcommand starts the built-in Model Context Protocol server on stdio, suitable for Cursor, VS Code, Claude Desktop, and other MCP clients. It opens an embedded datastore at the path you pass (default memory) and runs every tool call under Session::owner().

For HTTP-based clients against a running server, use surreal start and connect to /mcp instead. See Model Context Protocol (MCP) for transports, tools, and security guidance.

surreal mcp --ns main --db main memory

Optional root credentials apply only when no root user exists yet (same semantics as surreal start):

surreal mcp -u root -p secret --ns main --db main memory
Argument / flagEnvironmentDescription
path (positional)SURREAL_PATHDatabase path (memory by default)
--nsSURREAL_MCP_NSInitial namespace
--dbSURREAL_MCP_DBInitial database
-u / --usernameSURREAL_USERRoot username (requires --password; only if no root exists)
-p / --passwordSURREAL_PASSRoot password

Database tuning flags from surreal start are also available via the shared dbs option group (see surreal mcp --help).

Process-wide MCP limits use the SURREAL_MCP_* variables documented in Environment variables and on MCP for AI agents.

Was this page helpful?