Database connection for executing queries. To operate the MCP server, PostgreSQL must be installed.
git clone https://github.com/Faxziah/mcp-database.gitnpm installnpm run build- Adding the MCP server. You need to specify your own database connection details:
"mcp-database": {
"command": "node",
"args": [
"/Users/USERNAME/path_to_mcp_folder/build/index.js"
],
"env": {
"DB_HOST": "localhost",
"DB_USER": "my_db_username",
"DB_NAME": "my_db_name",
"DB_PASSWORD": "my_db_password",
"ALLOW_INSERT": "false",
"ALLOW_UPDATE": "false",
"ALLOW_DELETE": "false"
}
}
- Adding the "schema" resource to the prompt via the "query" tool.
- Parameters to allow or prohibit insertion, updating, and deletion in the database:
"ALLOW_INSERT": "false",
"ALLOW_UPDATE": "false",
"ALLOW_DELETE": "false"
- "Get all contracts"
- "Display all fields from the users table"
DB_HOST=localhost DB_USER=my_db_username DB_NAME=my_db_name DB_PASSWORD=my_db_password jest