• Start
Sign In

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 with owner-level access.

For HTTP-based clients against a running server, use surreal start and connect to the /mcp endpoint instead. See When to use surreal mcp vs surreal start for the comparison, and Embedded MCP for transports, editor setup, and security.

Warning

Stdio MCP is intended for a trusted operator on the same machine. Do not expose this process to untrusted users — there is no per-call HTTP authentication surface to re-bind credentials.

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 Embedded MCP. For HTTP /mcp on a non-loopback hostname, set SURREAL_MCP_ALLOWED_HOSTS (or SURREAL_MCP_ALLOW_ALL_HOSTS behind a trusted proxy). See those pages for details.

Was this page helpful?