@siddharth.sharma/db-mcp
v1.0.6
Published
Database MCP integration package
Readme
@siddharth.sharma/db-mcp
Database MCP server for MySQL-compatible environments. This package runs as a stdio MCP server.
Cursor mcp.json setup
{
"mcpServers": {
"db-mcp": {
"command": "npx",
"args": [
"-y",
"@siddharth.sharma/db-mcp",
"stdio"
],
"env": {
"DB_SECRET_JSON_FILE": "/Users/<you>/.mcp-secrets/db-secret.json"
}
}
}
}Secrets and environment
Use one of the following:
DB_SECRET_JSON_FILE(recommended): absolute path to a secret JSON file.DB_SECRET_JSON: inline JSON secret.MCP_DB_CONFIG_PATH: absolute path to a MySQL-style INI config file.
When using DB_SECRET_JSON_FILE or DB_SECRET_JSON, configure allowed operations per environment:
{
"environments": [
{
"name": "prod-readonly",
"host": "db.example.com",
"port": 3306,
"user": "readonly_user",
"password": "replace-me",
"database": "app_db",
"allowed_operations": ["SELECT", "SHOW"]
},
{
"name": "dev-local",
"host": "127.0.0.1",
"port": 3306,
"user": "app_user",
"password": "replace-me",
"database": "app_db",
"allowed_operations": ["SELECT", "SHOW", "INSERT", "UPDATE", "DELETE", "DDL"],
"max_rows": 100000,
"require_where_for_updates": false
}
]
}allowed_operations accepts a JSON array or comma-separated string. Valid values:
SELECT, SHOW, INSERT, UPDATE, DELETE, DDL.
If omitted, environments default to read-only (SELECT, SHOW). You can also use
access_level (read_only, read_write, full) as shorthand instead of listing operations.
Guardrails enforce injection prevention and block SQL keywords for operation types that are
not listed in allowed_operations for that environment.
Available tools
help: quick usage and safety guide.
Dedicated db_* tools (one per operation):
db_list_environments,db_connect,db_disconnectdb_execute_query,db_execute_writedb_list_tables,db_describe_table,db_get_table_sampledb_explain_query,db_get_database_infodb_search_columns,db_get_table_relationships,db_get_access_info
Recommended usage flow
- Call
help. - Call
db_list_environments. - Call
db_connectwith the target environment name. - Use read tools first (
db_execute_query,db_list_tables,db_describe_table). - Use
db_execute_writeonly after explicit approval withconfirmed: true.
