mcp-turso
@nbbaier
MCP server for interacting with Turso-hosted LibSQL databases
Overview
What is mcp-turso?
mcp-turso is a Model Context Protocol (MCP) server that provides access to Turso-hosted LibSQL databases. It allows AI assistants to retrieve database tables, view schemas, describe tables, and perform SELECT queries.
How to use mcp-turso?
Add the server to your MCP client's configuration (e.g., in Claude Desktop or Cursor) by running npx -y mcp-turso and setting the environment variables TURSO_DATABASE_URL and TURSO_AUTH_TOKEN. You need an existing Turso database with its URL and token, which you can obtain via the Turso CLI. Logs are written by default to ~/.npm/_npx/<npx-dir-name>/node_modules/mcp-turso/logs/mcp-turso.log, and a custom path can be specified with the --logs flag (absolute posix path).
Key features of mcp-turso
- List all tables in a Turso database
- Retrieve full database schema as SQL statements
- Describe a specific table’s column names and types
- Execute SELECT queries and return results
- Custom logging support for debugging
Use cases of mcp-turso
- An AI assistant exploring the structure of a Turso database
- Running ad‑hoc SELECT queries on Turso‑hosted data
- Automating schema documentation or migration checks
- Debugging database content without a separate SQL client
FAQ from mcp-turso
What tools does mcp-turso expose?
It provides four tools: list_tables, get_db_schema, describe_table, and query_database. The first two require no input; describe_table takes a table name; query_database takes a SELECT SQL string.
How do I obtain my Turso database URL and token?
Use the Turso CLI: turso db show --url <database-name> for the URL, and turso db tokens create <database-name> for the token. You must have a Turso account and an existing database.
Can I write to the database (INSERT/UPDATE/DELETE)?
No. The server currently only supports SELECT queries. Write operations are listed as a future todo.
Where are the server logs stored?
By default, logs are written to <parent-dir>/logs/mcp-turso.log, where <parent-dir> is the parent of the directory containing the mcp-turso script. When run with npx, the default path is under ~/.npm/_npx/.../node_modules/mcp-turso/logs/. A custom path can be set with the --logs flag (absolute posix path). The log location is printed to stderr on startup.
What authentication does the server require?
You must provide a TURSO_AUTH_TOKEN environment variable, which is the authentication token for your Turso database. This is set in the MCP client configuration (e.g., claude_desktop_config.json).