-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Production-Ready MySQL MCP Server with OAuth 2.0 / OIDC, Extensive Specialized Tool Library, and Code Mode (mysql_execute_code) – TypeScript Edition
Value Proposition Accelerate autonomous AI operations with a production-ready MySQL MCP server. Leverage isolated Code Mode execution for safe scripting, enforce strict schema boundaries, and deploy with confidence using native OAuth 2.0 / OIDC authentication. Designed for enterprise resilience and high-concurrency workloads.
mysql-mcp seamlessly optimizes AI-data interactions by empowering agents to autonomously manage and query databases. It provides comprehensive capabilities—from rapid schema discovery to secure, sandboxed operations—while delivering strict security and robust token efficiency.
Minimize token overhead and safely execute complex, multi-step operations via the sandboxed Code Mode. Lock down your infrastructure with robust OAuth 2.0 / OIDC authentication. This server modernizes database operations, empowering AI agents to perform securely at any scale.
| Resource | Description |
|---|---|
| Installation | Prerequisites and setup guide |
| Configuration | Environment variables, MCP client configs |
| Tool Filtering | Reduce tool count for IDE limits |
| Tools | Complete list of all available tools |
| Code Mode | Sandboxed code execution (mysql_execute_code) (Substantial token savings) |
| Resources | Database observability resources |
| Observability & Telemetry | System telemetry, Datadog, Prometheus, Grafana |
| Prompts | AI-powered multi-step workflows with sandboxed Code Mode and OAuth 2.0 / OIDC authentication |
| Audit Trail | JSONL forensic logging & token metrics |
-
PNPM:
pnpm add -g @neverinfamous/mysql-mcp -
Docker:
docker run -i --rm \ -e MYSQL_HOST=host.docker.internal \ -e MYSQL_USER=user \ -e MYSQL_PASSWORD=password \ -e MYSQL_DATABASE=database \ -e ALLOWED_IO_ROOTS=/data \ writenotenow/mysql-mcp:latest \ --transport stdio
-
Token-Optimized Payloads — Tools with large responses offer
summary,limit, andcompactflags. These flags significantly reduce token usage. - Adaptive Instruction Architecture — The system intelligently loads targeted help content based on the active toolset. This preserves valuable token bandwidth.
- Connection Pooling via mysql2
- OAuth 2.0 / OIDC standard authentication support
- Advanced Encryption (TLS/SSL, masking, compliance tools)
- Deterministic Error Handling — All system errors are rigorously managed. Returns enriched, actionable ErrorResponse payloads. This ensures resilient execution.
- Distributed Rate Limiting — Redis backs both HTTP Transport and Code Mode. Automatic in-memory fallback supports high-availability environments.
- Extensive Specialized Tool Library across categories (including Code Mode)
- Native Sandbox Isolation — Code Mode executes within a native isolated-vm V8 instance. Features include synchronous callbacks, enforced heap limits, and hard timeouts.
- AI-Powered Prompts for guided multi-step workflows featuring sandboxed Code Mode and OAuth 2.0 / OIDC authentication
- Shortcuts for rapid tool filtering
- Docker Deployment with multi-arch images
- Ecosystem Integrations for MySQL Router, ProxySQL, and MySQL Shell
- Resource Subscriptions — Native MCP subscriptions deliver real-time schema and status update notifications.
- Progress Tracking — The system emits real-time progress notifications for long-running administrative operations.
- Audit Trail — JSONL forensic logging with pre-mutation snapshots and token metrics
- Observability Resources for database observability
-
Prometheus Metrics Export (
/metrics) and Pre-configured Grafana Dashboard
mysql-mcp is designed as a secure, production-ready middleware layer. It bridges AI agents and MySQL infrastructure. It enforces strict data boundaries, provides distributed rate limiting, and supports high-throughput connection pooling. It offers multi-transport capabilities (STDIO and unified HTTP/SSE) and native OAuth 2.0 / OIDC support. It integrates seamlessly into local development environments. It also supports complex cloud-native architectures. This ensures secure, autonomous database operations at scale.
Discover a comprehensive suite of tools carefully designed to elevate your database management experience, providing both high-level insights and granular control.
| Category | Description |
|---|---|
| Core Database | CRUD, schema, indexing, transactions, and text search |
| Performance & Admin | EXPLAIN, insights, anomalies |
| Ecosystem & Cloud | Replication, cluster, backup tools |
| Advanced Data | Vector embeddings, JSON document store |
| Code Mode | Sandboxed TypeScript/JavaScript execution (mysql_execute_code) |
| Topic | Description |
|---|---|
| OAuth | OAuth 2.0 / OIDC authentication |
| HTTP Transport | Dual HTTP transport deployment guide |
| Test Ecosystem | Validate and test external integrations |
| Schema | Strict schema boundaries and introspection |
| MCP Inspector | Visual debugging guide |
| Capacity Planning | Database sizing, caching, maintenance, token budgets |
| Performance Tuning | Connection pools, query analysis, Code Mode efficiency |
- Strict Security Standards: Implements OAuth 2.0 / OIDC validator middleware for secure integrations.
- Native Standard Schema: Tools leverage Zod's Standard Schema implementation. This supports sophisticated aliases and type coercion. It preserves standard JSON Schema generation. It accelerates agent integrations.
-
Graceful error handling: Integrates Standard Schema interfaces via strictly typed Zod boundaries (
.safeParse()). This provides deterministic, type-safe I/O boundaries. They gracefully reject hallucinated AI payloads. They do not throw unhandled exceptions.
Status: Production/Stable
Value Proposition Enforce strict execution boundaries and maximize LLM context efficiency for secure, autonomous database interactions. Read the full value proposition
- Installation
- Configuration
- Architecture
- HTTP Transport
- Tool Filtering
- Code Mode
- Tools
- Prompts
- Resources
- Observability & Telemetry