MCP-Turso

by nbbaier
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides access to Turso-hosted LibSQL databases, allowing retrieval of table lists, database schemas, table schemas, and execution of SELECT queries.

mcp-turso

模型上下文协议 (MCP) 服务器,提供对 Turso 托管的 LibSQL 数据库的访问。目前,该服务器提供以下功能:

  • 检索数据库中的表列表
  • 检索数据库架构
  • 检索表的架构
  • 执行 SELECT 查询

配置

使用 Claude Desktop

将其添加到您的claude_desktop_config.json中:

{ "mcpServers": [ "turso": { "command": "npx", "args": ["-y", "mcp-turso"], "env": { "TURSO_DATABASE_URL": "your_url", "TURSO_AUTH_TOKEN": "your_token" } } ] }

您需要一个现有的数据库才能继续。如果没有,请创建一个。要通过 Turso CLI 获取数据库 URL,请运行:

turso db show --url <database-name>

然后获取数据库身份验证令牌:

turso db tokens create <database-name>

将这些值添加到您的配置中,如上所示。

日志记录

该服务器包含一个自定义日志记录器,用于在 Claude Desktop 之外进行调试。默认情况下,此日志记录器会写入<parent-dir>/logs/mcp-turso.log ,其中<parent-dir>是包含mcp-turso脚本的目录的父目录。换句话说,如果mcp-turso的路径是~/foo/bin/mcp-turso ,则日志将位于~/foo/logs/mcp-turso.log 。如果像上面一样使用 NPX 运行,则默认日志将为:

~/.npm/_npx/<npx-dir-name>/node_modules/mcp-turso/logs/mcp-turso.log

如果您想指定自定义路径,您可以在服务器配置中包含带有绝对 posix 路径--logs标志:

{ "mcpServers": [ "turso": { "command": "npx", "args": ["-y", "mcp-turso", "--logs", "/Users/<username>/path/to/dir/mcp-logs.log"], "env": { "TURSO_DATABASE_URL": "your_url", "TURSO_AUTH_TOKEN": "your_token" } } ] }

服务器创建时,日志文件的路径(默认或自定义)始终会记录到stderr 。对于 Claude 桌面版,该路径将显示在服务器日志~/Library/Logs/Claude目录中。

注意:目前,我还没有实现为 Windows 指定自定义日志文件,但即将实现。

服务器功能

该服务器提供以下工具:

  • list_tables
    • 获取数据库中所有表的列表
    • 无输入
    • 返回:表名数组
  • get_db_schema
    • 获取数据库中所有表的架构
    • 无输入
    • 返回:SQL创建语句数组
  • describe_table
    • 查看特定表的架构信息
    • 输入: - table_name (字符串):要描述的表的名称
    • 返回:具有名称和类型的列定义数组
  • query
    • 执行 SELECT 查询以从数据库读取数据
    • 输入:
      • query (字符串):要执行的 SELECT SQL 查询
    • 返回:查询结果为类型对象{ columns: string[]; rows: Record<string, unknown>[]; rowCount: number; }

待办事项

  • [ ] 添加在 Windows 上指定自定义日志文件的功能
  • [ ] 添加更多查询工具

执照

MIT 许可证 - 有关详细信息,请参阅LICENSE文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器为 Claude 提供对 Turso 托管的 LibSQL 数据库的访问,从而实现数据库表列表、模式检索和 SELECT 查询执行。

  1. Configuration
    1. With Claude Desktop
    2. Logging
  2. Server Capabilities
    1. Todo
      1. License
        ID: r0ersuisw0