SurrealDB MCP Server is an MCP server that provides an interface for AI assistants to interact directly with a SurrealDB database instance. Built on the Model Context Protocol TypeScript SDK, it connects language model clients to SurrealDB's multi-model document-graph database engine. Software engineers, database administrators, and AI developers use this server to inspect schemas, execute ad-hoc database queries, and manipulate live datasets straight from their coding environments. By exposing standard database operations as MCP tools, the server enables connected clients to run raw SurrealQL statements, retrieve records by ID or table, create new documents, update or patch existing entries, and manage graph edges between records. The integration handles database connection management through standard environment variables, allowing developers to automate data inspection, perform data migrations, run semantic queries, and test database-backed application workflows without switching away from their primary development assistant.
Category: Databases & Data Stores
Tags: database, multi-model, nosql, surrealdb
claude_desktop_config.json for Claude Desktop or .vscode/mcp.json for Copilot. 2. Add the surrealdb server configuration using npx to execute the package directly: json { "mcpServers": { "surrealdb": { "command": "npx", "args": ["-y", "surrealdb-mcp-server"], "env": { "SURREALDB_URL": "ws://localhost:8000", "SURREALDB_NS": "your_namespace", "SURREALDB_DB": "your_database", "SURREALDB_USER": "your_db_user", "SURREALDB_PASS": "your_db_password" } } } } 3. Alternatively, install globally using npm install -g surrealdb-mcp-server and point your client configuration to the built index.js file using node. 4. Restart your MCP client and ask the assistant to list tools to verify the connection.Part of MCP Servers
You can run it on demand with npx by configuring your client to execute surrealdb-mcp-server with the -y flag. Alternatively, install it globally using npm install -g surrealdb-mcp-server and point your MCP client to the built index.js file. Provide your database credentials and endpoint details using the SURREALDB_URL, SURREALDB_NS, SURREALDB_DB, SURREALDB_USER, and SURREALDB_PASS environment variables.
The server exposes tools to execute raw SurrealQL queries and handle standard document and graph operations. These include selecting records, creating new documents, replacing or updating data, merging fields, applying JSON Patch updates, upserting, deleting records by ID, inserting multiple records simultaneously, and creating graph relation edges between records.
It works with any MCP-compliant client that supports stdio transport. Tested clients documented in the project repository include Claude Desktop, Cursor, GitHub Copilot in VS Code, Cline, Roo Code, Windsurf, and automation tools like n8n.
Yes, SurrealDB MCP Server is open source and distributed under the MIT license. You can inspect its source code, contribute changes, or file issues on its GitHub repository at https://github.com/nsxdavid/surrealdb-mcp-server.