mcp-sql-api
mcp-sql-api/ ├── app/ │ ├── main.py # FastAPI 入口点 │ ├── api/ # 端点层 │ │ ├── sql.py # 原生 SQL 执行(步骤 1) │ │ ├── query.py # 查询执行 API(步骤 3) │ │ └── agent.py # GPT 集成(步骤 2) │ │ │ ├── core/ # 核心逻辑 │ │ ├── db.py # 数据库连接(PostgreSQL) │ │ └── security.py # SQL 控制(SELECT 限制等) │ │ │ ├── services/ # 业务逻辑 │ │ ├── sql_executor.py # SQL 执行引擎 │ │ ├── query_service.py # 模板查询执行 │ │ ├── llm_service.py # 使用 GPT 生成 SQL │ │ └── ir_service.py # 中间表示 → SQL 转换(步骤 4) │ │ │ ├── models/ # 数据模型 │ │ ├── schema.py # 数据库模式定义 │ │ ├── query.py # 查询定义(带语义) │ │ └── ir.py # 中间表示(至关重要) │ │ │ ├── repositories/ # 数据库访问层 │ │ └── base.py │ │ │ └── utils/ │ ├── logger.py │ └── validator.py │ ├── metadata/ # ← MCP 的核心 │ ├── schema.yaml # 表定义(供 LLM 使用) │ ├── metrics.yaml # KPI 定义 │ └── queries.yaml # 有意义的 API 定义 │ ├── prompts/ # GPT 提示词 │ ├── sql_generation.txt │ └── ir_generation.txt │ ├── tests/ │ ├── test_sql.py │ ├── test_query.py │ └── test_ir.py │ ├── requirements.txt └── README.md
This server cannot be deployed
Maintenance
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Ask data questions in natural language. Get SQL, insights, and charts from your databases.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Ask questions in plain language, get answers from your business database. No SQL required.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to query databases using natural language, with automatic schema discovery and SQL compilation.451 npm3,173Apache 2.0

Bollard MCPofficial
AlicenseAqualityDmaintenanceEnables safe, AI-driven database interactions with schema discovery, intent validation, and session memory, supporting multiple databases.142AGPL 3.0- AlicenseNot gradedqualityDmaintenanceEnables natural language querying of SQL databases using AI, supporting multiple database types and automatic schema discovery.1MIT
- AlicenseAqualityDmaintenanceEnables natural-language querying of databases via SQLBot, with datasource discovery, metadata inspection, and report generation.5MIT