Skip to main content
Glama
velinussage

mysql-context-mcp

by velinussage

mysql-context-mcp

Light stdio MCP server. Agents pull compact MySQL row diffs into context. No UI, no replica, no Kafka.

License: MIT. Do not commit DSNs. See SECURITY.md.

Modes

Mode

What you get

Deploy cost

outbox (default)

Real before/after from table triggers

One extra table + 3 triggers per watched table

watermark

Rows newer than updated_at (no before-image, deletes missed)

Config only

Related MCP server: MySQL MCP Server

Setup

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://user@127.0.0.1:3306/app'

Put the password in the environment DSN, not in the YAML. Edit tables: to the few tables agents should see.

Install triggers once, from a privileged shell — not from the agent:

npx tsx src/install.ts

After that, run the MCP with a user that can only SELECT watched tables and SELECT/UPDATE the outbox table.

Tools

Tool

Use

recent_changes

Default pull. Unacked diffs, capped, JSON.

get_diff

One change (change_id, or table+pk in watermark mode).

ack_changes

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

Claude Code / Grok / Cursor (project .mcp.json):

{
  "mcpServers": {
    "mysql-context": {
      "command": "npx",
      "args": ["tsx", "src/server.ts"],
      "cwd": ".",
      "env": {
        "MYSQL_CONTEXT_CONFIG": "./mysql-context.yaml",
        "MYSQL_CONTEXT_DSN": "${MYSQL_CONTEXT_DSN}"
      }
    }
  }
}

Set cwd to the clone. Keep MYSQL_CONTEXT_DSN in the process environment, not in a committed file.

Claude Agent SDK:

import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "What changed in MySQL since last look? Use recent_changes.",
  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!,
        },
      },
    },
    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 .claude/skills/ or .grok/skills/ so the agent calls recent_changes before reasoning about live rows.

When this is the wrong tool

  • You need a full history of every row forever — use a binlog indexer

  • You need a live analytics replica — use a CDC replica

  • You need the agent to run arbitrary SQL — do not add that here

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    Enables AI agents to safely interact with MySQL/MariaDB databases, supporting read-only queries by default with optional write operations and access control.
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    Enables AI agents to interact with a MySQL database using natural language, automating SQL tasks like querying, inserting, updating, and deleting data.
    1
  • A
    license
    -
    quality
    C
    maintenance
    Enables AI agents to interact with PostgreSQL or MySQL databases using natural language. Supports SQL queries, schema discovery, and pre-built aggregations without writing SQL.
    310
    MIT

View all related MCP servers

Related MCP Connectors

  • An agent-friendly API for product changelogs. A unified registry via CLI, API, or MCP.

  • The agent-native cloud: database, functions, AI, storage, computers. 50 tools, one API key.

  • Universal memory for AI agents and tools. Save, organize and search context anywhere.

View all MCP Connectors

Latest Blog Posts

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