CloudNativePG MCP Server
CloudNativePG MCPサーバー
CloudNativePGオペレーターを通じてPostgreSQLクラスターを管理するためのMCPサーバーです。
このバージョンでは、サーバーレイアウト、認証、コンテナビルド、Helmチャート、プロンプトレジストリ、およびテストハーネスにMCP Baseスキャフォールドを使用しています。以前の手動実装は、参照用に deprecated-v1/ 配下に保持されています。
ツールインターフェース
このサーバーは、v1実装からのCloudNativePGツールを公開します:
list_postgres_clustersget_cluster_statuscreate_postgres_clusterscale_postgres_clusterdelete_postgres_clusterlist_postgres_rolescreate_postgres_roleupdate_postgres_roledelete_postgres_rolelist_postgres_databasescreate_postgres_databasedelete_postgres_database
また、プロンプト管理用のMCP Baseスキャフォールド管理ツールも含まれています:
admin_reload_promptsadmin_get_prompt_manifest
Related MCP server: PostgreSQL MCP Server
レイアウト
src/cnpg_mcp_server.py: 本番用FastMCP HTTPエントリーポイントsrc/cnpg_mcp_test_server.py: 認証なし/OIDCテスト用エントリーポイントsrc/cnpg_mcp_tools.py: CloudNativePGツールの実装と登録src/mcp_context.py: ユーザーID抽出機能付きMCPコンテキストラッパーsrc/auth_*.py: MCP Baseスキャフォールド認証サポートchart/: Helmデプロイメントアセットtest/: MCPプラグインテストハーネスSCAFFOLD_INVENTORY.md: MCP Baseスキャフォールドアーティファクトハッシュ
開発
環境を作成し、依存関係をインストールします:
python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt -r test/requirements.txtスキャフォールド登録のスモークテストを実行します:
python bin/smoke_test.pyローカルの認証なしMCPテストスイートを実行します:
python test/run-local-tests.pydeprecated-v1/test/plugins から適応させたCloudNativePG Kubernetes統合テストを実行します:
python test/run-local-tests.py --include-integration
# or
make test-integrationこれらのテストは、実際のCloudNativePGリソースを作成、スケーリング、更新、削除します。便利なオプション設定:
CNPG_MCP_TEST_NAMESPACE: テストリソース用の名前空間CNPG_MCP_TEST_CLUSTER_PREFIX: 生成されるクラスター名のプレフィックスCNPG_MCP_TEST_STORAGE_SIZE: インスタンスごとのストレージサイズ、デフォルトは1GiCNPG_MCP_TEST_CREATE_WAIT_SECONDS: クラスター準備完了タイムアウト、デフォルトは300CNPG_MCP_TEST_SCALE_WAIT_SECONDS: スケール準備完了タイムアウト、デフォルトは300
ローカルでの実行
スキャフォールドエントリーポイントはHTTPトランスポートを使用します:
python src/cnpg_mcp_server.py --host 0.0.0.0 --port 4200テストサーバーは認証なしで実行できます:
python src/cnpg_mcp_test_server.py --host 127.0.0.1 --port 4201 --no-authKubernetesアクセス
ツールはKubernetes Pythonクライアントを使用します。設定は以下の順序で読み込まれます:
クラスター内サービスアカウント設定
~/.kube/configまたはKUBECONFIGからのローカルkubeconfig
ほとんどのツールはオプションの namespace を受け付けます。省略された場合は、現在のKubernetesコンテキストの名前空間が使用され、フォールバックとして default が使用されます。
クラスター内Helmデプロイメントの場合、サーバーはデプロイメントサービスアカウントを使用します。デフォルトでは、チャートはそのサービスアカウントに対してHelmリリース名前空間内でのみCNPGおよびシークレットの権限を付与します。別の名前空間でCNPGリソースを管理するには、ツールの namespace 引数を渡し、その名前空間でサービスアカウントにアクセス権を付与してください:
rbac:
targetNamespaces:
- application-databases任意の名前空間で動作する必要がある共有MCPデプロイメントの場合は、クラスター全体のRBACを選択します:
rbac:
clusterWide: trueクラスター全体モードでは名前空間をまたいでシークレットへのアクセスが許可されるため、ターゲットセットがわかっている場合は明示的な targetNamespaces を優先してください。
デプロイメント
MCP BaseスキャフォールドにはDockerおよびHelmアセットが含まれています:
make build
make push
make helm-installデプロイメントターゲットを使用する前に、python bin/configure-make.py を使用してイメージおよび名前空間設定用の make.env を生成してください。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Provides capabilities that let LLM agents perform a range of infrastructure management tasks.
Your Supabase account in natural language: run SQL, apply migrations, manage tables, storage, edge f
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact deeply with PostgreSQL databases—query data, manage schema, analyze performance, and administer the database.153 npm6MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with PostgreSQL databases through natural language queries, schema inspection, and safe SQL execution.5 npm1ISC
- FlicenseNot gradedqualityDmaintenanceExposes Kubernetes cluster management tools to LLMs, enabling querying pods, deployments, logs, metrics, and managing port forwards via natural language.1-
- AlicenseAqualityDmaintenanceEnables AI agents to analyze, optimize, and safely interact with PostgreSQL databases, including health checks, index recommendations, query planning, and SQL execution with read-only and production protection modes.15MIT