MCP (Model Context Protocol): the server I wrote for Bonuxo
I wrote an MCP server in TypeScript to operate Bonuxo’s database from an AI client. I use it in development and operations; what matters most is how much I constrained it.
What MCP is
MCP (Model Context Protocol) is a protocol for a client with a model, such as a coding assistant, to discover and call tools exposed by a server. Instead of writing a different integration for each client, the server declares its tools once.
The Bonuxo server
It is my own MCP server, in TypeScript, for operations on Bonuxo’s database. It is used in development and operations, and Bonuxo is in production. It has 5 tools:
- Guarded DML writes.
- Explain.
- Script generation.
- Whitelisted DDL.
- Checksum-tracked migration apply.
The guards and the trade-off they imply
Giving a model access to a database is the case where constraining it matters most. The guards are an environment gate, a production block, a confirmation token, a DDL blocklist, DML-only, statement and lock timeouts, and automatic rollback.
There are two lists with opposite meanings: permitted DDL is a whitelist and dangerous DDL is a blocklist, so that what is unknown does not run. The cost is friction: every sensitive operation asks for one more step, which is why the server is an operations tool and not an open door.
Related stack
- MCP
- TypeScript
- PostgreSQL