### Start SurrealMCP Server with Basic Configuration Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Starts the SurrealMCP server with specified bind address, SurrealDB server URL, cloud authentication server, expected audience, and rate limiting parameters. ```bash surrealmcp start \ --bind-address 127.0.0.1:8000 \ --server-url https://mcp.surrealdb.com \ --cloud-auth-server https://auth.surrealdb.com \ --expected-audience https://custom.audience.com/ \ --rate-limit-rps 100 \ --rate-limit-burst 200 ``` -------------------------------- ### Complete SurrealMCP Authentication Configuration Example Source: https://github.com/surrealdb/surrealmcp/blob/main/AUTHENTICATION.md Demonstrates how to apply multiple authentication configuration options simultaneously using either command-line arguments or environment variables. ```bash # Using command-line arguments surrealmcp \ --server_url "http://localhost:8000" \ --auth_server "https://auth.surrealdb.com" \ --auth_audience "https://your-mcp-server.com" # Using environment variables export SURREAL_MCP_SERVER_URL="http://localhost:8000" export SURREAL_MCP_AUTH_SERVER="https://auth.surrealdb.com" export SURREAL_MCP_AUTH_AUDIENCE="https://your-mcp-server.com" surrealmcp ``` -------------------------------- ### SurrealDB Authentication Configuration Example Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md An example JSON response from the authentication discovery endpoint, detailing the resource, authorization servers, bearer methods, and the required audience for token requests. ```json { "resource": "https://mcp.surrealdb.com", "authorization_servers": ["https://auth.surrealdb.com"], "bearer_methods_supported": ["header"], "audience": "https://mcp.surrealdb.com/" } ``` -------------------------------- ### SurrealDB Enhanced Select Query Examples (Rust) Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Provides examples of using the enhanced `select` tool in SurrealDB for advanced querying, including filtering, sorting, grouping, pagination, and parameterized queries. These examples demonstrate flexible data retrieval capabilities. ```rust select("person", Some("age > 25"), None, None, Some("name ASC"), Some("10"), None) select("article", Some("published = true"), Some("author"), Some("author"), Some("created_at DESC"), Some("20"), None) select("person", Some("city = 'NYC'"), None, None, Some("age DESC"), Some("5"), Some("10")) select("person", Some("age > $min_age AND name CONTAINS $name_filter"), None, None, None, Some("10"), None, Some({"min_age": 25, "name_filter": "John"})) ``` -------------------------------- ### Blog System Example in SQL Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Illustrates a common pattern for building a blog system using SurrealQL, including creating authors and articles, establishing relationships, and querying data. ```sql -- Create authors and articles CREATE person:john CONTENT { name: 'John Doe', email: 'john@example.com' }; CREATE article:surreal_guide CONTENT { title: 'SurrealDB Guide', content: '...' }; -- Create relationships RELATE person:john->wrote->article:surreal_guide; RELATE article:surreal_guide->has->category:technology; -- Query articles by author SELECT * FROM article WHERE ->wrote->person.name = 'John Doe'; -- Query authors by article category SELECT * FROM person WHERE ->wrote->article->has->category.name = 'Technology'; ``` -------------------------------- ### Install SurrealMCP using Cargo Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This command installs the SurrealMCP server from source using the Cargo package manager. Ensure you have Rust and Cargo installed. ```bash cargo install --path . ``` -------------------------------- ### SurrealMCP Basic Usage Commands Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md These bash commands demonstrate the basic usage of SurrealMCP, including starting it as a STDIO server, an HTTP server, or via a Unix socket. ```bash # Start as a STDIO server (default) surrealmcp start # Start as a HTTP server surrealmcp start --bind-address 127.0.0.1:8000 # Start as a Unix socket surrealmcp start --socket-path /tmp/surrealmcp.sock ``` -------------------------------- ### SurrealDB Cloud Management Operations Examples (Rust) Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Demonstrates how to manage SurrealDB Cloud instances using the MCP server. This includes listing, pausing, resuming, and creating cloud instances. ```rust list_cloud_instances() pause_cloud_instance("my-instance-id") resume_cloud_instance("my-instance-id") create_cloud_instance({"name": "new-instance", "region": "us-east-1"}) ``` -------------------------------- ### SurrealQL CREATE Statement Examples Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Illustrates how to create new records in SurrealDB, including single records, multiple records, and records with specific IDs. ```SurrealQL -- Create a single record CREATE person:john CONTENT { name: 'John Doe', age: 30, email: 'john@example.com' }; -- Create multiple records CREATE person CONTENT [ { name: 'Alice', age: 25 }, { name: 'Bob', age: 35 } ]; -- Create with specific ID CREATE person:alice CONTENT { name: 'Alice', age: 25 }; ``` -------------------------------- ### SurrealMCP Configuration Options Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This bash example shows how to configure SurrealMCP with database connection details such as endpoint, namespace, database, user, and password. ```bash # Database connection surrealmcp start \ --endpoint ws://localhost:8000/rpc \ --ns mynamespace \ --db mydatabase \ --user root \ --pass root ``` -------------------------------- ### Start SurrealMCP Server with Authentication Disabled Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Starts the SurrealMCP server with authentication disabled, useful for development environments. It only requires the bind address. ```bash surrealmcp start --bind-address 127.0.0.1:8000 --auth-disabled ``` -------------------------------- ### Set Pre-configured Cloud Authentication Tokens via Environment Variables Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Starts the SurrealMCP server after setting pre-configured access and refresh tokens for SurrealDB Cloud authentication using environment variables. ```bash export SURREAL_MCP_CLOUD_ACCESS_TOKEN="your_access_token_here" export SURREAL_MCP_CLOUD_REFRESH_TOKEN="your_refresh_token_here" surrealmcp start ``` -------------------------------- ### Set Pre-configured Cloud Authentication Tokens via Command Line Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Starts the SurrealMCP server and provides pre-configured access and refresh tokens for SurrealDB Cloud authentication using command-line arguments. ```bash surrealmcp start \ --access-token "your_access_token_here" \ --refresh-token "your_refresh_token_here" ``` -------------------------------- ### SurrealQL DELETE Statement Examples Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Provides examples of how to delete records from SurrealDB, including deleting specific records, all records from a table, and records based on specified conditions. ```SurrealQL -- Delete a specific record DELETE person:john; -- Delete all records from a table DELETE person; -- Delete with conditions DELETE person WHERE age < 18; ``` -------------------------------- ### Configure Custom Audience via Environment Variable Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Starts the SurrealMCP server after setting the custom expected audience using an environment variable. ```bash export SURREAL_MCP_EXPECTED_AUDIENCE="https://myapp.com/api" surrealmcp start ``` -------------------------------- ### SurrealQL RELATE Statement Examples Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Demonstrates how to establish relationships between records in SurrealDB, including simple relationships, relationships with edge data, and creating multiple relationships. ```SurrealQL -- Create a simple relationship RELATE person:john->knows->person:jane; -- Create relationship with content on the edge RELATE person:john->wrote->article:surreal_guide CONTENT { date: '2024-01-15', word_count: 1500 }; -- Create multiple relationships RELATE person:john->knows->person:jane; RELATE person:john->knows->person:bob; ``` -------------------------------- ### SurrealQL SELECT Statement Examples Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Demonstrates various ways to query data in SurrealDB using the SELECT statement, including filtering, sorting, grouping, pagination, and traversing relationships. ```SurrealQL -- Select all records from a table (secure with type::table) SELECT * FROM type::table($table); -- Select specific fields SELECT name, age FROM type::table($table); -- Select by record ID (secure with type::table) SELECT * FROM type::table($table):john; -- Select with WHERE conditions SELECT * FROM type::table($table) WHERE age > 25; -- Select with WHERE, ORDER BY, and LIMIT SELECT * FROM type::table($table) WHERE age > 25 ORDER BY name LIMIT 10; -- Select with SPLIT ON (split records on specific fields) SELECT * FROM type::table($table) SPLIT ON age, city; -- Select with GROUP BY SELECT count(), age FROM type::table($table) GROUP BY age; -- Select with pagination (LIMIT and START AT) SELECT * FROM type::table($table) ORDER BY name LIMIT 10 START AT 20; -- Select with relationships (graph queries) SELECT * FROM type::table($table) WHERE ->knows->person.age > 30; -- Select with nested relationships SELECT * FROM type::table($table) WHERE ->wrote->article->has->category.name = 'Technology'; -- Select with aggregation SELECT count() FROM type::table($table); SELECT count() FROM type::table($table) GROUP BY author; -- Select with subqueries SELECT * FROM type::table($table) WHERE id IN (SELECT author FROM article); -- Complex query with multiple clauses SELECT * FROM type::table($table) WHERE age > 25 AND city = 'NYC' SPLIT ON age GROUP BY age, city ORDER BY age DESC LIMIT 10 START AT 5; ``` -------------------------------- ### SurrealDB Basic Operations Examples (Rust) Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Illustrates basic data manipulation operations in SurrealDB using the MCP server's tools. This includes creating records, selecting data, updating records with different modes, relating records, and deleting records. ```rust create("person", {"name": "Alice", "age": 25}) select("person") update("person:alice", {"age": 26}, Some("merge")) relate("person:john", "wrote", "article:surreal_intro", None) delete("person:jane") ``` -------------------------------- ### Configure VS Code for SurrealDB with Docker Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration sets up SurrealDB integration for VS Code using Docker. It specifies the command to run the SurrealDB SurrealMCP Docker image and start it. ```json { "servers": { "SurrealDB": { "type": "stdio", "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ] } } } ``` -------------------------------- ### Request Token from Authorization Server (Example Auth0) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Demonstrates how a client can request an access token from an authorization server like Auth0, specifying client credentials, audience, and grant type. ```json { "client_id": "your-client-id", "client_secret": "your-client-secret", "audience": "https://custom.audience.com/", "grant_type": "client_credentials" } ``` -------------------------------- ### SurrealDB Health Check API Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Performs a health check on the SurrealDB instance by sending a GET request to the `/health` endpoint. ```bash curl http://localhost:8000/health ``` -------------------------------- ### Configure Custom Audience via Command Line Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Starts the SurrealMCP server and sets a custom expected audience for JWT token validation using a command-line argument. ```bash surrealmcp start --expected-audience "https://myapp.com/api" ``` -------------------------------- ### Configure Roo Code for SurrealDB with Docker Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration sets up SurrealDB integration for Roo Code in VS Code using Docker. It specifies the command to run the SurrealDB SurrealMCP Docker image and start it, with options for disabling and auto-approving. ```json { "mcpServers": { "SurrealDB": { "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### SurrealQL UPDATE Statement Examples Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Shows different methods for updating records in SurrealDB, such as replacing the entire content, merging data, applying JSON patch operations, and updating multiple records based on conditions. ```SurrealQL -- Replace entire record content UPDATE person:john CONTENT { name: 'John Doe', age: 31, city: 'New York' }; -- Merge new data with existing data UPDATE person:john MERGE { age: 31, city: 'New York' }; -- Apply JSON patch operations UPDATE person:john PATCH [ { op: 'replace', path: '/age', value: 31 }, { op: 'add', path: '/city', value: 'New York' } ]; -- Update multiple records UPDATE person SET age += 1 WHERE age < 30; ``` -------------------------------- ### Test SurrealDB MCP Project Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Runs the test suite for the SurrealDB MCP project using Cargo. ```bash cargo test ``` -------------------------------- ### Real-time Subscriptions in SurrealQL Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Sets up live queries to receive real-time updates for data changes. Supports live queries on all records, with conditions, and for relationships. ```surql -- Set up live query for all person records LIVE SELECT * FROM person; -- Live query with conditions LIVE SELECT * FROM person WHERE age > 25; -- Live query for relationships LIVE SELECT * FROM person WHERE ->knows->person.age > 30; ``` -------------------------------- ### Build SurrealDB MCP Project Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Compiles the SurrealDB MCP project using Cargo, the Rust build system and package manager. ```bash cargo build ``` -------------------------------- ### SurrealDB MCP Connection and Query Workflow (Rust) Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Demonstrates a typical workflow for connecting to a SurrealDB database using the MCP server, performing data creation, switching endpoints, querying, and disconnecting. It showcases the use of `connect_endpoint`, `create`, `select`, and `disconnect_endpoint` functions. ```rust connect_endpoint("memory", None, None, None, None) create("person", {"name": "John", "age": 30}) connect_endpoint("file:/tmp/mydb", Some("myapp"), Some("production"), None, None) select("person") disconnect_endpoint() ``` -------------------------------- ### Run SurrealDB MCP with Docker Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Builds a Docker image for the SurrealDB MCP project and runs it, exposing port 8000 for network access. ```bash docker build -t surrealmcp . docker run -p 8000:8000 surrealmcp start --bind-address 0.0.0.0:8000 ``` -------------------------------- ### Configure Zed with SurrealMCP (Environment Variables) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This configuration adds SurrealDB to Zed's context servers using the `surrealmcp` command directly, with environment variables for database connection details. ```json "surreal": { "source": "custom", "command": "surrealmcp", "args": ["start"], "enabled": true, "env": { "SURREALDB_URL": "ws://localhost:8000/rpc", "SURREALDB_NS": "myapp", "SURREALDB_DB": "production", "SURREALDB_USER": "admin", "SURREALDB_PASS": "password123" } } ``` -------------------------------- ### Connect to SurrealDB Cloud Instance Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Connects to a SurrealDB Cloud instance using the `connect_endpoint` tool. This process automatically fetches authentication tokens, validates instance readiness, and establishes secure connections. It supports namespace and database specification and handles connection errors with logging. ```bash connect_endpoint('cloud:abc123def456', 'myapp', 'production') ``` -------------------------------- ### Configure Windsurf with SurrealMCP (Environment Variables) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This configuration adds SurrealDB as a server in Windsurf using the `surrealmcp` command directly, with environment variables for database connection details. ```json { "servers": [ { "name": "SurrealDB", "command": "surrealmcp", "args": ["start"], "env": { "SURREALDB_URL": "ws://localhost:8000/rpc", "SURREALDB_NS": "myapp", "SURREALDB_DB": "production", "SURREALDB_USER": "admin", "SURREALDB_PASS": "password123" } } ] } ``` -------------------------------- ### Configure SurrealMCP Authentication Server Source: https://github.com/surrealdb/surrealmcp/blob/main/AUTHENTICATION.md Specifies the URL of the authentication server. This configuration can be managed using command-line arguments or environment variables. ```bash # Command-line surrealmcp --auth_server "https://auth.surrealdb.com" # Environment variable export SURREAL_MCP_AUTH_SERVER="https://auth.surrealdb.com" surrealmcp ``` -------------------------------- ### Deploy SurrealMCP with Docker (STDIO) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration demonstrates how to deploy SurrealMCP using Docker for STDIO communication. It specifies the Docker command to run the SurrealMCP image. ```json { "mcpServers": { "SurrealDB": { "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ] } } } ``` -------------------------------- ### Configure Zed with SurrealMCP (Docker) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This configuration adds SurrealDB to Zed's context servers using Docker. It specifies the Docker command to run the SurrealMCP image. ```json "surreal": { "source": "custom", "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ], "enabled": true } ``` -------------------------------- ### Configure VS Code for SurrealDB with Environment Variables Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration allows SurrealDB integration in VS Code using environment variables for connection details. It prompts the user for necessary information like URL, namespace, database, username, and password. ```json { "inputs": [ { "type": "promptString", "id": "surrealdb-url", "description": "SurrealDB URL", "default": "ws://localhost:8000/rpc" }, { "type": "promptString", "id": "surrealdb-ns", "description": "SurrealDB Namespace" }, { "type": "promptString", "id": "surrealdb-db", "description": "SurrealDB Database" }, { "type": "promptString", "id": "surrealdb-user", "description": "SurrealDB Username" }, { "type": "promptString", "id": "surrealdb-pass", "description": "SurrealDB Password", "password": true } ], "servers": { "SurrealDB": { "type": "stdio", "command": "surrealmcp", "args": ["start"], "env": { "SURREALDB_URL": "${input:surrealdb-url}", "SURREALDB_NS": "${input:surrealdb-ns}", "SURREALDB_DB": "${input:surrealdb-db}", "SURREALDB_USER": "${input:surrealdb-user}", "SURREALDB_PASS": "${input:surrealdb-pass}" } } } } ``` -------------------------------- ### String Operations in SurrealQL Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Explains how to perform string matching and utilize string functions in SurrealQL. Enables filtering and manipulation of text data. ```surql -- String matching SELECT * FROM person WHERE name CONTAINS 'John'; -- String functions SELECT * FROM person WHERE string::uppercase(name) = 'JOHN'; ``` -------------------------------- ### Set Environment Variables for SurrealMCP Configuration Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Sets various environment variables to configure the SurrealDB MCP server, including connection details, authentication parameters, and rate limiting. ```bash export SURREALDB_URL="ws://localhost:8000/rpc" export SURREALDB_NS="mynamespace" export SURREALDB_DB="mydatabase" export SURREALDB_USER="root" export SURREALDB_PASS="root" export SURREAL_MCP_BIND_ADDRESS="127.0.0.1:8000" export SURREAL_MCP_SERVER_URL="https://mcp.surrealdb.com" export SURREAL_CLOUD_AUTH_SERVER="https://auth.surrealdb.com" export SURREAL_MCP_EXPECTED_AUDIENCE="https://custom.audience.com/" export SURREAL_MCP_RATE_LIMIT_RPS="100" export SURREAL_MCP_RATE_LIMIT_BURST="200" export SURREAL_MCP_AUTH_REQUIRED="false" export SURREAL_MCP_CLOUD_ACCESS_TOKEN="your_access_token_here" export SURREAL_MCP_CLOUD_REFRESH_TOKEN="your_refresh_token_here" surrealmcp start ``` -------------------------------- ### Configure Schema in SurrealQL Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Defines tables, fields, indexes, and roles with permissions in SurrealQL. This is essential for structuring your database and controlling access. ```surql DEFINE TABLE person SCHEMAFULL; DEFINE FIELD name ON TABLE person TYPE string; DEFINE FIELD age ON TABLE person TYPE int; DEFINE FIELD email ON TABLE person TYPE string; DEFINE INDEX idx_name ON TABLE person COLUMNS name; DEFINE INDEX idx_age ON TABLE person COLUMNS age; DEFINE ROLE admin ON TABLE person PERMISSIONS ALL; DEFINE ROLE user ON TABLE person PERMISSIONS SELECT, UPDATE WHERE id = $auth.id; ``` -------------------------------- ### Configure SurrealDB MCP Server for Cursor Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This configuration adds SurrealDB as an MCP server in Cursor. It specifies the command to run SurrealMCP using Docker. An alternative configuration using environment variables is also provided. ```json { "name": "SurrealDB", "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ] } ``` ```json { "name": "SurrealDB", "command": "surrealmcp", "args": ["start"], "env": { "SURREALDB_URL": "ws://localhost:8000/rpc", "SURREALDB_NS": "myapp", "SURREALDB_DB": "production", "SURREALDB_USER": "admin", "SURREALDB_PASS": "password123" } } ``` -------------------------------- ### Configure Windsurf with SurrealMCP (Docker) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This configuration adds SurrealDB as a server in Windsurf using Docker. It specifies the Docker command to run the SurrealMCP image. ```json { "servers": [ { "name": "SurrealDB", "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ] } ] } ``` -------------------------------- ### Deploy SurrealMCP with Docker (HTTP) Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration shows how to deploy SurrealMCP using Docker as an HTTP server. It specifies the Docker command to run the SurrealMCP image and bind to a specific address. ```json { "mcpServers": { "SurrealDB": { "command": "docker", "args": [ "run", "--rm", "-p", "8080:8080", "--pull", "always", "surrealdb/surrealmcp:latest", "start", "--bind-address", "127.0.0.1:8080", "--server-url", "http://localhost:8080" ] } } } ``` -------------------------------- ### Configure SurrealDB MCP Server for Claude Desktop App Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This configuration integrates SurrealDB as an MCP server for the Claude Desktop application. It provides two methods: running SurrealMCP via Docker or directly using the `surrealmcp` command with specified environment variables. ```json { "mcpServers": { "SurrealDB": { "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ], "disabled": false, "autoApprove": [] } } } ``` ```json { "mcpServers": { "SurrealDB": { "command": "surrealmcp", "args": ["start"], "env": { "SURREALDB_URL": "ws://localhost:8000/rpc", "SURREALDB_NS": "myapp", "SURREALDB_DB": "production", "SURREALDB_USER": "admin", "SURREALDB_PASS": "password123" }, "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Configure SurrealMCP Server URL Source: https://github.com/surrealdb/surrealmcp/blob/main/AUTHENTICATION.md Sets the local server URL for authentication callbacks. This can be done via a command-line argument or an environment variable. ```bash # Command-line surrealmcp --server_url "http://localhost:8000" # Environment variable export SURREAL_MCP_SERVER_URL="http://localhost:8000" surrealmcp ``` -------------------------------- ### Array and Object Operations in SurrealQL Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Demonstrates how to perform operations on array and object data types within SurrealQL. This includes accessing nested properties and filtering based on array contents. ```surql -- Access nested object properties SELECT name, profile.city FROM person; -- Array operations SELECT * FROM person WHERE tags CONTAINS 'developer'; -- Object operations SELECT * FROM person WHERE profile.age > 25; ``` -------------------------------- ### SurrealDB Authentication Discovery API Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Retrieves the authorization server configuration, including the expected audience, from the `.well-known/oauth-protected-resource` endpoint. This information is crucial for clients to obtain authentication tokens. ```bash curl http://localhost:8000/.well-known/oauth-protected-resource ``` -------------------------------- ### Time and Date Operations in SurrealQL Source: https://github.com/surrealdb/surrealmcp/blob/main/instructions.md Covers time-based queries and the use of date functions in SurrealQL. Allows filtering data based on specific dates and extracting date components. ```surql -- Time-based queries SELECT * FROM article WHERE created_at > '2024-01-01'; -- Date functions SELECT * FROM event WHERE time::day(created_at) = time::day(now()); ``` -------------------------------- ### Deploy SurrealMCP using Docker Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This command deploys the latest version of the SurrealMCP server using Docker. It ensures the container is run in interactive mode and always pulls the latest image. ```bash docker run --rm -i --pull always surrealdb/surrealmcp:latest start ``` -------------------------------- ### Configure Roo Code for SurrealDB with Environment Variables Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration enables SurrealDB integration for Roo Code in VS Code using environment variables. It defines connection parameters such as URL, namespace, database, username, and password directly within the configuration. ```json { "mcpServers": { "SurrealDB": { "command": "surrealmcp", "args": ["start"], "env": { "SURREALDB_URL": "ws://localhost:8000/rpc", "SURREALDB_NS": "myapp", "SURREALDB_DB": "production", "SURREALDB_USER": "admin", "SURREALDB_PASS": "password123" }, "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Discover Authorization Configuration Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Retrieves the authorization configuration for the MCP server, typically used by clients to understand authentication requirements. ```http curl http://localhost:8000/.well-known/oauth-protected-resource ``` -------------------------------- ### Configure SurrealDB MCP Server for Cline VS Code Extension Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md This JSON configuration enables SurrealDB as an MCP server within the Cline VS Code extension. It includes options for running SurrealMCP via Docker or directly, along with environment variables for connection details. ```json { "mcpServers": { "SurrealDB": { "command": "docker", "args": [ "run", "--rm", "-i", "--pull", "always", "surrealdb/surrealmcp:latest", "start" ], "disabled": false, "autoApprove": [] } } } ``` ```json { "mcpServers": { "SurrealDB": { "command": "surrealmcp", "args": ["start"], "env": { "SURREALDB_URL": "ws://localhost:8000/rpc", "SURREALDB_NS": "myapp", "SURREALDB_DB": "production", "SURREALDB_USER": "admin", "SURREALDB_PASS": "password123" }, "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Configure SurrealMCP Authentication Audience Source: https://github.com/surrealdb/surrealmcp/blob/main/AUTHENTICATION.md Defines the audience for authentication tokens. This setting is configurable through command-line arguments or environment variables. ```bash # Command-line surrealmcp --auth_audience "https://your-mcp-server.com" # Environment variable export SURREAL_MCP_AUTH_AUDIENCE="https://your-mcp-server.com" surrealmcp ``` -------------------------------- ### Use Token for Authenticated Requests Source: https://github.com/surrealdb/surrealmcp/blob/main/README.md Shows how to include an authorization Bearer token in the header of a request to an MCP server endpoint for authenticated access. ```http curl -H "Authorization: Bearer YOUR_TOKEN" \ http://localhost:8000/mcp ``` -------------------------------- ### Disable SurrealMCP Authentication Source: https://github.com/surrealdb/surrealmcp/blob/main/AUTHENTICATION.md Completely disables authentication, which also prevents SurrealDB Cloud methods from being called. This can be achieved via a command-line flag or an environment variable. ```bash # Command-line surrealmcp --auth_disabled # Environment variable export SURREAL_MCP_AUTH_DISABLED=true surrealmcp ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.