Tokenlite Mysql MCP logo

Tokenlite Mysql MCP

Secure MySQL access over MCP with read-only defaults, query guardrails, schema discovery, and semantic templates.

Install Tokenlite Mysql MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "tokenlite-mysql-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@andezdev/tokenlite-mysql-mcp"
      ],
      "env": {
        "DB_NAME": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

tokenlite-mysql-mcp connects MCP-compatible clients to a MySQL database through a security-focused query layer. It parses SQL, checks EXPLAIN plans, applies result limits, and defaults to read-only operation, with optional AST-controlled permissions for writes and DDL. Schema search, metadata dictionaries, semantic query templates, and relationship-aware context help agents work with database structures without loading unnecessarily large schemas. Use it when an agent needs bounded MySQL access with production-oriented controls.

Use cases

  • Query a MySQL database from an MCP-compatible coding or desktop client
  • Inspect schemas without sending the entire database structure to an agent
  • Protect production reads with EXPLAIN and result-size guardrails
  • Expose approved business queries through semantic templates
  • Enable narrowly scoped database writes when required

Key features

  • Read-only defaults with independent write and DDL permissions
  • AST-based SQL policy and injection defenses
  • EXPLAIN full-scan blocking and automatic result limits
  • Schema search with inferred join context
  • CSV-style output with NULL and truncation markers
  • MCP prompts and completions for templates and tables

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

18/19 checks healthy over the last 111d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · @andezdev/tokenlite-mysql-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads484Package downloads in the last 30 days.
Last commit6d agoMost recent push to the default branch.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Tokenlite Mysql MCP works

What tokenlite-mysql-mcp does

tokenlite-mysql-mcp exposes MySQL database access through the Model Context Protocol. It is intended for agent workflows that need to inspect schemas, run queries, and optionally modify database contents under explicit policy controls.

The default posture is read-only. INSERT, UPDATE, DELETE, and DDL operations can be enabled independently through environment variables. SQL is parsed before execution, including nested subqueries, common table expressions, and UNION branches. The policy rejects access to other schemas and system schemas, several information-disclosure and server-control statements, locking reads, executable comments, and selected dangerous functions.

How it works

The execute_safe_query path uses two separate protections. An EXPLAIN-based gate can reject an unindexed full-table scan when its estimated row count exceeds MCP_EXPLAIN_MAX_SCAN_ROWS. A separate MCP_QUERY_ROW_LIMIT value caps returned rows by injecting a LIMIT into the parsed query. If the cap is reached, the response includes a truncation marker so an agent can distinguish partial results from a complete result set.

When all write permissions remain disabled, the connection pool also uses a MySQL session-level read-only transaction setting. This adds a database-engine safeguard alongside the SQL parser. Connection pooling, retry controls, queue limits, query timeouts, and request-rate limits provide additional operational controls.

Query results are formatted as CSV-style markdown rather than verbose JSON. NULL values are represented with ∅, reducing repeated structural tokens in agent context.

Schema exploration can use a custom metadata dictionary and infer likely relationships between tables. When a table is searched, the server packages related join context instead of requiring the full database schema in every response. Semantic templates are exposed through the MCP Prompts API, and table names and template keywords support MCP completion requests.

Setup and configuration

Run the package with Node.js 20 or newer and connect it to MySQL 5.7 or newer; MySQL 8.0 or later is recommended. The database user should have SELECT permission. SHOW VIEW is only relevant when view-definition output is needed.

The required database setting is DB_NAME. DB_HOST, DB_PORT, DB_USER, and DB_PASSWORD configure the connection and have defaults. A typical stdio launch uses npx -y @andezdev/tokenlite-mysql-mcp, with these values supplied in the MCP client's environment configuration.

Set MCP_METADATA_PATH and MCP_TEMPLATES_PATH to absolute paths when using custom semantic dictionaries or query templates. TOOL_PREFIX can distinguish tool names when multiple database instances are configured. Enable TLS with DB_SSL for supported managed or cloud database connections.

Tools and capabilities

  • Execute bounded SQL through the safe-query flow.
  • Search database schema information and refresh cached DDL.
  • Apply EXPLAIN-based full-scan protection and AST-injected row limits.
  • Discover tables through the mysql://tables/{name} resource template and MCP completions.
  • Expose approved analytical query templates through the query_templates MCP prompt.
  • Enable INSERT, UPDATE, DELETE, or DDL independently through environment settings.
  • Return compact CSV-formatted results with explicit NULL and truncation markers.

Limitations and notes

The SQL policy is defense in depth and does not replace MySQL grants. Write and DDL permissions are disabled by default, but enabling them changes the server's access profile and should match the database user's privileges. Full-table scans can be rejected before execution when their EXPLAIN estimates exceed the configured threshold. Result limits and scan thresholds are independent settings, so increasing one does not change the other.

The server blocks access to schemas outside the configured database, including information_schema, mysql, performance_schema, and sys. It also rejects statements and functions associated with file access, delays, locks, server or user variables, and privilege escalation.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Tokenlite Mysql MCP

tokenlite-mysql-mcp is an MCP server that connects compatible AI clients to MySQL databases through guarded SQL tools, schema search, and semantic query templates. It defaults to read-only access, checks queries with AST parsing and optional EXPLAIN protection, limits returned rows, and can selectively enable INSERT, UPDATE, DELETE, or DDL operations.

Install and run it with `npx -y @andezdev/tokenlite-mysql-mcp` from your MCP client configuration. Set `DB_NAME` and, when needed, `DB_HOST`, `DB_PORT`, `DB_USER`, and `DB_PASSWORD` in the client's environment settings. Node.js 20 or newer is required.

Yes, tokenlite-mysql-mcp works with Cursor as a command-type MCP server. Add a new MCP server under Cursor Settings > Features > MCP, use `npx -y @andezdev/tokenlite-mysql-mcp` as the command, and enter the database environment variables in Cursor.

It parses statements before execution, can reject EXPLAIN plans showing oversized unindexed full-table scans, and injects a configured LIMIT into eligible queries. The server also blocks several schemas, statements, comments, functions, and access patterns, while MySQL session read-only mode protects strict read-only configurations.

Yes, but write operations are disabled by default and must be enabled individually. `ALLOW_INSERT_OPERATION`, `ALLOW_UPDATE_OPERATION`, `ALLOW_DELETE_OPERATION`, and `ALLOW_DDL_OPERATION` control INSERT or REPLACE, UPDATE, DELETE or TRUNCATE, and supported DDL operations respectively.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewTokenlite Mysql MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/tokenlite-mysql-mcp?style=directory)](https://allmcps.com/mcp/tokenlite-mysql-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/tokenlite-mysql-mcp"><img src="https://allmcps.com/api/badge/tokenlite-mysql-mcp?style=directory" alt="Tokenlite Mysql MCP on AllMCPs" /></a>