nlp2sql
Verified Safeby luiscarbonel1991
Overview
Converting natural language queries to optimized SQL for enterprise databases using multiple AI providers.
Installation
python /path/to/nlp2sql/mcp_server/server.pyEnvironment Variables
- OPENAI_API_KEY
- ANTHROPIC_API_KEY
- GOOGLE_API_KEY
- NLP2SQL_DEFAULT_DB_URL
- NLP2SQL_DEMO_DB_URL
- NLP2SQL_LOCAL_DB_URL
- NLP2SQL_TEST_DB_URL
- NLP2SQL_PROD_DB_URL
- NLP2SQL_EMBEDDINGS_DIR
- NLP2SQL_MAX_SCHEMA_TOKENS
- NLP2SQL_CACHE_ENABLED
- NLP2SQL_LOG_LEVEL
Security Notes
The server implements robust SQL injection prevention by strictly allowing only SELECT, WITH, and EXPLAIN queries and blocking all DDL/DML operations (INSERT, UPDATE, DELETE, DROP, etc.). It also prevents multiple statements in a single query and enforces row limits to mitigate resource exhaustion. API keys and database credentials are read from environment variables, which is a secure practice. No 'eval' or obvious malicious patterns were found. The primary risk would be from a highly sophisticated bypass of the SQL validation regex, which is a general challenge for such systems.
Similar Servers
DBchat
Transforms a database into an intelligent conversational partner, enabling natural language queries, instant answers, and data visualizations via MCP clients.
mcp-kql-server
An AI-powered MCP server that facilitates KQL query execution against Azure Data Explorer through natural language conversion, intelligent schema discovery, and RAG-enhanced context.
DatabaseMcpServer
Provides a robust and secure database access layer for AI assistants, supporting 19 types of databases with single-instance multi-database dynamic switching and over 50 tools for data and schema management.
Dynamic-Smart-MCP
An intelligent FastMCP 2 server that converts natural language questions into SQL queries or API requests for any SQL database or OpenAPI-defined API using AI.