Psycopg2 MCP server
MCP server exposing psycopg2 PostgreSQL database adapter functionality
0 stars12 downloads/wk
Reviews
Write oneNobody has reviewed Psycopg2 yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
Psycopg2 tools (37, 10 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
begin_transactionBegin a new transaction.
cancel_querywrite actionCancel the current database operation.
close_connectionClose an existing database connection.
close_cursorClose a database cursor.
commit_transactionCommit the current transaction.
connectwrite actionCreate a new PostgreSQL database connection.
copy_expertwrite actionExecute custom COPY statement.
copy_fromCopy data from a file-like object to a table.
copy_toCopy data from a table to a file-like object.
create_cursorwrite actionCreate a new database cursor.
create_large_objectwrite actionCreate or open a large object.
create_named_cursorwrite actionCreate a server-side named cursor.
execute_manywrite actionExecute a SQL query with multiple parameter sets.
execute_querywrite actionExecute a SQL query.
fetch_allFetch all remaining rows from cursor.
fetch_manyFetch multiple rows from cursor.
fetch_oneFetch one row from cursor.
get_backend_pidGet backend process ID.
get_connection_infoGet information about a database connection.
get_dsn_parametersGet connection parameters.
get_noticesGet database notices.
get_server_versionGet PostgreSQL server version.
list_connectionsList all active connections.
list_cursorsList all active cursors.
make_dsnwrite actionCreate a connection string from arguments.
mogrifyReturn query string after parameter binding.
parse_dsnParse a connection string.
quote_identifierQuote an SQL identifier.
read_large_objectRead from a large object.
register_compositeRegister composite type adapter.
register_hstoreRegister hstore type adapter.
register_jsonRegister JSON type adapter.
rollback_transactionRollback the current transaction.
scroll_cursorScroll through cursor results.
set_isolation_levelSet transaction isolation level.
set_sessionSet session parameters.
write_large_objectwrite actionWrite to a large object.
Public scan report
scanner v0.1.9 · 2026-09-27 · same rubric, same numbers if you re-run it
- Code scan4 source files scanned25/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 159 days ago8/15
- Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
How Psycopg2 compares
Against every graded Databases MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 82/100
- higher than 55% of 802 Databases servers
- Tools
- 37
- the typical Databases server has 8
- Tools that change things
- 27%
- typical: 10%. Fewer write tools means less an agent can break
- Downloads a week
- 12
- more than 3% of 324 Databases servers with a package
What its tools let an agent do: 20 read · 8 create · 6 change · 1 delete · 2 run or deploy
Install Psycopg2 in Claude Code, Cursor or VS Code
claude mcp add mcp-psycopg2 -- uvx mcp-psycopg2
What the publisher says
From the Psycopg2 repository's README, as published. We do not edit it. Read it on GitHub
mcp-psycopg2
MCP server exposing psycopg2 PostgreSQL database adapter functionality.
mcp-name: io.github.daedalus/mcp-psycopg2
Install
pip install mcp-psycopg2Usage
from mcp_psycopg2 import mcp
# Run the MCP server
mcp.run()MCP Tools
The server exposes the following tools for interacting with PostgreSQL databases:
Connection Management
- connect - Create a new database connection
- close_connection - Close an existing connection
- getconnectioninfo - Get connection details
Transaction Management
- begin_transaction - Start a new transaction
- commit_transaction - Commit the current transaction
- rollback_transaction - Rollback the current transaction
- setisolationlevel - Set transaction isolation level
Cursor Operations
- create_cursor - Create a new cursor
- close_cursor - Close a cursor
- execute_query - Execute a SQL query
- execute_many - Execute a query with multiple parameter sets
- fetch_one - Fetch one row
- fetch_many - Fetch multiple rows
- fetch_all - Fetch all remaining rows
SQL Composition
- quote_identifier - Quote an SQL identifier
- mogrify - Return query string after parameter binding
Type Registration
- register_json - Register JSON type adapter
- register_hstore - Register hstore type adapter
- register_composite - Register composite type adapter
COPY Operations
- copy_from - Copy data from file to table
- copy_to - Copy data from table to file
- copy_expert - Execute custom COPY statement
Server-Side Cursors
- createnamedcursor - Create a server-side named cursor
- scroll_cursor - Scroll through cursor results
Large Objects
- createlargeobject - Create or open a large object
- readlargeobject - Read from a large object
- writelargeobject - Write to a large object
Information
- getserverversion - Get PostgreSQL server version
- getbackendpid - Get backend process ID
- getdsnparameters - Get connection parameters
- get_notices - Get database notices
- parse_dsn - Parse a connection string
- make_dsn - Create a connection string
Utility
- cancel_query - Cancel the current database operation
- set_session - Set session parameters
- list_connections - List all active connections
- list_cursors - List all active cursors
Development
git clone https://github.com/daedalus/mcp-psycopg2.git
cd mcp-psycopg2
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/Nothing above is checked by us. What we check is on the safety report.
Psycopg2: common questions
- Is Psycopg2 MCP server safe?
- Mostly: it is graded B (82/100). Read the Psycopg2 safety report
- How do I install Psycopg2?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does Psycopg2 need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is Psycopg2 maintained?
- The last commit was 195 days ago (2026-04-21). The latest release is v0.1.0.
- What can I use instead of Psycopg2?
- Servers from other publishers that do the same job: DBHub MCP server, Faucet MCP server and CogniCore MCP server.
- How does Psycopg2 compare with other Databases MCP servers?
- safety score 82/100 (higher than 55% of 802 Databases servers); tools 37 (the typical Databases server has 8); tools that change things 27% (typical: 10%. Fewer write tools means less an agent can break). Full comparison.
Alternatives to Psycopg2
Same job from other publishers: the closest match first, then the best rated.
- DBHubToken-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLitenot reviewedWidely usedA
- FaucetSQL database to MCP tools and REST API: PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake.not reviewedEstablishedA
- CogniCoreMemory, reflection and safety for AI agents. Hosted or local, no vector database.5.0(1)GrowingA
- Neo4j CypherA simple Neo4j MCP server that allows you to run Cypher queries against a Neo4j database.not reviewedEstablishedA
- AppwriteBuild and deploy backends: auth, Postgres/MySQL/vector databases, storage, functions, hosting, CDNnot reviewedEstablishedA