- Home
- MCP servers
- Postgres-Mysql
Postgres-Mysql
- javascript
4
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"tranchihuu-postgres-mysql-mcp-server": {
"command": "npx",
"args": [
"-y",
"postgres-mysql-mcp-server"
],
"env": {
"DB_SSL": "false",
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_TYPE": "postgresql",
"DB_USER": "postgres",
"DB_DATABASE": "mydb",
"DB_PASSWORD": "password"
}
}
}
}You set up an MCP server that lets your AI-powered editors query PostgreSQL or MySQL databases. It makes your database schema, tables, and data accessible to code-generation, queries, and debugging workflows, so the AI can produce accurate, database-aware code and answers.
How to use
Connect your MCP client (such as Cursor or Windsurf) to the MCP server to enable database-aware AI assistance. Start by ensuring your database type, host, and credentials are available as environment variables or provided when you connect the server. Once connected, you can ask your AI assistant to inspect your schema, generate queries and API code, and debug issues with direct database access. The AI can list tables, describe table schemas, and execute parameterized queries, all through the MCP interface.
How to install
Prerequisites you need before starting:
- Node.js 18 or newer
- Access to your PostgreSQL or MySQL database
- A shell/terminal with permission to install or run commands Choose an installation method and follow the steps exactly.
Additional setup and usage notes
The server supports automatic connection on startup when environment variables are provided. You can run the server directly using a lightweight approach that requires no local installation. When configuring the MCP client, you will typically provide a server configuration that runs the MCP server via an inline command or references a local/remote runtime. The client will then use the server to explore your database schema, write SQL, and generate database-aware code.
Security and best practices
Never expose database credentials in public code. Use environment variables or a secure credential manager. If you enable SSL, ensure your database connection is configured to use SSL. Validate and sanitize all SQL queries in production environments and limit the permissions of the database user used by the MCP server.
Available tools
connect_database
Connect to a PostgreSQL or MySQL database by providing type, host, port, database, user, and password through environment variables or parameters.
execute_query
Run a SQL query against the connected database, with optional parameter values for parameterized queries.
list_tables
List all tables in the current connected database.
describe_table
Retrieve the schema information for a specific table by name.
disconnect_database
Disconnect from the currently connected database.