MySQL MCP Server
Provides read-only natural-language query access to a MySQL database, with tools to list tables, describe table schemas, and run SELECT queries with configurable row limits.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MySQL MCP ServerWhich cars were rented out last week?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL MCP Server
A remote MCP (Model Context Protocol) server that gives Claude read-only, natural-language query access to a MySQL database — so Claude for Excel (or claude.ai) can query the live database directly, instead of you importing tables into a workbook via ODBC/Power Query first.
It exposes three tools:
list_tables()— names of all tablesdescribe_table(table_name)— columns/types for one tablerun_query(sql, row_limit=200)— run aSELECTand get rows back
Only SELECT (and WITH ... SELECT) statements are allowed; the server
rejects everything else (INSERT, UPDATE, DELETE, DDL, multiple
statements) before it ever reaches the database. Combine this with a
read-only database user (below) for defense in depth.
Why this needs to be hosted somewhere public
Claude connects to custom connectors from Anthropic's cloud
infrastructure, not from your laptop. That means this server has to be
reachable on the public internet (or at least from Anthropic's IP
ranges) — running it on localhost and pointing Claude at it will not
work. The instructions below deploy it to Render's free tier, which
gives you a stable https://...onrender.com URL. (Fly.io or Railway
work the same way if you'd rather use one of those.)
Because it's public, the auth token and the read-only database user described below aren't optional extras — they're what keeps this safe to run.
Related MCP server: MCP MySQL Server
1. Create a read-only MySQL user
Don't point this server at an account with write access. On the MySQL server (run this once, from any MySQL client with admin rights):
CREATE USER 'readonly_user'@'%' IDENTIFIED BY 'a-strong-password-here';
GRANT SELECT ON car_rental_original.* TO 'readonly_user'@'%';
FLUSH PRIVILEGES;If the database is an AWS RDS instance, you'll also need its security
group to allow inbound connections on port 3306 from wherever you
deploy the server (see step 3) — Render/Fly.io/Railway don't publish
fixed IP ranges on their free tiers, so the simplest option for a
teaching/personal setup is to allow the RDS instance's public access on
3306 and rely on the strong password + SSL + the fact that only
SELECT is possible for this user. If that's too permissive for your
comfort, host the MCP server on AWS instead (e.g. a small EC2/Fargate
service in the same VPC as the RDS instance), so the database itself
never needs to be internet-facing.
2. Generate an auth token
python -c "import secrets; print(secrets.token_urlsafe(32))"Save this value — you'll set it as AUTH_TOKEN on the host and paste
it into Claude's connector settings later.
3. Run it locally first (Mac or Windows, via Docker)
This step works identically on both platforms since Docker abstracts the OS. Install Docker Desktop if you don't have it, then from this folder:
cp .env.example .env
# edit .env with your real MYSQL_HOST / USER / PASSWORD / DATABASE / AUTH_TOKEN
docker build -t mysql-mcp-server .
docker run --env-file .env -p 8000:8000 mysql-mcp-serverQuick sanity check in another terminal (should return 401 Unauthorized
without a token, and a normal MCP response with one):
curl -i http://localhost:8000/mcp
curl -i http://localhost:8000/mcp \
-H "Authorization: Bearer <your AUTH_TOKEN>" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'This only proves the server runs — Claude still can't reach it here,
since localhost isn't public. Once it works locally, move to step 4.
4. Deploy to Render (free, public URL)
Push this folder to a GitHub repo (Render deploys from a repo, on either platform — this step is the same whether you did step 3 on Mac or Windows).
Go to render.com, sign up/in, click New + → Web Service, and connect that repo. Render will detect the
Dockerfileautomatically.Under Environment, add:
MYSQL_HOST,MYSQL_PORT,MYSQL_USER,MYSQL_PASSWORD,MYSQL_DATABASE,MYSQL_SSL,AUTH_TOKEN— same values as your local.env.Deploy. Render gives you a URL like
https://mysql-mcp-server-xxxx.onrender.com. Your MCP endpoint is that URL plus/mcp, e.g.https://mysql-mcp-server-xxxx.onrender.com/mcp.
(A render.yaml is included if you prefer Render's "Blueprint" deploy
flow instead of the manual steps above — either works.)
Note: Render's free tier spins the service down after periods of inactivity and takes a few seconds to wake back up on the next request. Fine for a teaching/personal setup; upgrade to a paid instance if you want it always warm.
5. Register it as a custom connector in Claude
In Claude (claude.ai or the Excel add-in's settings), go to Customize → Connectors.
Click + → Add custom connector.
Paste the URL from step 4 (the one ending in
/mcp).Open Advanced settings and set the bearer token to your
AUTH_TOKENvalue.Click Add.
Because connectors are tied to your Claude account rather than a device, this one registration makes the connector available in Claude for Excel on both your Mac and Windows machines — no need to repeat this step per computer, just sign in with the same account.
6. Try it
In Claude for Excel, open the + menu below the chat input → Connectors, make sure this connector is enabled for the conversation, and ask something like:
"Using the MySQL connector, list the tables in the database."
"Which rental agency has the most cars in the
cartable?"
Claude will call list_tables / describe_table / run_query on its
own to answer, pulling only what it needs from the live database.
Troubleshooting
421 Invalid Host header— the MCP SDK's DNS-rebinding protection rejected the request's Host header. This shouldn't happen against a normal Render/Fly.io/Railway URL; if you put a custom reverse proxy in front of it, make sure it forwards the original Host header, or relaxtransport_securityinserver.py(FastMCP(..., transport_security= TransportSecuritySettings(allowed_hosts=["*"]))).401 Unauthorized— the bearer token in Claude's connector settings doesn't matchAUTH_TOKENon the host. Re-check both.Connection to MySQL times out — check the database's security group / firewall allows inbound connections from your host's IPs, and that
MYSQL_SSLmatches what the database requires.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Ask data questions in natural language. Get SQL, insights, and charts from your databases.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to inspect and query a MySQL database through safe, structured tools, including schema discovery and read-only queries.989MIT
- AlicenseAqualityDmaintenanceEnables read-only MySQL database connectivity, allowing execution of SELECT queries, listing tables, and describing table structures via natural language.323MIT
- AlicenseAqualityCmaintenanceEnables Claude Desktop to execute read-only SQL queries on MySQL databases via natural language, with dynamic connection switching and built-in security.32417MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language querying of MySQL databases via Claude Code, allowing SELECT queries, table listing, and schema inspection.454MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kcsgh/mysql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server