tursodb includes a built-in MCP server so you can point any MCP-compatible client — Claude Code, Claude Desktop, Cursor, or a custom client — at a Turso database.
Starting the MCP server
Pass the--mcp flag to start in server mode instead of the interactive shell. The server communicates over stdin/stdout using JSON-RPC.
The MCP server does not print a prompt or banner. It reads newline-delimited JSON-RPC messages from stdin and writes responses to stdout.
Available tools
The server exposes nine tools that cover all common database operations.| Tool | Description | Required parameter |
|---|---|---|
open_database | Open or create a database file. Creates parent directories if needed. Use :memory: for an in-memory database. | path (string) |
current_database | Return the path of the currently open database. | — |
list_tables | List all user tables in the database. | — |
describe_table | Return column names, types, nullability, defaults, and primary key flags for a table. | table_name (string) |
execute_query | Execute a read-only SELECT query and return results. Only SELECT statements are accepted. | query (string) |
insert_data | Execute an INSERT statement. Only INSERT statements are accepted. | query (string) |
update_data | Execute an UPDATE statement. Only UPDATE statements are accepted. | query (string) |
delete_data | Execute a DELETE statement. Only DELETE statements are accepted. | query (string) |
schema_change | Execute CREATE, ALTER, or DROP statements to modify the schema. | query (string) |
Client configuration
Generic MCP configuration
Most MCP clients accept a JSON configuration block. Replace the paths with the actual locations on your system.Claude Code
Use theclaude mcp add command to register the server:
| Part | Meaning |
|---|---|
my-database | The name you assign to this MCP server |
-- | Required separator between Claude options and your command |
tursodb | The Turso CLI binary |
./path/to/your/database.db | Path to your database file |
--mcp | Enables MCP server mode |
Claude Desktop
Add the configuration to yourclaude_desktop_config.json file:
Use the full path to
tursodb. Claude Desktop may not resolve binaries from your PATH.Cursor
Alternatively, add the server directly to your Cursor configuration file using the same JSON format shown for Claude Desktop.
Direct JSON-RPC usage
You can drive the MCP server by piping JSON-RPC messages to it directly — useful for scripting or debugging.In-memory database example
Existing database file example
JSON-RPC methods
| Method | Description |
|---|---|
initialize | Handshake required before calling any tools. |
tools/list | Returns the full list of available tools with their input schemas. |
tools/call | Call a specific tool. Params: {"name": "tool_name", "arguments": {...}}. |
Example prompts
Once connected, you can ask your AI assistant in plain language:- “Show me all tables in the database.”
- “What’s the schema for the
userstable?” - “Find all posts with more than 100 upvotes.”
- “Insert a new user with name ‘Alice’ and email ‘[email protected]’.”
- “Rename the
emailcolumn toemail_addressin theuserstable.” - “How many rows are in each table?”
list_tables, describe_table, execute_query, insert_data, schema_change, etc.) and constructs the correct SQL automatically.