Database Superpowers for Your AI Assistant using MCP

Scott SpenceScott Spence
Cover image for Database Superpowers for Your AI Assistant using MCP

I've been building various MCP tools lately, and this one brings Turso database capabilities to AI assistants. If you're not familiar with MCP (Model Context Protocol), it's a standard that allows AI assistants to use external tools. I've written about setting up MCP servers with Claude Desktop in WSL before.

Today, I'm excited to share a new MVP tool for Turso Cloud. This MCP tool gives AI assistants like Claude direct access to your databases hosted with Turso Cloud.

The tool maintains context between queries, so conversations flow naturally. For example:

  1. You ask: "Show me the tables in my tenant-1 database"
  2. Then ask: "Show me the top ten users"

The assistant remembers you're working with tenant-1 and queries the users table from that database — no need to specify the database again. Same goes for referencing recently created tables and query results.

#Key Features

The tool provides two sets of capabilities that cover both day-to-day database operations and higher-level organization management:

#Database Operations

  • list_tables: View all tables in a database
  • execute_query: Run any SQL query against your database
  • describe_table: Get detailed schema information for a table
  • vector_search: Perform vector similarity search (if you're using vector extensions)

#Organization Management

  • list_databases: See all databases in your Turso organization
  • create_database: Create a new database
  • delete_database: Remove a database
  • generate_database_token: Create access tokens with specific permissions

#Getting Started

Assuming you're already familiar with Turso, and you have an account, here's how to set up the MCP tool:

  1. Configure your Cline/Claude Desktop MCP settings:

    Add this to your MCP settings:

    {
      "mcpServers": {
        "mcp-turso-cloud": {
          "command": "npx",
          "args": ["-y", "mcp-turso-cloud"],
          "env": {
            "TURSO_API_TOKEN": "your-turso-api-token",
            "TURSO_ORGANIZATION": "your-organization-name",
            "TURSO_DEFAULT_DATABASE": "optional-default-database"
          }
        }
      }
    }
    
  2. If you're using WSL with Claude Desktop, use this configuration instead:

    {
      "mcpServers": {
        "mcp-turso-cloud": {
          "command": "wsl.exe",
          "args": [
            "bash",
            "-c",
            "TURSO_API_TOKEN=your-token TURSO_ORGANIZATION=your-org npx mcp-turso-cloud"
          ]
        }
      }
    }
    
  3. Connect Claude to your MCP server:

    • Open Claude Desktop
    • Verify the mcp-turso-cloud server is listed and enabled

#Example Interactions

Once connected, you can have conversations with Claude about your databases like these:

  • List all databases in my Turso organization

  • Create a new table called 'products' with columns for id, name, price and description

  • Show me the schema of the users table

  • Run a query to find all orders placed in the last week

  • Delete the test_data table

#What's next for MCP Turso Cloud?

One of the most powerful features planned for the next version of mcp-turso-cloud is the ability to work with database branches and forks directly through your AI assistant:

Soon you'll be able to easily create branches of your production database to iterate on schema changes or test new features:

"Create a branch of 'production-db' called 'feature-user-preferences'"

This will allow you to safely experiment with changes without affecting your live database for things like testing schema migrations on a branch, verifying queries against the new schema, and comparing performance between branch and main database.

Too afraid to give AI agents full access to your databases? Fear not! Another important feature coming is to allow the use of read-only tokens for databases so AI agents can't accidentally modify your data.

#Building Your Own MCP Tools

If you're interested in creating your own MCP tools, check out my other guides:

This is a guest post by a customer, partner or community user of Turso.
scarf