mcp-turso-cloud
mcp-turso-云
模型上下文协议 (MCP) 服务器,为 LLM 提供与 Turso 数据库的集成。该服务器实现了两级身份验证系统,可同时处理组织级和数据库级操作,从而可以轻松地直接从 LLM 管理和查询 Turso 数据库。
特征
🏢 组织级运营
列出数据库:查看 Turso 组织中的所有数据库
创建数据库:使用可自定义的选项创建新的数据库
删除数据库:从您的组织中删除数据库
生成数据库令牌:为特定数据库创建身份验证令牌
💾 数据库级操作
列出表:查看特定数据库中的所有表
执行只读查询:运行 SELECT 和 PRAGMA 查询(只读操作)
执行查询:运行可能具有破坏性的 SQL 查询(INSERT、UPDATE、DELETE 等)
描述表:获取数据库表的架构信息
向量搜索:使用 SQLite 向量扩展执行向量相似性搜索
Related MCP server: Supabase MCP Server
⚠️ 重要:查询执行安全性 ⚠️
该服务器实现了只读和破坏性数据库操作之间的以安全性为中心的分离:
使用
execute_read_only_query进行SELECT和PRAGMA查询(安全的只读操作)使用
execute_query进行INSERT、UPDATE、DELETE、CREATE、DROP和其他修改数据的操作
这种分离允许不同的权限级别和批准要求:
在许多情况下,只读操作可以自动批准
破坏性操作可能需要明确的安全批准
**在批准 SQL 查询之前,务必仔细阅读并审核!**这对于可能修改或删除数据的破坏性操作尤其重要。在允许执行每个查询之前,请花时间了解其作用。
两级认证系统
服务器实现了复杂的身份验证系统:
组织级身份验证
使用 Turso 平台 API 令牌
管理数据库和组织级操作
通过 Turso 仪表板获取
数据库级身份验证
使用数据库特定的令牌
使用组织令牌自动生成
缓存以提高性能并根据需要轮换
配置
此服务器需要通过您的 MCP 客户端进行配置。以下是不同环境下的示例:
Cline/Claude 桌面配置
将其添加到您的 Cline/Claude Desktop MCP 设置中:
{
"mcpServers": {
"mcp-turso-cloud": {
"command": "npx",
"args": ["-y", "mcp-turso-cloud"],
"env": {
"TURSO_API_TOKEN": "your-turso-api-token",
"TURSO_ORGANIZATION": "your-organization-name",
"TURSO_DEFAULT_DATABASE": "optional-default-database"
}
}
}
}带有 WSL 配置的 Claude 桌面
对于 WSL 环境,将其添加到您的 Claude Desktop 配置中:
{
"mcpServers": {
"mcp-turso-cloud": {
"command": "wsl.exe",
"args": [
"bash",
"-c",
"TURSO_API_TOKEN=your-token TURSO_ORGANIZATION=your-org node /path/to/mcp-turso-cloud/dist/index.js"
]
}
}
}环境变量
服务器需要以下环境变量:
TURSO_API_TOKEN:您的 Turso 平台 API 令牌(必需)TURSO_ORGANIZATION:您的 Turso 组织名称(必填)TURSO_DEFAULT_DATABASE:未指定时使用的默认数据库(可选)TOKEN_EXPIRATION:生成的数据库令牌的到期时间(可选,默认值:'7d')TOKEN_PERMISSION:生成令牌的权限级别(可选,默认值:“完全访问”)
API
服务器实现按类别组织的 MCP 工具:
组织工具
列出数据库
列出 Turso 组织中的所有数据库。
参数:无
响应示例:
{
"databases": [
{
"name": "customer_db",
"id": "abc123",
"region": "us-east",
"created_at": "2023-01-15T12:00:00Z"
},
{
"name": "product_db",
"id": "def456",
"region": "eu-west",
"created_at": "2023-02-20T15:30:00Z"
}
]
}创建数据库
在您的组织中创建一个新的数据库。
参数:
name(字符串,必需):新数据库的名称group(字符串,可选):将数据库分配到的组regions(string[],可选):部署数据库的区域
例子:
{
"name": "analytics_db",
"group": "production",
"regions": ["us-east", "eu-west"]
}删除数据库
从您的组织中删除数据库。
参数:
name(字符串,必需):要删除的数据库的名称
例子:
{
"name": "test_db"
}生成数据库令牌
为特定数据库生成新令牌。
参数:
database(字符串,必需):数据库名称expiration(字符串,可选):令牌到期时间permission(字符串,可选):权限级别(“完全访问”或“只读”)
例子:
{
"database": "customer_db",
"expiration": "30d",
"permission": "read-only"
}数据库工具
列表表
列出数据库中的所有表。
参数:
database(字符串,可选):数据库名称(如果未提供,则使用上下文)
例子:
{
"database": "customer_db"
}执行只读查询
对数据库执行只读 SQL 查询(SELECT、PRAGMA)。
参数:
query(字符串,必需):要执行的 SQL 查询(必须是 SELECT 或 PRAGMA)params(对象,可选):查询参数database(字符串,可选):数据库名称(如果未提供,则使用上下文)
例子:
{
"query": "SELECT * FROM users WHERE age > ?",
"params": { "1": 21 },
"database": "customer_db"
}执行查询
对数据库执行具有潜在破坏性的 SQL 查询(INSERT、UPDATE、DELETE、CREATE 等)。
参数:
query(字符串,必需):要执行的 SQL 查询(不能是 SELECT 或 PRAGMA)params(对象,可选):查询参数database(字符串,可选):数据库名称(如果未提供,则使用上下文)
例子:
{
"query": "INSERT INTO users (name, age) VALUES (?, ?)",
"params": { "1": "Alice", "2": 30 },
"database": "customer_db"
}描述表
获取表的架构信息。
参数:
table(字符串,必需):表名称database(字符串,可选):数据库名称(如果未提供,则使用上下文)
例子:
{
"table": "users",
"database": "customer_db"
}向量搜索
使用 SQLite 矢量扩展执行矢量相似性搜索。
参数:
table(字符串,必需):表名称vector_column(字符串,必需):包含矢量的列query_vector(number[],必需):用于相似性搜索的查询向量limit(数字,可选):最大结果数(默认值:10)database(字符串,可选):数据库名称(如果未提供,则使用上下文)
例子:
{
"table": "embeddings",
"vector_column": "embedding",
"query_vector": [0.1, 0.2, 0.3, 0.4],
"limit": 5,
"database": "vector_db"
}发展
设置
克隆存储库
安装依赖项:
npm install构建项目:
npm run build以开发模式运行:
npm run dev出版
更新 package.json 中的版本
构建项目:
npm run build发布到 npm:
npm publish故障排除
API 令牌问题
如果遇到身份验证错误:
验证您的 Turso API 令牌是否有效并具有必要的权限
检查您的组织名称是否正确
确保您的令牌尚未过期
数据库连接问题
如果您在连接数据库时遇到问题:
验证数据库是否存在于您的组织中
检查你的 API 令牌是否可以访问数据库
确保数据库名称拼写正确
贡献
欢迎贡献代码!欢迎提交 Pull 请求。
执照
MIT 许可证 - 有关详细信息,请参阅LICENSE文件。
致谢
构建于:
Available Tools
9 toolscreate_database✓ SAFE: Create a new database in your Turso organization. Database name must be unique.C
✓ SAFE: Create a new database in your Turso organization. Database name must be unique.
Inputs: name (required), group, regions.
delete_database⚠️ DESTRUCTIVE: Permanently deletes a database and ALL its data. Cannot be undone. Always confirm with user before proceeding and verify correct database name.B
⚠️ DESTRUCTIVE: Permanently deletes a database and ALL its data. Cannot be undone. Always confirm with user before proceeding and verify correct database name.
Inputs: name (required).
describe_tableGets schema information for a tableC
Gets schema information for a table
Inputs: table (required), database.
execute_query⚠️ DESTRUCTIVE: Execute SQL that can modify/delete data (INSERT, UPDATE, DELETE, DROP, ALTER). Always confirm with user before destructive operations.C
⚠️ DESTRUCTIVE: Execute SQL that can modify/delete data (INSERT, UPDATE, DELETE, DROP, ALTER). Always confirm with user before destructive operations.
Inputs: query (required), params, database.
execute_read_only_query✓ SAFE: Execute read-only SQL queries (SELECT, PRAGMA, EXPLAIN). Automatically rejects write operations.B
✓ SAFE: Execute read-only SQL queries (SELECT, PRAGMA, EXPLAIN). Automatically rejects write operations.
Inputs: query (required), params, database.
generate_database_tokenGenerate a new token for a specific databaseC
Generate a new token for a specific database
Inputs: database (required), permission.
list_databasesList all databases in your Turso organizationA
List all databases in your Turso organization
Inputs: no named parameters.
list_tablesLists all tables in a databaseC
Lists all tables in a database
Inputs: database.
vector_searchPerforms vector similarity searchD
Performs vector similarity search
Inputs: table (required), vector_column (required), query_vector (required), limit, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose: database CRUD, querying (read-only vs. destructive), schema inspection, token generation, listing resources, and vector search. No overlap or ambiguity.
All tools follow a consistent verb_noun pattern in snake_case (e.g., create_database, execute_query, list_tables), making the set predictable and easy to navigate.
9 tools is well-scoped for a cloud database service covering management, querying, schema, tokens, and vector search. No unnecessary tools and no deficit.
Core operations are covered (CRUD for databases, query execution, schema inspection, token generation). Minor gaps like listing or revoking tokens exist, but the surface is mostly complete for typical workflows.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for interacting with the Supabase platform
Butterbase MCP server — manage your backend: schemas, auth, functions, storage, RAG, deploys.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides Claude access to Turso-hosted LibSQL databases, enabling database table listing, schema retrieval, and SELECT query execution.429 npm6MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Claude and other LLMs to perform database operations and invoke Edge Functions within Supabase through natural language.969 npm4MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for PostgreSQL, MySQL, and SQLite that gives AI assistants secure database access via the Model Context Protocol.92 npm5MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that integrates Turso databases with LLMs, supporting organization and database-level operations with two-level authentication.MIT