# Turso MCP

> Turso MCP lets you manage complex serverless SQLite databases and their edge locations entirely through conversation. Connect your AI agent to orchestrate database provisioning, rotate security tokens, list global infrastructure details, and clean up unused resources without opening a terminal.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** sqlite, edge-computing, serverless, database-orchestration, jwt-authentication, data-persistence

## Description

This MCP gives your AI client total control over your Turso cloud infrastructure. You can interact with the system as if you were running direct CLI commands, but right within your chat window. Need to spin up a new test database? Just ask. Want to check which physical data centers host your current instances? Ask that too.

The tool lets you look up organizational tenants, map global Fly.io locations, and even provision entirely new, distributed databases on demand. Furthermore, securing the system is easy; you can list active connection tokens or revoke all old ones instantly when a key gets compromised. It’s built for platform engineers who hate context-switching between their IDE and their command line. Because this MCP lives in Vinkius, you connect once from any compatible agent and get access to these core database operations alongside hundreds of other specialized services.

## Tools

### create_database
Provisions a massively distributed Serverless SQLite database for use in your application.

### create_database_token
Mints a secure, temporary connection token that is tied only to a specific database instance.

### delete_database
Permanently deletes an entire global libSQL database; this action cannot be reversed.

### get_database_details
Introspects and returns the exact architectural traits of a specific target libSQL instance.

### rotate_database_tokens
Revokes all previously issued connection tokens for a given database, forcing clients to use new credentials.

### list_databases
Generates an enumeration of the entire libSQL Edge Database registry in your organization.

### list_database_groups
Retrieves a list of logical groups that organize and manage database locations.

### list_edge_locations
Looks up the physical global datacenter mappings, showing where your data can be hosted.

### list_organizations
Identifies and lists all root organizational tenants within Turso Edge SQLite.

### list_database_tokens
Lists all currently active JWT tokens used for database execution, allowing you to audit access.

## Prompt Examples

**Prompt:** 
```
List all my Turso databases and their hostnames.
```

**Response:** 
```
You have 3 databases in the organization 'startup-inc': 1. 'prod-db' (prod-db-startup.turso.io), 2. 'staging-auth' (staging-auth-startup.turso.io), and 3. 'analytics-edge' (analytics-edge-startup.turso.io). Do you need details or connection tokens for any of them?
```

**Prompt:** 
```
Create a new database named 'user-cache' in the 'default' group.
```

**Response:** 
```
I've successfully provisioned the 'user-cache' database. It has been allocated to the 'default' group and is available at 'user-cache-startup.turso.io'. Would you like me to mint a connection token for it?
```

**Prompt:** 
```
Invalidate all tokens for the 'legacy-db' database immediately.
```

**Response:** 
```
All previous JWT connection tokens for the 'legacy-db' instance have been successfully rotated and invalidated. Any clients using the old credentials will now be denied access. Let me know if you need to generate a new replacement token.
```

## Capabilities

### Database Provisioning
Create entirely new distributed SQLite databases using just the organization slug, database name, and target group.

### Infrastructure Mapping
Identify root organizational tenants or look up physical global datacenter locations to understand your data topology.

### Database Status Checks
Retrieve the full list of existing databases, logical group configurations, or detailed architectural metadata for a specific instance.

### Security and Access Control
Generate secure connection tokens tied to specific databases, list all active JWTs, or permanently invalidate old credentials across the board.

### Database Cleanup
Permanently delete global libSQL database instances that are no longer needed, preventing resource leakage.

## Use Cases

### Auditing Access Tokens
You suspect an old employee left behind credentials for your production DB. Instead of manually checking every service config, you ask the agent to list all active database tokens and then use 'rotate_database_tokens' on the specific instance.

### Spinning up a Test Environment
A developer needs a dedicated staging DB for feature testing. They prompt the agent, which uses `create_database` to provision the environment and then immediately prompts them if they want a connection token via `create_database_token`.

### Global Topology Check
The platform team needs to confirm that their data is backed by multiple physical regions. They ask the agent to run through `list_edge_locations`, giving them an instant map of available global fly.io datacenter mappings.

### Cleaning up Old Projects
A project was shelved, leaving behind a massive database instance consuming resources. You use the agent to list all databases first (`list_databases`), then confirm and run `delete_database` on the target name.

## Benefits

- Stop context switching. You can provision a new test database and check its metadata without ever leaving your IDE or chat interface. This is pure, conversational infra-ops.
- Maintain robust security by instantly rotating credentials. Instead of manually finding old tokens to delete, you simply ask the agent to rotate them for any instance.
- Get full visibility into your infrastructure. Need to know which data center is hosting a specific database? Use the tool to map global locations and understand your physical reach.
- Control resource sprawl with precision. Identify and permanently remove 'zombie databases' or unused resources that cost money but nobody tracks.
- Manage groups and organizations easily. You can list all logical group configurations, which helps you scope out where a new database needs to live.

## How It Works

The bottom line is you manage your entire distributed database lifecycle through natural language prompts from any compatible client.

1. Subscribe to this MCP and provide your Turso API Token.
2. Your AI agent connects using the token and gains read/write access across all defined database tools.
3. You initiate a conversation asking for an infrastructure action, like 'list all my databases' or 'create a new test db'.

## Frequently Asked Questions

**How do I list all my databases using Turso MCP?**
You ask the agent to execute 'list_databases'. This provides you with the full registry of every libSQL Edge Database instance currently managed under your account.

**Can I use Turso MCP to delete a database?**
Yes, you can. Use the 'delete_database' tool when you want to permanently remove an entire global libSQL database. Be careful because this action is irreversible.

**What if my connection token expires? How do I fix it with Turso MCP?**
You can first check which tokens are active using 'list_database_tokens'. If they're stale, you run 'rotate_database_tokens' to immediately revoke all old credentials.

**Does the Turso MCP help me find global data center locations?**
Yes. You can use 'list_edge_locations' to look up physical global datacenter mappings, giving you a clear view of where your database infrastructure operates.