
garethcott/enhanced-postgres-mcp-server
Database management이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
A Model Context Protocol server that provides both read and write access to PostgreSQL databases. This server enables LLMs to inspect database schemas, execute queries, modify data, and create/modify...
개요
A Model Context Protocol server that provides both read and write access to PostgreSQL databases. This server enables LLMs to inspect database schemas, execute queries, modify data, and create/modify database schema objects. This is an enhanced version of the original PostgreSQL MCP server by Anthropic. The original server provides read-only access, while this enhanced version adds write capabilities and schema management. - - Execute read-only SQL queries against the connected database - Input: sql (string): The SQL query to execute - All queries are executed within a READ ONLY transaction - - Execute a SQL statement that modifies data (INSERT, UPDATE, DELETE) - Input: sql (string): The SQL statement to execute - Executed within a transaction with proper COMMIT/ROLLBACK handling - - Insert a new record into a table - Input: - table (string): The table name - data (object): Key-value pairs where keys are column names and values are the data to insert - - Update records in a table...
README
원문 README의 일부입니다. 원문 보기.
PostgreSQL MCP Server (Enhanced)
A Model Context Protocol server that provides both read and write access to PostgreSQL databases. This server enables LLMs to inspect database schemas, execute queries, modify data, and create/modify database schema objects.
Note: This is an enhanced version of the original PostgreSQL MCP server by Anthropic. The original server provides read-only access, while this enhanced version adds write capabilities and schema management.
Components
Tools
Data Query
- query
- Execute read-only SQL queries against the connected database
- Input:
sql(string): The SQL query to execute - All queries are executed within a READ ONLY transaction
Data Modification
-
execute
- Execute a SQL statement that modifies data (INSERT, UPDATE, DELETE)
- Input:
sql(string): The SQL statement to execute - Executed within a transaction with proper COMMIT/ROLLBACK handling
-
insert
- Insert a new record into a table
- Input:
table(string): The table namedata(object): Key-value pairs where keys are column names and values are the data to insert
-
update
- Update records in a table
- Input:
table(string): The table namedata(object): Key-value pairs for the fields to updatewhere(string): The WHERE condition to identify records to update
-
delete
- Delete records from a table
- Input:
table(string): The table namewhere(string): The WHERE condition to identify records to delete
Schema Management
-
createTable
- Create a new table with specified columns and constraints
- Input:
tableName(string): The table namecolumns(array): Array of column definitions with name, type, and optional constraintsconstraints(array): Optional array of table-level constraints
-
createFunction
- Create a PostgreSQL function/procedure
- Input:
name(string): Function nameparameters(string): Function parametersreturnType(string): Return typelanguage(string): Language (plpgsql, sql, etc.)body(string): Function bodyoptions(string): Optional additional function options
-
createTrigger
- Create a trigger on a table
- Input:
name(string): Trigger nametableName(string): Table to apply trigger tofunctionName(string): Function to callwhen(string): BEFORE, AFTER, or INSTEAD OFevents(array): Array of events (INSERT, UPDATE, DELETE)forEach(string): ROW or STATEMENTcondition(string): Optional WHEN condition
-
createIndex
- Create an index on a table
- Input:
tableName(string): Table nameindexName(string): Index namecolumns(array): Columns to indexunique(boolean): Whether the index is unique
설치
docker run -i --rm mcp/postgres postgresql://host.docker.internal:5432/mydb설정
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"]
}
}
}