Skip to main content
Glama
CSOAI-ORG

Universal Database MCP Server

by CSOAI-ORG

通用数据库 MCP 服务器

由 MEOK AI Labs 提供 | meok.ai

将 AI 智能体连接到任何 SQL 数据库。查询数据、浏览架构、插入行并将结果导出为 CSV。通过统一的接口支持 SQLite(内置)、PostgreSQL 和 MySQL。

工具

工具

描述

query_sql

执行带有安全验证的 SQL 查询

list_tables

列出数据库中的所有表

describe_table

获取列名、类型、可空性、行数

insert_row

使用简单的键值字典插入一行

export_to_csv

运行 SELECT 查询并将结果保存为 CSV

安装

# Core (SQLite support included)
pip install mcp

# PostgreSQL support
pip install psycopg2-binary

# MySQL support
pip install mysql-connector-python

使用方法

运行服务器

python server.py

Claude Desktop 配置

{
  "mcpServers": {
    "database": {
      "command": "python",
      "args": ["/path/to/database-universal-mcp/server.py"]
    }
  }
}

连接字符串格式

数据库

格式

SQLite (文件)

sqlite:///path/to/db.sqlite 或直接使用 /path/to/file.db

PostgreSQL

postgresql://user:pass@localhost:5432/mydb

MySQL

mysql://user:pass@localhost:3306/mydb

调用示例

列出 SQLite 数据库中的表:

Tool: list_tables
Input: {"connection_string": "/Users/me/data/app.db"}
Output: {"tables": ["users", "orders", "products"], "count": 3, "db_type": "sqlite"}

描述表结构:

Tool: describe_table
Input: {"connection_string": "/Users/me/data/app.db", "table_name": "users"}
Output: {"columns": [{"name": "id", "type": "INTEGER", "primary_key": true}, {"name": "email", "type": "TEXT", "nullable": false}], "row_count": 1523}

查询数据:

Tool: query_sql
Input: {"connection_string": "postgresql://admin:secret@localhost/myapp", "sql": "SELECT name, email FROM users WHERE created_at > '2026-01-01' LIMIT 10"}
Output: {"columns": ["name", "email"], "rows": [{"name": "Alice", "email": "alice@example.com"}, ...], "row_count": 10}

插入一行:

Tool: insert_row
Input: {"connection_string": "/tmp/test.db", "table_name": "notes", "data": {"title": "Meeting notes", "body": "Discussed Q2 roadmap", "created_at": "2026-04-13"}}
Output: {"message": "Inserted 1 row into notes"}

导出为 CSV:

Tool: export_to_csv
Input: {"connection_string": "/Users/me/data/app.db", "sql": "SELECT * FROM orders WHERE total > 100"}
Output: {"output": "/tmp/export_20260413_143022.csv", "rows_exported": 47}

安全性

  • 拦截危险查询:DROP TABLE、TRUNCATE、无 WHERE 条件的 DELETE、GRANT/REVOKE 将被拒绝

  • 写入保护:INSERT/UPDATE/DELETE 需要显式设置 allow_write=True

  • 行数限制:免费版每次查询最多返回 1000 行

  • 不存储凭据:连接字符串仅在调用时使用,绝不持久化存储

定价

层级

限制

价格

免费版

每天 30 次调用,最多 1000 行

$0

专业版

无限制 + 连接池 + 批量操作

$12/月

企业版

定制 + 审计日志 + VPC 支持

联系我们

许可证

MIT

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CSOAI-ORG/database-universal-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server