-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Chris edited this page Jun 17, 2026
·
128 revisions
Enterprise-grade MySQL MCP Server with OAuth 2.0 authentication, connection pooling & tool filtering – TypeScript Edition
A MySQL MCP Server that enables AI assistants (Claude, Cursor, etc.) to interact with MySQL databases through the Model Context Protocol with deterministic error handling. It provides 241 Specialized Tools, 22 resource categories (50 endpoints), and 19 AI-powered prompts for database operations, performance analysis, and administration.
| Resource | Description |
|---|---|
| Installation | Prerequisites and setup guide |
| Configuration | Environment variables, MCP client configs |
| Tool-Filtering | Reduce tool count for IDE limits |
| Tool-Reference | Complete list of all 241 tools |
| Code-Mode | Sandboxed code execution (70-90% token savings) |
| Resources | Database observability (50 endpoints) |
| Prompts | AI-powered workflows (19 prompts) |
| Audit-Trail | JSONL forensic logging & token metrics |
-
PNPM:
pnpm add -g @neverinfamous/mysql-mcp(recommended) -
Docker:
docker run -i --rm writenotenow/mysql-mcp:latest
- 241 MySQL Tools across 28 categories
-
Deterministic Error Handling — structured
{success, error, code, category, suggestion, recoverable}on every tool - Adaptive Instruction Architecture — dynamic loading of help content based on active tool groups to ensure clients stay within token limits
-
Resource Subscriptions — native MCP subscriptions (
resources/subscribe) for real-time schema and status update notifications -
Progress Tracking — real-time progress notifications (
notifications/progress) for long-running administrative operations (e.g., table checks, exports, Code Mode) - Audit Trail & Token Logging — JSONL forensic logging with pre-mutation snapshots
- 22 resource categories (50 endpoints) for database observability
- 19 AI-Powered Prompts for guided workflows
- Native Sandbox Isolation — Code Mode executes in a native isolated-vm V8 instance with synchronous callbacks, enforced heap limits, and hard timeouts
-
Token-Optimized Payloads — Tools with large responses offer optional
summary,limit, andcompactflags to reduce token usage - Tool Filtering Shortcuts (starter, dev-power, dba-monitor, etc.)
- Connection Pooling via mysql2
- OAuth 2.0 enterprise authentication support
- Advanced Encryption (TLS/SSL, masking, compliance tools)
- Docker Deployment with multi-arch images
The mysql-mcp project is organized into modular directories under src/:
-
src/adapters/— Database driver adapters and the 241 tool implementations -
src/audit/— JSONL forensic logging and token tracking -
src/auth/— OAuth 2.0 authentication flow -
src/cli/— CLI argument parsing and help output -
src/codemode/— Isolated-vm sandbox execution and TS type injection -
src/constants/— Static strings, error codes, and configuration defaults -
src/filtering/— Meta-group tool shortcuts and filtering logic -
src/logging/— Console logging utilities -
src/observability/— MCP resources and prompts for database diagnostics -
src/pool/— MySQL connection pool management -
src/progress/— Real-time progress notifications for long-running tasks -
src/server/— Core MCP server initialization and request handling -
src/transports/— Stdio, HTTP, and SSE transport layers -
src/types/— Shared TypeScript interfaces and Zod schemas -
src/utils/— Helper functions and common utilities
| Category | Tools | Description |
|---|---|---|
| Core | 12 | CRUD, schema, tables, indexes |
| Transactions | 7 | BEGIN, COMMIT, ROLLBACK, savepoints |
| JSON | 17 | JSON functions + merge, diff, stats |
| Text | 6 | REGEXP, LIKE, SOUNDEX |
| FULLTEXT | 5 | Natural language search |
| Performance | 11 | EXPLAIN, query analysis, anomaly detection |
| Optimization | 4 | Index hints, recommendations |
| Admin | 9 | OPTIMIZE, ANALYZE, CHECK, insights |
| Monitoring | 7 | PROCESSLIST, status variables |
| Backup | 7 | Export, import, mysqldump, audit backups |
| Replication | 5 | Master/slave, binlog |
| Partitioning | 4 | Partition management |
| Router | 9 | MySQL Router REST API |
| ProxySQL | 11 | Proxy management |
| Shell | 10 | MySQL Shell utilities |
| Schema | 11 | Views, procedures, triggers, constraints |
| Introspection | 6 | Dependency graphs, cascade simulation, snapshots |
| Migration | 6 | Schema versioning, apply, rollback, history |
| Events | 6 | Event Scheduler management |
| sys Schema | 8 | MySQL sys schema diagnostics |
| Statistics | 20 | Statistical analysis, window functions, sampling |
| Spatial/GIS | 12 | Geometry operations, distance, GeoJSON |
| Vector | 11 | Vector embeddings, KNN search, hybrid search |
| Security | 9 | Audit, SSL, encryption, masking |
| Cluster | 10 | Group Replication, InnoDB Cluster |
| Roles | 8 | MySQL 8.0 role management |
| Document Store | 9 | JSON document collections |
| Code Mode | 1 | Sandboxed code execution (isolated-vm V8 isolate) |
| Topic | Description |
|---|---|
| OAuth | OAuth 2.1 enterprise authentication |
| HTTP-Transport | Dual HTTP transport deployment guide |
| MySQL-Router | Configure MySQL Router tool access |
| ProxySQL | Configure ProxySQL admin access |
| MySQL-Shell | Configure MySQL Shell integration |
| MCP-Inspector | Visual debugging guide |
| Capacity-Planning | Database sizing, caching, maintenance, token budgets |
| Performance-Tuning | Connection pools, query analysis, Code Mode efficiency |
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