https://github.com/nbbaier/mcp-turso
MCP server for interacting with Turso-hosted LibSQL databases
https://github.com/nbbaier/mcp-turso
ai libsql mcp mcp-server model-context-protocol sql sqlite turso
Last synced: about 2 months ago
JSON representation
MCP server for interacting with Turso-hosted LibSQL databases
- Host: GitHub
- URL: https://github.com/nbbaier/mcp-turso
- Owner: nbbaier
- License: mit
- Created: 2025-03-10T04:22:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-03T02:36:11.000Z (8 months ago)
- Last Synced: 2025-12-31T15:02:28.448Z (6 months ago)
- Topics: ai, libsql, mcp, mcp-server, model-context-protocol, sql, sqlite, turso
- Language: TypeScript
- Homepage:
- Size: 82 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- metorial-index - Turso Database Server - Access and manage Turso-hosted LibSQL databases, including retrieving table lists, database schemas, and executing SQL queries. Enhance data interaction capabilities through efficient database management. (Cloud Services)
- toolsdk-mcp-registry - ❌ mcp-turso - hosted LibSQL databases, enabling direct SQL query execution against cloud-based SQLite databases for data analysis, content management, and application development workflows. (node) (Databases / How to Submit)
README
# mcp-turso
A Model Context Protocol (MCP) server that provides access to the Turso-hosted LibSQL databases. Currently, the server provides the following functionality:
- Retrieving a list of tables in a database
- Retrieving a database's schema
- Retrieving the schema of a table
- Performing SELECT queries
## Configuration
### With Claude Desktop
Add this to your `claude_desktop_config.json`:
```json
{
"mcpServers": [
"turso": {
"command": "npx",
"args": ["-y", "mcp-turso"],
"env": {
"TURSO_DATABASE_URL": "your_url",
"TURSO_AUTH_TOKEN": "your_token"
}
}
]
}
```
You will need an existing database to continue. If you don't have one, [create one](https://docs.turso.tech/quickstart). To get the database URL via the Turso CLI, run:
```bash
turso db show --url
```
Then get the database authentication token:
```bash
turso db tokens create
```
Add those values to your configuration as shown above.
### With Cursor
To configure the Turso MCP server with Cursor, add the following to your Cursor settings:
1. Open Cursor and go to Settings (⚙️) > Settings (JSON)
2. Add the following configuration to your settings JSON:
```json
"mcpServers": {
"turso": {
"command": "npx",
"args": ["-y", "mcp-turso"],
"env": {
"TURSO_DATABASE_URL": "your_url",
"TURSO_AUTH_TOKEN": "your_token"
}
}
}
```
Replace `your_url` and `your_token` with your Turso database URL and authentication token as described in the previous section.
### Logging
The server includes a custom logger for debugging outside of Claude Desktop. By default, this logger writes to `/logs/mcp-turso.log`, where `` is the parent directory of directory containing the `mcp-turso` script. In other words, if the path to `mcp-turso` is `~/foo/bin/mcp-turso`, the logs will be at `~/foo/logs/mcp-turso.log`. If running with NPX as above, the default logs will be:
```
~/.npm/_npx//node_modules/mcp-turso/logs/mcp-turso.log
```
If you would like to specify a custom path, you can include a `--logs` flag with an **absolute posix path** in the server's configuration:
```json
{
"mcpServers": [
"turso": {
"command": "npx",
"args": ["-y", "mcp-turso", "--logs", "/Users//path/to/dir/mcp-logs.log"],
"env": {
"TURSO_DATABASE_URL": "your_url",
"TURSO_AUTH_TOKEN": "your_token"
}
}
]
}
```
The path to the log file (default or custom) is always logged to `stderr` when the server is created. For Claude desktop, this will show up in your server logs in `~/Library/Logs/Claude`.
_Note_: Right now, I haven't implemented specifying a custom logging file for Windows, but this is coming.
## Server Capabilities
The server provides the following tools:
- `list_tables`
- Get a list of all the tables in the database
- No input
- Returns: an array of table names
- `get_db_schema`
- Get the schemas of all tables in the database
- No input
- Returns: an array of SQL creation statements
- `describe_table`
- View schema information for a specific table
- Input:
- `table_name` (string): Name of table to describe
- Returns: Array of column definitions with names and types
- `query_database`
- Execute a SELECT query to read data from the database
- Input:
- `sql` (string): The SELECT SQL query to execute
- Returns: Query results as an object of type `{ columns: string[]; rows: Record[]; rowCount: number; }`
## Todo
- [ ] Add the ability to specify a custom log file on windows
- [ ] Add more query tools
## License
MIT License - see the [LICENSE](LICENSE) file for details.