DatabaseMcpServer
MCP server from VirtuaChamp/DatabaseMcpServer
claude mcp add --transport stdio virtuachamp-databasemcpserver dotnet run --project src/DatabaseMcpServer/DatabaseMcpServer.csproj \ --env OTEL_SERVICE_NAME="Optional service name" \ --env SQLSERVER_CONNSTR="Your SQL Server connection string" \ --env OTEL_EXPORTER_OTLP_ENDPOINT="Optional OpenTelemetry endpoint"
How to use
DatabaseMcpServer exposes a read-only MCP (Model Context Protocol) interface over a SQL Server database. It provides tools to explore and retrieve data definitions and sample data from your database without allowing data modification. The available tools are: list_tables to enumerate tables within a schema, describe_table to inspect column definitions, sample_rows to fetch a token-optimized sample of rows from a table, list_procedures to list stored procedures in a schema, and get_procedure_definition to read the source code of a stored procedure. To use the server, start it with the appropriate environment variable for your SQL Server connection string, then issue MCP tool calls against the server to retrieve metadata and sample data as needed for your AI assistant workflows.
How to install
Prerequisites:
- .NET SDK installed on your machine
- Access to a SQL Server instance
- Git checkout of the MCP server repository
Installation steps:
- Clone the repository or navigate to the project directory.
- Create the required MCP config file by copying the example: cp .mcp.json.example .mcp.json (the config will provide runtime settings if needed).
- Ensure the SQLSERVER_CONNSTR environment variable is set to your SQL Server connection string.
- Run the MCP server: dotnet run --project src/DatabaseMcpServer/DatabaseMcpServer.csproj
- Optionally configure OpenTelemetry endpoints and service name via OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_SERVICE_NAME environment variables for telemetry.
Additional notes
Notes and tips:
- The server is read-only; operations are designed for data exploration and retrieval only.
- Set SQLSERVER_CONNSTR to a valid connection string; the server will use it to connect to SQL Server.
- If you encounter connection issues, verify network access to the SQL Server and that the user has appropriate permissions.
- Optional telemetry can be enabled by providing OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_SERVICE_NAME.
- The tools are read-only helpers; for large tables, consider using sample_rows to avoid excessive data transfer.
- Ensure the .mcp.json configuration is present in the working directory if the server expects additional runtime settings.
Related MCP Servers
mssql
MSSQL Server MCP implementation written in C#
McpDotNet.Extensions.SemanticKernel
Microsoft SemanticKernel integration for the Model Context Protocol (MCP). Enables seamless use of MCP tools as AI functions.
DatabaseMcpServer
MCP server from ttcc666/DatabaseMcpServer
mcp-dataverse
MCP Server for querying Dataverse using SQL
xperience-community
ASP.NET Core MCP server for Xperience by Kentico projects
console-to-http
Example of converting a stdio MCP server to HTTP using ModelContextProtocol.AspNetCore