mysql-context-mcp
Provides tools for retrieving recent MySQL row changes, fetching diffs, and acknowledging changes, using outbox or watermark modes to track row-level before/after modifications.
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-context-mcpWhat's changed in MySQL since I last checked?"
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-context-mcp
Light stdio MCP server. A local binlog indexer records ROW-format MySQL
changes. Agents pull compact field diffs (from / to) into context. No UI.
License: MIT. Do not commit DSNs. See SECURITY.md.
Modes
Mode | What you get | Deploy cost |
binlog (default) | Real before/after from the binary log, served as field diffs | Replica grants + ROW binlog |
outbox | Real before/after from table triggers | One extra table + 3 triggers per watched table |
watermark | Current rows newer than | Config only. Not a diff. |
recent_changes in binlog mode returns the field diff only. Pass full: true
or call get_diff when you need the whole before/after images.
Related MCP server: MySQL MCP Server
MySQL setup (binlog)
[mysqld]
server-id = 1
log_bin = mysql-bin
binlog_format = ROW
binlog_row_image = FULL
binlog_row_metadata = FULLGRANT REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'agent'@'%';binlog_row_image=FULL is what makes UPDATE events carry a before image.
MINIMAL/NOBLOB will index inserts and deletes, but updates will look like
partial rows.
Check the server, then run the MCP:
git clone https://github.com/velinussage/mysql-context-mcp.git
cd mysql-context-mcp
npm install
cp config.example.yaml mysql-context.yaml
export MYSQL_CONTEXT_DSN='mysql://agent@127.0.0.1:3306/app'
export MYSQL_CONTEXT_PASSWORD # set in the environment, not in this file
npx tsx src/install.ts # preflight: log_bin / ROW / FULL
npx tsx src/server.tsThe indexer writes a local event log under the process home directory
(~/.mysql-context/<database>-binlog/). Override with MYSQL_CONTEXT_INDEX.
The MCP process tails the binlog while it is running. You can also run
npx tsx src/indexer.ts as a long-lived tailer and keep the MCP read-only
against the same index directory.
Tools
Tool | Use |
| Unacked field diffs, capped JSON. Optional |
| One change, including before/after images. |
| Mark seen so they leave the next pull. |
There is no execute_sql and no install tool on the MCP server.
Attach to a harness
{
"mcpServers": {
"mysql-context": {
"command": "npx",
"args": ["tsx", "src/server.ts"],
"cwd": ".",
"env": {
"MYSQL_CONTEXT_CONFIG": "./mysql-context.yaml",
"MYSQL_CONTEXT_DSN": "${MYSQL_CONTEXT_DSN}",
"MYSQL_CONTEXT_PASSWORD": "${MYSQL_CONTEXT_PASSWORD}"
}
}
}
}Set cwd to the clone. Keep credentials in the process environment.
Claude Agent SDK:
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "What changed in MySQL? Use recent_changes and cite the field diffs.",
options: {
mcpServers: {
"mysql-context": {
command: "npx",
args: ["tsx", "src/server.ts"],
env: {
MYSQL_CONTEXT_CONFIG: "./mysql-context.yaml",
MYSQL_CONTEXT_DSN: process.env.MYSQL_CONTEXT_DSN!,
MYSQL_CONTEXT_PASSWORD: process.env.MYSQL_CONTEXT_PASSWORD!,
},
},
},
allowedTools: [
"mcp__mysql-context__recent_changes",
"mcp__mysql-context__get_diff",
"mcp__mysql-context__ack_changes",
],
},
})) {
// ...
}Skill
Copy skill/mysql-context/SKILL.md into the project skills dir so the agent
calls recent_changes and treats diff as the change, not the live row.
When this is the wrong tool
Use something else when you need:
Need | Why not this | Use instead |
Current table rows (“what is in | This indexes changes, not live state. Watermark mode is a last-resort SELECT and is not a diff. | A read-only SQL MCP, or query MySQL yourself |
Arbitrary SQL, writes, or schema changes | There is no | A separate, tightly scoped SQL tool |
A UI, search page, or ops dashboard | This is stdio MCP + a local event log only. | dbtrail or a CDC product with a UI |
A warehouse, Kafka stream, or analytics replica | The index is a short, local, single-agent tail. It is not a pipeline. | Debezium, Maxwell, or a managed CDC replica |
Forever history of every row, many consumers | The local index caps and drops acked events. | A binlog consumer that writes to durable storage |
Statement-based or MIXED binlog, or no replica grants | ROW + FULL row image and | Outbox mode (triggers) if you can install them; otherwise do not pretend you have diffs |
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
MySQL change tracking with instant row-level recovery and forensic attribution for compliance.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
PostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.
Versioned agent memory in your own Postgres: portable context, permissioned, audit trail.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to safely interact with MySQL/MariaDB databases, supporting read-only queries by default with optional write operations and access control.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with a MySQL database using natural language, automating SQL tasks like querying, inserting, updating, and deleting data.1
- AlicenseAqualityCmaintenanceEnables AI agents to dynamically register and query MySQL-compatible databases at runtime with built-in destructive SQL protection.61MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with PostgreSQL or MySQL databases using natural language. Supports SQL queries, schema discovery, and pre-built aggregations without writing SQL.289MIT
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/velinussage/mysql-context-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server