Text2Sql.Net
Text2Sql.Net 是一个使用DotNet和Semantic Kernel开发的Text2Sql工具
claude mcp add --transport stdio shuyu-labs-text2sql.net docker run -i text2sqlnet:latest \ --env ASPNETCORE_URLS="http://0.0.0.0:5000" \ --env TEXT2SQL_CONFIG_PATH="/app/config/text2sql.json"
How to use
Text2Sql.Net is a .NET-based MCP server that exposes natural language to SQL generation capabilities alongside schema exploration, execution, and chat history features. It integrates with MCP-enabled IDEs (such as Cursor or Trae) to allow you to retrieve database connections, inspect schema, generate SQL from natural language, and execute SQL directly from your development environment. The server also supports vector-based context for enhanced accuracy and a QA example system to improve SQL generation over time. You can access standard MCP endpoints such as get_database_connections, get_database_schema, generate_sql, execute_sql, get_chat_history, get_table_structure, and get_all_tables to perform end-to-end data querying and exploration from within your IDE.
How to install
Prerequisites:
- Docker and Docker Compose installed on your machine
- Internet access to pull the Text2Sql.Net docker image (or build the image locally if provided)
Install steps:
-
Pull and run the MCP-enabled Text2Sql.Net image (example):
docker pull text2sqlnet/text2sqlnet:latest docker run -d --name text2sqlnet -p 5000:5000 text2sqlnet/text2sqlnet:latest
-
If you want to configure a specific config file, mount it into the container:
docker run -d --name text2sqlnet -p 5000:5000 -v /path/to/config:/app/config text2sqlnet/text2sqlnet:latest
-
Validate the MCP endpoints are reachable (default port 5000):
-
Alternative: if you prefer running from source (requires .NET tooling and building the app):
git clone <repository-url> cd Text2Sql.Net dotnet restore dotnet run --project Text2Sql.Net.Server.csproj --urls http://0.0.0.0:5000
-
Ensure environment variables are set as needed (see additional notes) and that your IDE can connect to the MCP SSE endpoint.
Additional notes
Notes and tips:
- The MCP endpoints are designed for IDE integrations. Use get_database_connections to fetch available connections, get_database_schema or get_all_tables for schema exploration, and generate_sql to produce SQL from natural language queries.
- To execute SQL directly from the MCP server, use execute_sql. When testing locally, ensure your database drivers and network rules permit connections from the container or runtime environment.
- If you use vector/context features, ensure your vector store is properly configured (e.g., SQLite or PostgreSQL with pgvector) according to your environment.
- Common environment variables: ASPNETCORE_URLS (server URL), TEXT2SQL_CONFIG_PATH (path to your configuration), and database connection strings in the server config.
- If you run into port conflicts, adjust the host port (default 5000) in the docker run command or in the application configuration.
- For IDE integration, the Text2Sql.Net MCP description in your integration settings should match the provided mcpServers configuration (name, type, url).
- If you encounter authentication or API key issues with OpenAI or embedding providers, ensure you have valid keys configured in the Text2SqlOpenAI and Text2SqlConnection sections of your configuration file.
Related MCP Servers
dat
Asking yours data in a natural language way through pre-modeling (data models and semantic models).
Mcp.Net
A fully featured C# implementation of Anthropic's Model Context Protocol (MCP)
RimSearcher
A Model Context Protocol (MCP) server for fast searching and retrieval of RimWorld source code.
mcpapp-colorpicker
A Model Context Protocol (MCP) App built with .NET that provides an interactive color picker with a rich UI
RoslynMcpServer
Model Context Protocol server for Roslyn-powered C# refactoring operations
BitbucketMcpServers
C# + Bitbucket API + MCP