PostgreSQL MCP Server
PostgreSQL MCPサーバー
ローカルのPostgreSQLデータベースに接続し、AIアシスタントがデータベースをクエリおよび管理できるようにするMCP(Model Context Protocol)サーバーです。
提供されるツール
ツール | 説明 |
query | 読み取り専用SQL(SELECT, SHOW, EXPLAIN)を実行 |
execute | 書き込みSQL(INSERT, UPDATE, DELETE, CREATE, ALTER, DROP)を実行 |
list_tables | スキーマ内のすべてのテーブルを一覧表示 |
describe_table | テーブルの列、型、キー、インデックスを表示 |
list_schemas | データベース内のすべてのユーザースキーマを一覧表示 |
Related MCP server: PostgreSQL MCP Server
リソース
schema-overview (
postgres://schema/overview) — Markdown形式のデータベーススキーマ概要
ヘッダーによる動的接続
このサーバーは動的なPostgreSQL接続をサポートしています。初期SSE接続リクエストのHTTPヘッダーを介してデータベース認証情報を提供できます。これにより、デプロイされた単一のサーバーインスタンスで複数の異なるデータベースを扱うことが可能になります。
サポートされているヘッダー
ヘッダー | 説明 | デフォルト |
| PostgreSQLホスト |
|
| PostgreSQLポート |
|
| PostgreSQLユーザー |
|
| PostgreSQLパスワード |
|
| PostgreSQLデータベース |
|
| SSLの使用 ( |
|
| CA証明書 |
|
Antigravity / Cursor (VS Code) での設定
このサーバーを Antigravity または Cursor で使用するには、mcp_config.json(通常は %APPDATA%\antigravity\ またはIDEのMCP設定内にあります)に以下を追加してください:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"mcp-remote",
"https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
"--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
"--header", "x-pg-port: 26768",
"--header", "x-pg-user: avnadmin",
"--header", "x-pg-password: YOUR_PASSWORD",
"--header", "x-pg-database: defaultdb",
"--header", "x-pg-ssl: true"
]
}
}
}Claude Code CLI での設定
Claude Code CLI を使用している場合は、以下のコマンドを使用してこのサーバーを追加できます:
1. Claude Codeのインストール(未インストールの場合)
npm install -g @anthropic-ai/claude-code2. PostgreSQL MCPサーバーの追加
ターミナルで以下のコマンドを実行してください:
claude mcp add postgres -- npx mcp-remote https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse \
--header "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com" \
--header "x-pg-port: 26768" \
--header "x-pg-user: avnadmin" \
--header "x-pg-password: YOUR_PASSWORD" \
--header "x-pg-database: defaultdb" \
--header "x-pg-ssl: true"Claude Desktop での設定
claude_desktop_config.json に以下を追加してください:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"mcp-remote",
"https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
"--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
"--header", "x-pg-port: 26768",
"--header", "x-pg-user: avnadmin",
"--header", "x-pg-password: YOUR_PASSWORD",
"--header", "x-pg-database: defaultdb",
"--header", "x-pg-ssl: true"
]
}
}
}ローカルセットアップ(開発用)
1. 依存関係のインストール
npm install2. デフォルトデータベースの設定(オプション)
ローカル開発用に .env ファイルを引き続き使用できます:
PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your_password_here
PG_DATABASE=your_database_name3. ビルドと実行
npm run build
npm start使用例
設定が完了すると、AIアシスタントに以下のような質問ができます:
"データベース内のすべてのテーブルをリストして"
"usersテーブルについて説明して"
"SELECT * FROM orders WHERE created_at > '2025-01-01'"
"productsという名前の新しいテーブルを作成して"
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude to interact with a local PostgreSQL database through SQL queries, schema inspection, and CRUD operations.8225MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with PostgreSQL databases through natural language queries, schema inspection, and safe SQL execution.91
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query and explore PostgreSQL databases with tools for executing SQL queries, listing tables, and describing table structures.MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI models to execute SQL queries, list tables, and describe table structures on a local PostgreSQL database.2
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Comprehensive PostgreSQL documentation and best practices, including ecosystem tools
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/aeiyannn/postgree-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server