MySQL MCP ServerMySQL MCP Server

Local
Scanned

API Integration

Integrate this MCP server into your applications.

Get your API Key

You'll need to login and generate a Smithery API key to connect to this server.

Installation

Install the official MCP SDKs using npm:

npm install @modelcontextprotocol/sdk

TypeScript SDK

typescript

import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"

const serverUrl = new URL("https://server.smithery.ai/@xptotech/mcp3/mcp")
const config = {
  "MYSQL_HOST": "string",
  "MYSQL_PORT": "string",
  "MYSQL_USER": "string",
  "MYSQL_DATABASE": "string",
  "MYSQL_PASSWORD": "string",
  "MYSQL_READONLY": false
}
const configString = JSON.stringify(config)
serverUrl.searchParams.set("config", btoa(configString))
serverUrl.searchParams.set("api_key", "your-smithery-api-key")

const transport = new StreamableHTTPClientTransport(serverUrl)

// Create MCP client
import { Client } from "@modelcontextprotocol/sdk/client/index.js"

const client = new Client({
	name: "Test client",
	version: "1.0.0"
})
await client.connect(transport)

// Use the server tools with your LLM application
const tools = await client.listTools()
console.log(`Available tools: ${tools.map(t => t.name).join(", ")}`)

Configuration Schema

Full JSON Schema for server configuration:

json
{
  "type": "object",
  "properties": {
    "MYSQL_HOST": {
      "type": "string",
      "description": "MySQL server address"
    },
    "MYSQL_PORT": {
      "type": "string",
      "description": "MySQL server port"
    },
    "MYSQL_USER": {
      "type": "string",
      "description": "MySQL username"
    },
    "MYSQL_DATABASE": {
      "type": "string",
      "description": "Initial database"
    },
    "MYSQL_PASSWORD": {
      "type": "string",
      "description": "MySQL password"
    },
    "MYSQL_READONLY": {
      "type": "boolean",
      "description": "Read-only mode, set true to enable"
    }
  }
}