{"id":43648,"library":"postgres-activity-mcp","title":"postgres-activity-mcp","description":"Version 0.1.0. An MCP (Model Context Protocol) server that automatically logs all INSERT, UPDATE, and DELETE operations in a PostgreSQL database and exposes the log to AI coding agents via MCP tools. Unlike manual database introspection, it sets up audit triggers on all tracked tables once, then lets agents query recent row changes without writing SQL. Currently requires Node >=20 and Postgres >=13. Ships four tools: setup_activity_logging, refresh_activity_triggers, get_recent_db_changes, and summarize_recent_db_changes. Not yet stable; API and trigger behavior may change between minor versions.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/ianjaku/postgres-activity-mcp","tags":["javascript"],"install":[{"cmd":"npm install postgres-activity-mcp","lang":"bash","label":"npm"},{"cmd":"yarn add postgres-activity-mcp","lang":"bash","label":"yarn"},{"cmd":"pnpm add postgres-activity-mcp","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"PostgreSQL client for connecting to the database and executing queries from MCP tools.","package":"pg","optional":false}],"imports":[{"note":"This package is a CLI MCP server, not a library. Run via npx or from source. No JS import entry point is published.","wrong":"","symbol":"server (MCP server)","correct":"npx -y postgres-activity-mcp"}],"quickstart":{"code":"{\n  \"mcpServers\": {\n    \"postgres-activity\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"postgres-activity-mcp\"],\n      \"env\": {\n        \"DATABASE_URL\": \"postgres://postgres:postgres@localhost:5432/my_database\"\n      }\n    }\n  }\n}","lang":"javascript","description":"Add the MCP server to your client configuration (e.g., Claude Desktop or custom MCP client), pointing to your local Postgres."},"warnings":[{"fix":"Use a superuser for local development, or grant the necessary permissions manually.","message":"The DATABASE_URL user must have superuser or sufficient privileges to CREATE TABLE, CREATE FUNCTION, and CREATE TRIGGER on all tracked tables.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Manually drop triggers on tables you don't want to track, or configure tracked schemas in the tool call.","message":"The setup tool creates triggers on ALL tables in the connected database's public schema (and any tracked schemas). This may cause unexpected audit log growth on noisy tables.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Upgrade Postgres to 13+ or stay on 0.1.0 with an older trigger function and manual adjustment.","message":"This package requires PostgreSQL >=13 because it uses built-in immutable function `ABS` (since v13) in trigger function timestamp logic.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Test on your schema; file issues on GitHub if triggers fail silently.","message":"The initial release (0.1.0) may have instability in trigger creation on partitioned tables or tables with foreign key cascades.","severity":"deprecated","affected_versions":"==0.1.0"},{"fix":"After upgrading the MCP server, always re-run setup_activity_logging to get the latest trigger function.","message":"Running setup_activity_logging multiple times is safe (idempotent), but may re-create triggers with slightly different behavior after an upgrade — check the CHANGELOG before re-running.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.0':6 '13':67 '20':64 'activ':3,72,75 'agent':33,53 'ai':31 'api':89 'audit':44 'automat':14 'behavior':92 'chang':57,80,85,94 'code':32 'context':10 'current':61 'databas':25,39 'db':79,84 'delet':20 'expos':27 'four':69 'get':77 'insert':17 'introspect':40 'javascript':98 'let':52 'log':15,29,73 'manual':38 'may':93 'mcp':4,8,35 'minor':96 'model':9 'node':63 'oper':21 'postgr':2,66 'postgres-activity-mcp':1 'postgresql':24 'protocol':11 'queri':54 'recent':55,78,83 'refresh':74 'requir':62 'row':56 'server':12 'set':42 'setup':71 'ship':68 'sql':60 'stabl':88 'summar':82 'tabl':49 'tool':36,70 'track':48 'trigger':45,76,91 'unlik':37 'updat':18 'version':5,97 'via':34 'without':58 'write':59 'yet':87","created_at":"2026-06-05T17:00:48.365597+00:00","updated_at":"2026-06-05T17:00:48.365597+00:00","problems":[{"fix":"Grant CREATE on schema: GRANT CREATE ON SCHEMA public TO your_user;","cause":"DATABASE_URL user lacks CREATE TABLE permission.","error":"Error: permission denied to create \"db_activity_log\""},{"fix":"Check DATABASE_URL connection string and that the database is running.","cause":"The server could not connect to the database or the database does not exist.","error":"Cannot read properties of undefined (reading 'schemas')"},{"fix":"Run setup_activity_logging tool again to (re)create the function.","cause":"The trigger function was not created or was dropped.","error":"ERROR: function public.record_change() does not exist"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ianjaku/postgres-activity-mcp#readme","github":"ssh://git@github.com/ianjaku/postgres-activity-mcp","docs":null,"changelog":null,"pypi":null,"npm":"postgres-activity-mcp","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}