Back to blog

How to Set Up a MySQL MCP Server With Claude Cowork

Spencer Pauly
Spencer Pauly
4 min read
How to Set Up a MySQL MCP Server With Claude Cowork

I was prepping a one-on-one with our head of sales last week and I wanted to walk in with the top customers by lifetime value, not a guess at it. I had maybe ten minutes before the call. Pulling it up in a SQL client would have meant switching apps, finding the right connection, remembering which tables had what, writing the query, and then copying the result into my notes. Instead I typed the question into Claude Cowork while I was already in the doc I was using for the meeting. Got the table back, pasted it in, done.

Here's how to connect your MySQL database to Claude Cowork so this works for you too.

Part of the MySQL MCP Server guide.

What you'll need

  • A MySQL database (a read replica is strongly recommended for production)
  • A QueryBear account
  • Claude Cowork installed on your Mac or Windows machine

Why route through a gateway

Giving an AI tool your raw database URL means it has full access to whatever your DB user can do, with no logging and no guardrails. QueryBear sits between Cowork and MySQL: it parses every statement and rejects anything that isn't a SELECT, enforces a table allowlist, strips sensitive columns from results, and applies a row limit and statement timeout on every query. The full breakdown is in the MySQL MCP Server guide.

Connect QueryBear to your MySQL database

  1. Open the QueryBear dashboard and click "New connection."
  2. Pick "MySQL" and paste your connection URL. Use a read replica if you have one, and connect with a user that has only the SELECT privilege.
  3. Under "Allowed tables," select the tables Cowork should be able to see. Anything you leave off the list is invisible to the agent.
  4. Under "Blocked columns," add anything sensitive: password_hash, credit_card_last4, internal_notes, whatever fits your schema.
  5. Save. QueryBear will verify the connection.

One MySQL-specific note: make sure your WHERE clauses match the column types exactly. MySQL's implicit type coercion can cause a query to silently return the wrong results if you compare a string to an integer column. QueryBear will generate correct SQL, but it's worth knowing why.

Install the QueryBear MCP server in Claude Cowork

Open Claude Cowork and navigate to Settings → Connectors → Add custom connector.

Fill in:

  • Name: querybear
  • URL: https://mcp.querybear.com/mcp

Save, and restart Cowork if prompted. After that, every Cowork session will have access to list_connections, get_schema, and run_query through QueryBear's gateway.

Ask your first question

With everything connected, you can ask questions the way you'd phrase them in a Slack message:

I asked: "Find the top 20 customers by lifetime value."

Claude Cowork checked the schema and ran:

SELECT u.id, u.email, SUM(o.amount) AS total_value
FROM users u
JOIN orders o ON o.user_id = u.id
WHERE o.status = 'paid'
GROUP BY u.id, u.email
ORDER BY total_value DESC
LIMIT 20;

Twenty rows came back. I had the list in my one-on-one doc before I finished my coffee.

The query used standard MySQL aggregate syntax and backtick-safe identifiers. Nothing exotic. It just worked.

A Claude Cowork-specific tip

Cowork results paste cleanly into documents. When you copy a result table from a Cowork session, it lands in Google Docs, Notion, or Confluence as a formatted table with headers, not as tab-separated text you have to clean up. For things like one-on-one prep, quarterly reviews, or customer health checks, this is genuinely useful. You're already in the document when you ask the question, and the answer goes in right where you need it without reformatting.

If you need to share the raw data, the "Open in spreadsheet" option exports as CSV, which opens directly in Excel or Sheets.

Using a different tool?

Querying a different database?

Database Access

Give Your AI Agents
Database Access. Securely.

Connect any database. Control permissions. Audit every query. All running locally on your machine.