MCPDatabaseAnalyzer 1.0.2

{
  "servers": {
    "MCPDatabaseAnalyzer": {
      "type": "stdio",
      "command": "dnx",
      "args": ["MCPDatabaseAnalyzer@1.0.2", "--yes"]
    }
  }
}
                    
This package contains an MCP Server. The server can be used in VS Code by copying the generated JSON to your VS Code workspace's .vscode/mcp.json settings file.
dotnet tool install --global MCPDatabaseAnalyzer --version 1.0.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local MCPDatabaseAnalyzer --version 1.0.2
                    
This package contains a .NET tool you can call from the shell/command line.
#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-x64
  • win-arm64
  • osx-arm64
  • linux-x64
  • linux-arm64
  • linux-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.json to declare your MCP server's inputs.
  • 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:

  1. GetDataFromTable - Execute SELECT queries and view results
  2. ShowDatabaseSchema - Display complete database schema with all tables and columns
  3. CreateTable - Create new tables in the database
  4. DropTable - Delete tables from the database
  5. ListTables - List all tables with row counts and creation dates
  6. 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.json with real credentials
  • Use environment variables for production
  • The GetDataFromTable tool only allows SELECT queries
  • Use ExecuteCommand with caution as it can modify data

Publishing to NuGet.org

  1. Run dotnet pack -c Release to create the NuGet package
  2. 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.json file
  • Visual Studio: Create a <SOLUTION DIRECTORY>\.mcp.json file

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.2 766 12/9/2025
1.0.1 502 12/4/2025
1.0.0 492 12/4/2025