Available since: v3.1.0
The surreal db 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 db start and connect to the /mcp endpoint instead. See When to use surreal db mcp vs surreal db start for the comparison, and Embedded MCP for transports, editor setup, and security.
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 db mcp [OPTIONS] [PATH]Database tuning flags from surreal db start are also available via the shared dbs option group (see surreal db mcp --help).
Usage
surreal db mcp --ns main --db main memoryOptional root credentials apply only when no root user exists yet (same semantics as surreal db start):
surreal db mcp -u root -p secret --ns main --db main memoryLimits
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.