Brand MCP Server
GBL用MCP
ブランド固有のPostgresデータベースにアクセスするための、安全なマルチテナント型Model Context Protocol (MCP) サーバーです。このサーバーは、ローカル実行とHTTP/SSE経由の認証済みリモートアクセスの両方をサポートしています。
🔐 認証とセキュリティ
このサーバーはベアラートークン認証を使用します。/sse および /messages エンドポイントへのアクセスには、gbl- プレフィックスが付いた有効なAPIキーが必要です。
キー管理CLI
組み込みの認証モジュールを使用して、ローカルまたはEC2上でキーを管理します:
# Activate your environment first
source .venv/bin/activate # Linux/EC2
.\.venv\Scripts\activate # Windows
### 6. Manage Multi-Tenant API Keys (Admin API)
To provision unique database tenants to separate keys, we host an internal Admin REST API.
This API handles secrets, so it should **only** be accessed from localhost on your EC2 instance (binds to `:8001`).
### Option A: Use it securely locally via SSH Tunneling (Recommended)
You can build a secure tunnel from your Windows PC directly to your EC2 instance so you can interact with the Admin API from your own local browser (like Swagger UI) or local terminal smoothly:
```powershell
# Run this on your local Windows PC
ssh -i "path/to/your/key.pem" -L 8001:127.0.0.1:8001 ubuntu@YOUR_EC2_IPこれで、ローカルマシンから直接APIを操作したり、Swagger UIを表示したりできます: http://127.0.0.1:8001/docs
オプションB:EC2上で直接使用する
EC2でAdmin APIを起動するには:
python3 -m src.admin_apiAdmin APIが実行されている状態で、別のEC2ターミナルウィンドウから新しいブランドテナントキーを作成できます:
curl -X POST http://127.0.0.1:8001/keys/generate \
-H "Content-Type: application/json" \
-d '{"db_user": "brand_a_user", "db_pass": "supersecret"}'(レスポンスには brand_a_user に割り当てられた api_key が含まれます。)
その他のユーティリティエンドポイント:
テナント一覧:
curl http://127.0.0.1:8001/keysテナントの取り消し:
curl -X DELETE http://127.0.0.1:8001/keys/brand_a_user
Related MCP server: PostgreSQL MCP Server for Claude Desktop
🖥️ EC2デプロイメント (systemdによる永続化)
本番環境では、サーバーが再起動時に自動的に開始され、クラッシュした場合に再起動するように systemd を使用します。
1. プロジェクトのセットアップ
git clone https://github.com/intern-analytics/MCPforGBL.git
cd MCPforGBL
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt2. 設定
データベース認証情報用の .env ファイルを作成します(gitignored):
nano .env
# Add DB_USER, DB_PASS, DB_HOST, etc.3. システムサービスの作成
サービスファイルを作成します:
sudo nano /etc/systemd/system/mcp-server.service以下を貼り付けます(必要に応じてパスを調整してください):
[Unit]
Description=Brand MCP FastAPI Server
After=network.target
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/projects/MCPforGBL
ExecStart=/home/ubuntu/projects/MCPforGBL/.venv/bin/python -m src.server2
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target4. 有効化と開始
sudo systemctl daemon-reload
sudo systemctl enable mcp-server
sudo systemctl start mcp-server
sudo systemctl status mcp-server🤖 Claudeへの接続
オプションA:Claude.ai (Webアプリ) を使用する
このサーバーはNginx経由で公開され、Let's EncryptのHTTPS証明書で保護されているため、ブラウザから直接接続できます。
Claude.aiの設定 -> Developer / Connectors に移動します。
Add custom connector をクリックします。
セキュアなURLを貼り付けます:
https://mcpforgbl.duckdns.org/sse?token=gbl-YOUR_KEY_HERE接続してクエリを実行します!
オプションB:Claude Desktopアプリ (HTTPS) を使用する
Windows上の %APPDATA%\Claude\claude_desktop_config.json を更新します。
[!IMPORTANT] Windowsのファイルパス内のスペースによる問題を回避するため、
C:\\PROGRA~1\\nodejs\\npx.cmdを使用してください。
{
"mcpServers": {
"gbl-data-lake": {
"command": "C:\\PROGRA~1\\nodejs\\npx.cmd",
"args": [
"-y",
"mcp-remote",
"https://mcpforgbl.duckdns.org/sse?token=gbl-YOUR_KEY_HERE"
]
}
}
}オプションC:Claude Desktopアプリ (HTTP IPアドレスとBearerヘッダー) を使用する
DuckDNS URLを使用せずにEC2インスタンスのIPに直接接続したい場合、またはURLパラメータではなくヘッダーとしてトークンを渡したい場合は、この設定を使用してください:
{
"mcpServers": {
"gbl-data-lake": {
"command": "C:\\PROGRA~1\\nodejs\\npx.cmd",
"args": [
"-y",
"mcp-remote",
"http://YOUR-EC2-PUBLIC-IP:8000/sse",
"--allow-http",
"--header",
"Authorization: Bearer gbl-YOUR_KEY_HERE"
]
}
}
}📈 スケーラビリティロードマップ
当社のプラットフォームは、堅牢なロールベースのアクセス制御システムを通じて、安全かつ効率的に拡張できるように設計されています。
ユーザー管理を拡張するために、ユーザー/テナントごとに個別の専用APIキーを生成する予定です。当社のアーキテクチャでは、APIキーは単なる認証トークン以上の役割を果たし、ユーザーの完全な権限プロファイルを本質的に定義します。キー自体が、ユーザーがどの程度のアクセス権を持っているかをサーバーに正確に伝えます。
このアプローチにより、アクセス制限付きアカウントとカスタマイズされたスキルファイルに基づいて、データベースのやり取りとツールの可用性を厳密に強制し、各ユーザーが明示的に許可されたデータと機能のみを操作できるようにします。
🛠️ 開発
ローカルサーバー:
python -m src.server(標準stdio)SSEサーバー:
python -m src.server2(FastAPI経由のHTTP/SSE)認証ユーティリティ:
src/auth.pyデータベースロジック:
src/db.py
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
- AlicenseNot gradedqualityDmaintenanceEnables interaction with PostgreSQL databases through a production-ready MCP server with global connection pooling, automatic AWS password rotation, and comprehensive SQL operations. Supports multiple concurrent Claude sessions while maintaining efficient connection limits to the database.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to interact with PostgreSQL databases through natural language for schema exploration, data analysis, and query execution. Users can search schemas, describe tables, and perform read or write operations without needing to write manual SQL.
- AlicenseNot gradedqualityCmaintenanceA production-ready MCP server for PostgreSQL — built for Claude Desktop, Claude Code, and any MCP-compatible AI agent.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables Claude Desktop to connect to PostgreSQL databases, allowing users to query, explore schemas, and analyze data using plain English without writing SQL.
Related MCP Connectors
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
MCP server for managing Prisma Postgres.
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/intern-analytics/MCPforGBL'
If you have feedback or need assistance with the MCP directory API, please join our Discord server