# Turso — how to use (mcp.ai)

Connect your Turso account and use 3 tools for databases straight from your AI agent. Connect with your own API key. Turso is a fully managed database platform built on libSQL, offering serverless SQLite databases with global replication and low-latency access.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_turso?ms=1787293500000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `turso_closest_region`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/turso`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/turso/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/turso/closest/region` — Tool to get the closest Turso region based on client location. Use when you need to minimize latency by selecting the nearest deployment region.
- `POST https://api.mcp.ai/api/turso/listen/to/changes` — Listen to committed table changes in a Turso database via the /beta/listen endpoint. This tool streams real-time insert/update/delete events for a specific table. IMPORTANT: Requires a database-specif
  - body: { table: string, action: string, database_url: string, database_token?: string }
- `POST https://api.mcp.ai/api/turso/validate/api/token` — Validates a Turso API token and retrieves its expiration time. Use this action to verify that an API token is valid and check when it expires. Returns the token's expiration timestamp, or -1 if the to
  - body: { mode?: string, health_sql?: string }

## Example prompts
- "What can I do in Turso?"
- "Show me a summary of my Turso account"

## More
- Page: https://mcp.ai/turso
- Agent spec (llms.txt): https://mcp.ai/turso/llms.txt
- Postman collection: https://mcp.ai/turso/postman.json
