SurrealDB MCP Server
A Model Context Protocol (MCP) server that provides a standardized interface for AI assistants to interact with a SurrealDB database. This server enables AI systems to query and manipulate data within a configured SurrealDB instance.
Note for AI Assistants: If you are an AI assistant (like Claude, Cline, Copilot, etc.) reading this documentation, please refer to the llms-install.md file for detailed instructions specifically designed for you to help users install and configure this MCP server.
Installation Guide
Which AI assistant are you using?
- 📝 Using Cline VS Code Extension? → Go to Cline Installation
- 🖥️ Using Claude Desktop App? → Go to Claude Installation
- 🤖 Using GitHub Copilot in VS Code? → Go to Copilot Installation
- 🦘 Using Roo Code in VS Code? → Go to Roo Code Installation
- 🌊 Using Windsurf? → Go to Windsurf Installation
- ⚡ Using Cursor? → Go to Cursor Installation
- 🔄 Using n8n? → Go to n8n Integration
Key Terms
- MCP Server: A server that implements the Model Context Protocol, allowing AI assistants to access external tools and resources
- MCP Host: The application (like VS Code with Cline or Claude Desktop) that connects to MCP servers
- SurrealDB: A scalable, distributed, document-graph database with real-time capabilities
Available Tools
The server exposes the following tools for interacting with SurrealDB:
query
: Execute a raw SurrealQL query.select
: Select records from a table (all or by specific ID).create
: Create a single new record in a table.update
: Update a specific record, replacing its content.delete
: Delete a specific record by ID.merge
: Merge data into a specific record (partial update).patch
: Apply JSON Patch operations to a specific record.upsert
: Create a record if it doesn't exist, or update it if it does.insert
: Insert multiple records into a table.insertRelation
: Create a graph relation (edge) between two records.
(Refer to the MCP host's tool listing for detailed input schemas.)
📝 Cline Installation
One-Click Installation for Cline VS Code Extension
- Install the package globally:Copy
- Add to Cline settings:Edit the file at:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Add the following configuration:CopyImportant: Replace
YOUR_USERNAME
with your actual Windows username in the path. - Restart VS Code
- Verify Installation:
- Open Cline in VS Code
- Ask Cline to "list available MCP servers"
- You should see "surrealdb" in the list
🖥️ Claude Installation
Installation for Claude Desktop App
- Configure Claude Desktop to use the server:Edit the Claude Desktop App's MCP settings file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
Add the following configuration:
CopyNote: Using the
npx
command as shown above means the MCP client will automatically download and run the package from npm when needed. No manual installation is required. - Windows:
- Restart Claude Desktop App
- Verify Installation:
- Ask Claude to "list available MCP servers"
- You should see "surrealdb" in the list
🤖 Copilot Installation
Installation for GitHub Copilot in VS Code
- Create a workspace configuration file:Create a file at:
.vscode/mcp.json
in your workspaceAdd the following configuration:CopyNote: This configuration uses VS Code's input variables to securely prompt for and store your SurrealDB credentials.
- Verify Installation:
- Open GitHub Copilot Chat in VS Code
- Select "Agent" mode from the dropdown
- Click the "Tools" button to see available tools
- You should see SurrealDB tools in the list
🦘 Roo Code Installation
Installation for Roo Code in VS Code
- Access MCP Settings:Click the MCP icon in the top navigation of the Roo Code pane, then select "Edit MCP Settings" to open the configuration file.
- Add the SurrealDB MCP Server configuration:Copy
Important: Replace
YOUR_USERNAME
with your actual Windows username in the path. - Restart VS Code
- Verify Installation:
- Open Roo Code in VS Code
- Click the MCP icon to see available servers
- You should see "surrealdb" in the list
🌊 Windsurf Installation
Installation for Windsurf
- Install the package globally:Copy
- Configure Windsurf:
- Open Windsurf on your system
- Navigate to the Settings page
- Go to the Cascade tab
- Find the Model Context Protocol (MCP) Servers section
- Click on "View raw config" to open the configuration file (typically at
~/.codeium/windsurf/mcp_config.json
)
- Add the SurrealDB MCP Server configuration:Copy
Note: Replace
/path/to/global/node_modules
with the actual path to your global node_modules directory. - Restart Windsurf
- Verify Installation:
- Open Cascade in Windsurf
- You should see SurrealDB tools available in the tools list
⚡ Cursor Installation
Installation for Cursor
- Install the package globally:Copy
- Configure Cursor:
- Open Cursor
- Go to Settings > Cursor Settings
- Find the MCP Servers option and enable it
- Click on "Add New MCP Server"
- Add the SurrealDB MCP Server configuration:Copy
Note: Replace
/path/to/global/node_modules
with the actual path to your global node_modules directory. - Restart Cursor
- Verify Installation:
- Open Cursor Chat
- You should see SurrealDB tools available in the tools list
Required Environment Variables
This server requires the following environment variables to connect to your SurrealDB instance:
SURREALDB_URL
: The WebSocket endpoint of your SurrealDB instance (e.g.,ws://localhost:8000
orwss://cloud.surrealdb.com
).SURREALDB_NS
: The target Namespace.SURREALDB_DB
: The target Database.SURREALDB_USER
: The username for authentication (Root, NS, DB, or Scope user).SURREALDB_PASS
: The password for the specified user.
Troubleshooting
Common Issues
"Cannot find module" Error
If you see an error like "Cannot find module 'surrealdb-mcp-server'", try:
- Verify the global installation:
npm list -g surrealdb-mcp-server
- Check the path in your configuration matches the actual installation path
- Try reinstalling:
npm install -g surrealdb-mcp-server
Connection Errors
If you see "Failed to connect to SurrealDB":
- Verify SurrealDB is running:
surreal start --log debug
- Check your connection URL, namespace, database, and credentials
- Ensure your SurrealDB instance is accessible from the path specified
Cline-Specific Issues
If the npx approach doesn't work with Cline:
- Always use the global installation method for Cline
- Specify the full path to node.exe and the installed package
- Make sure to replace YOUR_USERNAME with your actual Windows username
Advanced Configuration
Using a Local Build
If you've cloned the repository or want to use a local build, you can use this configuration:
- Replace
/path/to/your/surrealdb-mcp-server
with the actual path where you cloned the repository - Replace the environment variable values with your actual SurrealDB connection details
Development
If you want to contribute to the development of this MCP server, follow these steps:
Local Development Setup
- Clone the repository:Copy
- Install dependencies:Copy
- Build the project:Copy
Running Locally
Testing
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Integration with n8n
You can integrate this SurrealDB MCP Server with n8n using the n8n-nodes-mcp community node.
NOTE: Currently only the self-hosted (Docker) version of n8n supports community nodes. There is no option for MCP Servers in the n8n cloud version (yet?).
Installation
- Install the n8n-nodes-mcp package:Copy
- Configure n8n to use the custom node:Add the following to your n8n configuration:Copy
- Configure the MCP node in n8n:
- Add the "MCP" node to your workflow
- Configure it to connect to your SurrealDB MCP Server
- Select the desired operation (query, select, create, etc.)
- Configure the operation parameters
For more details, visit the n8n-nodes-mcp GitHub repository.
License
MIT
This server cannot be installed
Connect your AI models to your favorite SurrealDB database, and let the LLMs do all your work for you.
Related MCP Servers
- AsecurityAlicenseAqualityProvides AI models with structured access to Trino's distributed SQL query engine, enabling LLMs to directly query and analyze data stored in Trino databases.Last updated -31PythonMIT License
- -securityAlicense-qualityAllows AI models to interact with SourceSync.ai's knowledge management platform to organize, ingest, retrieve, and search content in knowledge bases.Last updated -141TypeScriptMIT License
- -securityAlicense-qualityAn MCP server implementation that integrates AI assistants with Langfuse workspaces, allowing models to query LLM metrics by time range.Last updated -9JavaScriptApache 2.0
- -securityAlicense-qualityEnables AI agents to interact with multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek) through a standardized interface, making it easy to switch between models or use multiple models in the same application.Last updated -3PythonMIT License