
This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

A Model Context Protocol server that lets AI assistants query and manage SurrealDB databases through tools for CRUD operations, graph relationships, and bulk inserts.
SurrealDB MCP Server is cataloged as an MCP server attributed to lfnovo. A Model Context Protocol server that lets AI assistants query and manage SurrealDB databases through tools for CRUD operations, graph relationships, and bulk inserts. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for SurrealDB MCP Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
Yes, all tools support optional namespace and database parameters to override the environment defaults.
Without those environment variables, you must provide namespace and database parameters in each tool call.
README.md · 6e87e48b3363 · 采集于 2026-11-13 10:27:07 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
A Model Context Protocol (MCP) server that enables AI assistants to interact with SurrealDB databases
The SurrealDB MCP Server bridges the gap between AI assistants and SurrealDB, providing a standardized interface for database operations through the Model Context Protocol. This enables LLMs to:
# Run directly from PyPI (once published)
uvx surreal-mcp
# Or run from GitHub
uvx --from git+https://github.com/yourusername/surreal-mcp.git surreal-mcp
# Clone the repository
git clone https://github.com/yourusername/surreal-mcp.git
cd surreal-mcp
# Install dependencies
uv sync
# Run the server (multiple ways)
uv run surreal-mcp
# or
uv run python -m surreal_mcp
# or
uv run python main.py
# Clone the repository
git clone https://github.com/yourusername/surreal-mcp.git
cd surreal-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install package
pip install -e .
# Run the server
surreal-mcp
# or
python -m surreal_mcp
The server uses environment variables for configuration.
| Variable | Description | Example |
|---|---|---|
SURREAL_URL | SurrealDB connection URL | ws://localhost:8000/rpc |
SURREAL_USER | Database username | root |
SURREAL_PASSWORD | Database password | root |
| Variable | Description | Example |
|---|---|---|
SURREAL_NAMESPACE | Default SurrealDB namespace | test |
SURREAL_DATABASE | Default SurrealDB database | test |
Note: If
SURREAL_NAMESPACEandSURREAL_DATABASEare not set as environment variables, you must providenamespaceanddatabaseparameters in each tool call.
You can copy .env.example to .env and update with your values:
cp .env.example .env
# Edit .env with your database credentials
Or set them manually:
export SURREAL_URL="ws://localhost:8000/rpc"
export SURREAL_USER="root"
export SURREAL_PASSWORD="root"
export SURREAL_NAMESPACE="test"
export SURREAL_DATABASE="test"
Add to your MCP client settings (e.g., Claude Desktop):
Using uvx (recommended):
{
"mcpServers": {
"surrealdb": {
"command": "uvx",
"args": ["surreal-mcp"],
"env": {
"SURREAL_URL": "ws://localhost:8000/rpc",
"SURREAL_USER": "root",
"SURREAL_PASSWORD": "root",
"SURREAL_NAMESPACE": "test",
"SURREAL_DATABASE": "test"
}
}
}
}
Using local installation:
{
"mcpServers": {
"surrealdb": {
"command": "uv",
"args": ["run", "surreal-mcp"],
"env": {
"SURREAL_URL": "ws://localhost:8000/rpc",
"SURREAL_USER": "root",
"SURREAL_PASSWORD": "root",
"SURREAL_NAMESPACE": "test",
"SURREAL_DATABASE": "test"
}
}
}
}
All tools support optional namespace and database parameters to override the default values from environment variables.
Execute raw SurrealQL queries for complex operations.
-- Example: Complex query with graph traversal
SELECT *, ->purchased->product FROM user WHERE age > 25
# Query with namespace/database override
query("SELECT * FROM user", namespace="production", database="main")
Retrieve all records from a table or a specific record by ID.
# Get all users
select("user")
# Get specific user
select("user", "john")
# Select from a different database
select("user", namespace="other_ns", database="other_db")
Create a new record with auto-generated ID.
create("user", {
"name": "Alice",
"email": "alice@example.com",
"age": 30
})
Replace entire record content (preserves ID and timestamps).
update("user:john", {
"name": "John Smith",
"email": "john.smith@example.com",
"age": 31
})
Permanently remove a record from the database.
delete("user:john")
Partially update specific fields without affecting others.
merge("user:john", {
"email": "newemail@example.com",
"verified": True
})
Apply JSON Patch operations (RFC 6902) to records.
patch("user:john", [
{"op": "replace", "path": "/email", "value": "new@example.com"},
{"op": "add", "path": "/verified", "value": True}
])
Create or update a record with specific ID.
upsert("settings:global", {
"theme": "dark",
"language": "en"
})
Bulk insert multiple records efficiently.
insert("product", [
{"name": "Laptop", "price": 999.99},
{"name": "Mouse", "price": 29.99},
{"name": "Keyboard", "price": 79.99}
])
Create graph relationships between records.
relate(
"user:john", # from
"purchased", # relation name
"product:laptop-123", # to
{"quantity": 1, "date": "2024-01-15"} # relation data
)
# Create a user
user = create("user", {"name": "Alice", "email": "alice@example.com"})
# Update specific fields
merge(user["id"], {"verified": True, "last_login": "2024-01-01"})
# Query with conditions
results = query("SELECT * FROM user WHERE verified = true ORDER BY created DESC")
# Delete when done
delete(user["id"])
# Create entities
user = create("user", {"name": "John"})
product = create("product", {"name": "Laptop", "price": 999})
# Create relationship
relate(user["id"], "purchased", product["id"], {
"quantity": 1,
"total": 999,
"date": "2024-01-15"
})
# Query relationships
purchases = query(f"SELECT * FROM {user['id']}->purchased->product")
# Insert multiple records
products = insert("product", [
{"name": "Laptop", "category": "Electronics", "price": 999},
{"name": "Mouse", "category": "Electronics", "price": 29},
{"name": "Desk", "category": "Furniture", "price": 299}
])
# Bulk update with query
query("UPDATE product SET on_sale = true WHERE category = 'Electronics'")
<<<<<<< HEAD
=======
You can work with multiple databases in a single session by using the namespace and database parameters:
# Create a record in the production database
create("user", {"name": "Alice"}, namespace="prod", database="main")
# Query from staging database
select("user", namespace="staging", database="main")
# Copy data between databases
users = select("user", namespace="staging", database="main")
for user in users["data"]:
create("user", user, namespace="prod", database="main")
Behavior Summary:
| Scenario | Result |
|---|---|
| Env vars set, no params | Uses pooled connection (best performance) |
| Env vars set, params provided | Uses override connection with specified namespace/database |
| No env vars, params provided | Uses override connection with specified namespace/database |
| No env vars, no params | Fails with clear error message |
main
The server is built with:
The project includes a comprehensive test suite using pytest.
# Make sure SurrealDB is running
surreal start --user root --pass root
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=surreal_mcp
# Run specific test file
uv run pytest tests/test_tools.py
# Run specific test class or method
uv run pytest tests/test_tools.py::TestQueryTool
uv run pytest tests/test_tools.py::TestQueryTool::test_query_simple
# Run with verbose output
uv run pytest -v
# Run only tests matching a pattern
uv run pytest -k "test_create"
tests/
├── __init__.py
├── conftest.py # Fixtures and test configuration
├── test_tools.py # Tests for all MCP tools
├── test_server.py # Tests for server configuration
└── test_namespace_override.py # Tests for namespace/database override
The test suite includes fixtures for common test data:
clean_db - Ensures clean database statesample_user_data - Sample user datacreated_user - Pre-created user recordcreated_product - Pre-created product recordExample test:
@pytest.mark.asyncio
async def test_create_user(clean_db, sample_user_data):
result = await mcp._tools["create"].func(
table="user",
data=sample_user_data
)
assert result["success"] is True
assert result["data"]["email"] == sample_user_data["email"]
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)This project is licensed under the MIT License - see the LICENSE file for details.
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for SurrealDB MCP Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/surreal-mcp)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

A Model Context Protocol server that lets AI assistants run SQL queries against AWS Athena databases and retrieve results.

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.