A small little utility that allows AI assistants that support the Model Context Protocol (MCP) to query databases.
- Support for multiple database systems:
- PostgreSQL
- MySQL
- SQLite
- Simple database connection using DSN (Data Source Name)
connect
: Connect to a database using a DSN.query
: Run a query on a database and return the results in CSV format.flavor
: Get the flavor of a connected database.
go install github.com/alx99/db-mcp/cmd/db-mcp@latest
db-mcp
-default-dsn
: The DSN to use for the default database.
- How can I construct a DSN?
- PostgreSQL
- MySQL (
mysql://
prefix needed) - SQLite (
sqlite://
prefix needed)