@bossforce.ai/mcp-mysql
v0.1.0
Published
MCP server for **MySQL**, built on the [`mysql2`](https://sidorares.github.io/node-mysql2/) driver. Read-only by default — a good fit for reporting and data lookups.
Downloads
35
Readme
@bossforce.ai/mcp-mysql
MCP server for MySQL, built on the mysql2
driver. Read-only by default — a good fit for reporting and data lookups.
Credentials
| Env | How to obtain |
| ------------------------- | --------------------------------------------------------------------------- |
| MYSQL_CONNECTION_STRING | mysql://user:password@host:port/database for your database. |
| MYSQL_ALLOW_WRITES | Optional. Set to true to permit writes; omit for read-only (recommended). |
The connection string is read lazily, so the server boots and answers
tools/list without it; calls fail with an auth error until it is set. For
defence in depth, point it at a read-only database user when writes aren't
needed.
Tools
| Tool | Arguments | Returns |
| ---------------- | ----------------------- | ----------------------------- |
| query | sql, params? | { rows, row_count, fields } |
| list_tables | schema? (default: db) | { tables: [...] } |
| describe_table | table, schema? | { columns: [...] } |
list_tables and describe_table default to the connection's database via
DATABASE().
Safety
By default every statement runs inside a START TRANSACTION READ ONLY, so any
INSERT/UPDATE/DELETE/DDL fails at the database (error 1792, SQLSTATE
25006). Set MYSQL_ALLOW_WRITES=true to allow writes. Always pass
user-supplied values through params (?) rather than concatenating them into
the SQL.
Develop
pnpm --filter @bossforce.ai/mcp-mysql build
pnpm --filter @bossforce.ai/mcp-mysql testTests inject a fake query implementation, so they run without a real database. Regenerate the tools/list snapshot after an intentional signature change:
UPDATE_SNAPSHOTS=1 pnpm --filter @bossforce.ai/mcp-mysql test