@adamhancock/postgres-claude-mcp-wrapper
v1.0.0
Published
A simple CLI tool to configure PostgreSQL Model Context Protocol (MCP) server for Claude Desktop using environment variables.
Downloads
63
Readme
Postgres Claude MCP Wrapper
A simple CLI tool to configure PostgreSQL Model Context Protocol (MCP) server for Claude Desktop using environment variables.
Installation
# Install globally
npm install -g @adamhancock/postgres-claude-mcp-wrapper
# Or use with npx
npx @adamhancock/postgres-claude-mcp-wrapper
# Or install locally
pnpm add @adamhancock/postgres-claude-mcp-wrapperSetup
- Create a
.envfile in your project root:
cp .env.example .env- Edit
.envwith your PostgreSQL connection string:
DATABASE_URL=postgresql://username:password@host:port/databaseUsage
Using the CLI command (if installed)
postgres-mcp-setupUsing npm scripts
pnpm run setupUsing tsx directly
tsx setup-mcp.tsWhat it does
This tool automatically configures the Claude Desktop app to connect to your PostgreSQL database by:
- Reading your
DATABASE_URLfrom the.envfile - Running
claude mcp add-jsonwith the proper configuration - Setting up the MCP server to use
@modelcontextprotocol/server-postgres
Environment Variables
DATABASE_URL- PostgreSQL connection string (required)
Example
# With a local PostgreSQL database
DATABASE_URL=postgresql://dev_user:[email protected]:5432/my_database
# With a remote database
DATABASE_URL=postgresql://user:[email protected]:5432/production_dbSecurity
The tool masks passwords when displaying connection information in the console output for security.
Requirements
- Node.js 18+
- Claude Code
- PostgreSQL database accessible from your machine
License
ISC
