MCPDatabaseAnalyzer 1.0.2
{ "servers": { "MCPDatabaseAnalyzer": { "type": "stdio", "command": "dnx", "args": ["MCPDatabaseAnalyzer@1.0.2", "--yes"] } } }
.vscode/mcp.json settings file.
dotnet tool install --global MCPDatabaseAnalyzer --version 1.0.2
dotnet new tool-manifest
dotnet tool install --local MCPDatabaseAnalyzer --version 1.0.2
#tool dotnet:?package=MCPDatabaseAnalyzer&version=1.0.2
nuke :add-package MCPDatabaseAnalyzer --version 1.0.2
MySQL MCP Server
This MCP server provides MySQL database tools that can be used by GitHub Copilot and other MCP clients. It allows you to query data, view schemas, create tables, and execute SQL commands through natural language.
The MCP server is built as a self-contained application and does not require the .NET runtime to be installed on the target machine. However, since it is self-contained, it must be built for each target platform separately. By default, the template is configured to build for:
win-x64win-arm64osx-arm64linux-x64linux-arm64linux-musl-x64
If your users require more platforms to be supported, update the list of runtime identifiers in the project's <RuntimeIdentifiers /> element.
See aka.ms/nuget/mcp/guide for the full guide.
Please note that this template is currently in an early preview stage. If you have feedback, please take a brief survey.
Checklist before publishing to NuGet.org
- Test the MCP server locally using the steps below.
- Update the package metadata in the .csproj file, in particular the
<PackageId>. - Update
.mcp/server.jsonto declare your MCP server's inputs.- See configuring inputs for more details.
- Pack the project using
dotnet pack.
The bin/Release directory will contain the package file (.nupkg), which can be published to NuGet.org.
Developing locally
To test this MCP server from source code (locally) without using a built MCP server package, you can configure your IDE to run the project directly using dotnet run.
{
"servers": {
"MCPSqlTool": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"<PATH TO PROJECT DIRECTORY>"
]
}
}
}
MySQL Database Tools
This server includes the following MySQL tools:
- GetDataFromTable - Execute SELECT queries and view results
- ShowDatabaseSchema - Display complete database schema with all tables and columns
- CreateTable - Create new tables in the database
- DropTable - Delete tables from the database
- ListTables - List all tables with row counts and creation dates
- ExecuteCommand - Execute SQL commands (INSERT, UPDATE, DELETE, ALTER, etc.)
Setup MySQL Connection
Edit appsettings.json and configure your MySQL connection:
{
"ConnectionStrings": {
"MySql": "Server=localhost;Port=3306;Database=your_database;User=your_user;Password=your_password;"
}
}
Alternative: Use Environment Variables
# Windows (PowerShell)
$env:ConnectionStrings__MySql = "Server=localhost;Port=3306;Database=mydb;User=root;Password=pass;"
# Linux/Mac
export ConnectionStrings__MySql="Server=localhost;Port=3306;Database=mydb;User=root;Password=pass;"
Testing the MCP Server
Once configured, you can ask Copilot Chat to interact with your MySQL database:
- "Show me the schema of my MySQL database"
- "Get all users from the users table"
- "Create a table called customers with id, name, and email columns"
- "List all tables in the database"
- "Select * from products where price > 100"
Random Number Tool (Demo)
You can also test the demo tool: Give me 3 random numbers
Security Notes
?? Important:
- Never commit
appsettings.jsonwith real credentials - Use environment variables for production
- The
GetDataFromTabletool only allows SELECT queries - Use
ExecuteCommandwith caution as it can modify data
Publishing to NuGet.org
- Run
dotnet pack -c Releaseto create the NuGet package - Publish to NuGet.org with
dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json
Using the MCP Server from NuGet.org
Once the MCP server package is published to NuGet.org, you can configure it in your preferred IDE. Both VS Code and Visual Studio use the dnx command to download and install the MCP server package from NuGet.org.
- VS Code: Create a
<WORKSPACE DIRECTORY>/.vscode/mcp.jsonfile - Visual Studio: Create a
<SOLUTION DIRECTORY>\.mcp.jsonfile
For both VS Code and Visual Studio, the configuration file uses the following server definition:
{
"servers": {
"MCPSqlTool": {
"type": "stdio",
"command": "dnx",
"args": [
"<your package ID here>",
"--version",
"<your package version here>",
"--yes"
]
}
}
}
More information
.NET MCP servers use the ModelContextProtocol C# SDK. For more information about MCP:
Refer to the VS Code or Visual Studio documentation for more information on configuring and using MCP servers:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.