Get the FREE Ultimate OpenClaw Setup Guide →

mcp-turso

MCP server for interacting with Turso-hosted LibSQL databases

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio nbbaier-mcp-turso npx -y mcp-turso \
  --env TURSO_AUTH_TOKEN="your_token" \
  --env TURSO_DATABASE_URL="your_url"

How to use

The mcp-turso server exposes a lightweight MCP (Model Context Protocol) interface to interact with Turso-hosted LibSQL databases. It provides four main capabilities: listing all tables in a database, retrieving the database schema, describing the schema of a specific table, and executing SELECT queries via a simple query_database tool. This makes it easy to explore a Turso database and run read-only queries through the MCP client tooling. To use it, configure the server with your Turso database URL and authentication token, then call the available tools with the appropriate inputs. The server returns structured results such as lists of table names, SQL creation statements, column definitions, or query results, enabling seamless integration with your MCP-enabled workflows.

How to install

Prerequisites:

  • Node.js and npm/yarn installed on your system
  • Access to a Turso database, with URL and an authentication token

Installation steps:

  1. Install and run the MCP server using NPX (as described in the README example):
npx -y mcp-turso
  1. Alternatively, configure via your environment to point to your Turso database:
{
  "mcpServers": {
    "turso": {
      "command": "npx",
      "args": ["-y", "mcp-turso"],
      "env": {
        "TURSO_DATABASE_URL": "your_url",
        "TURSO_AUTH_TOKEN": "your_token"
      }
    }
  }
}
  1. If you need to specify a custom log file, add the --logs flag with an absolute path as shown in the examples:
npx -y mcp-turso --logs /Users/<username>/path/to/dir/mcp-logs.log
  1. Ensure the Turso database URL and token are valid. You can obtain the URL via Turso CLI:
turso db show --url <database-name>

and generate a token:

turso db tokens create <database-name>
  1. Start the server and verify that you can connect using your MCP client tooling.

Additional notes

Notes and tips:

  • The server exposes the following tools: list_tables (no input; returns an array of table names), get_db_schema (no input; returns SQL creation statements), describe_table (input: table_name; returns column definitions), and query_database (input: sql; returns { columns, rows, rowCount }).
  • The default logs are written to a path under your home directory (as described in the README); you can override this with the --logs option using an absolute path.
  • If running in a Windows environment, be aware that custom logging file support may not be implemented yet, though the Node-based NPX approach generally works cross-platform.
  • Keep your Turso URL and token secure; avoid committing them to version control. Consider using environment-variable management or secret storage in your deployment environment.
  • If you encounter connection errors, double-check the Turso URL, token validity, and network access to Turso endpoints.

Related MCP Servers

Sponsor this space

Reach thousands of developers