# mcp-libsql

> mcp-libsql is an open-source MCP server for databases. MCP server giving AI clients safe SQL access to libSQL and Turso databases. It is available on CLI, macOS, Linux, Windows and Self-hosted.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, macOS, Linux, Windows, Self-hosted
- **Repository:** https://github.com/xexr/mcp-libsql
- **GitHub stars:** 21
- **License:** MIT
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

Connects MCP-compatible assistants such as Claude Desktop, Claude Code and Cursor to libSQL databases, whether a local file, an HTTP endpoint or a hosted Turso instance. The assistant gets six tools for querying, writing, creating and altering tables, and inspecting schema, so it can work with live data without direct shell or driver access.

Each SQL statement passes through several validation layers before it reaches the database, and operations are logged to a file, the console or both. Write operations support transactions that roll back on error, and connections use pooling with health checks and retry logic. Query results are rendered as aligned tables with NULL handling and timing information.

The package is aimed at developers who want an assistant to explore, prototype against or maintain a small SQLite-compatible or Turso database. It runs on Node.js 20 or later and is installed globally through pnpm or npm.

## Features

- **Six database tools:** Provides read and write queries, table creation and alteration, metadata listing and schema inspection.
- **Multi-layer SQL validation:** Checks statements against several injection safeguards before execution, backed by a documented security test suite.
- **Transactional writes:** Wraps write operations in transactions that roll back automatically when an error occurs.
- **Connection pooling and retries:** Manages database connections with health monitoring and automatic retry on failure.
- **Flexible database targets:** Works with local files, HTTP endpoints and Turso cloud databases, with the auth token read from an environment variable or flag.
- **Configurable audit logging:** Writes logs to file, console, both, or none, with a default that keeps the MCP stdio channel clean.

## Good for

- Letting an AI assistant query and explore a local SQLite-compatible database during development
- Prototyping schema changes on a Turso database through conversation
- Inspecting table structures and metadata before writing application code
- Running parameterised write operations with rollback protection from an MCP client

## Tools

From the tool list in its README, going by the names, 2 of 6 tools change data; 1 name doesn't say. From the server's own tool labels and tool names; not verified by us.

- `read-query` (name suggests: reads): Execute SELECT queries with security validation
- `write-query` (name suggests: changes): INSERT, UPDATE and DELETE operations with transaction support
- `create-table` (name suggests: changes): CREATE TABLE with DDL security
- `alter-table`: Modify table structure by adding, renaming or dropping columns
- `list-tables` (name suggests: reads): Browse database metadata and objects
- `describe-table` (name suggests: reads): Inspect table schema and structure

## FAQ

### Which Node.js version is required?

Node.js 20 or later is required, and the README notes that older Node versions in Claude Desktop can cause syntax errors.

### How do I supply a Turso auth token?

Set the LIBSQL_AUTH_TOKEN environment variable, which the README recommends over passing the token as a command-line flag.

### Which MCP clients are supported?

The README mentions Claude Desktop, Claude Code and Cursor, along with other MCP-compatible clients.

### Does mcp-libsql work on Windows?

Windows is supported through Node.js or WSL2, and the README includes a separate configuration for WSL2.

### Is mcp-libsql free?

Yes. mcp-libsql is open source, so you can use and self-host it for free.

### What are the best alternatives to mcp-libsql?

The closest alternatives to mcp-libsql are Database MCP Libsql, mcp-sqlite, mysql_mcp_server, MCP Turso Cloud and MCP Sqlite Tools.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [Database MCP Libsql](https://ai-powered.com/mcp/database-mcp-libsql): Database MCP Libsql is an open-source MCP server for databases.
- [mcp-sqlite](https://ai-powered.com/mcp/mcp-sqlite-2): mcp-sqlite is an open-source MCP server for databases.
- [mysql_mcp_server](https://ai-powered.com/mcp/mysql-mcp-server-4): mysql_mcp_server is an open-source MCP server for databases.
- [MCP Turso Cloud](https://ai-powered.com/mcp/mcp-turso-cloud): MCP Turso Cloud is an open-source MCP server for databases.
- [MCP Sqlite Tools](https://ai-powered.com/mcp/mcp-sqlite-tools): MCP Sqlite Tools is an open-source MCP server for databases.
- [mcp-multi-db](https://ai-powered.com/mcp/mcp-multi-db): mcp-multi-db is an open-source MCP server for databases.
- [sqlite-mcp-server](https://ai-powered.com/mcp/sqlite-mcp-server-2): sqlite-mcp-server is an open-source MCP server for databases.
- [mcp-alchemy](https://ai-powered.com/mcp/mcp-alchemy): mcp-alchemy is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/mcp-libsql
