Berghain Events MCP Server
ベルグハインイベントAPIとMCP実装
プロジェクト構造
berghain-api/
├── app/ # Aplicación principal FastAPI
│ ├── api/ # Rutas de la API
│ ├── core/ # Configuración y componentes centrales
│ ├── db/ # Capa de acceso a datos (DynamoDB)
│ └── main.py # Punto de entrada de la aplicación y FastMCP server
├── scripts/ # Scripts para creación de tabla y carga de datos en DynamoDB
│ ├── create_table.py
│ └── load_data.py
├── events/ # Directorio para los JSON extraídos de Firecrawl
├── Dockerfile # Dockerfile para despliegue
├── requirements.txt # Dependencias del proyecto (para uv)
└── README.md # Este archivoRelated MCP server: DynamoDB Read-Only MCP
要件
Python 3.10以上
uv (依存関係管理と仮想環境用)
AWS アカウント (DynamoDB および App Runner 用)
Firecrawl APIキー
施設
このリポジトリをクローンします:
git clone <repository-url> cd berghain-apiuvを使用して仮想環境を作成し、アクティブ化します。uv venv source .venv/bin/activate # En Linux/macOS # .venv\\Scripts\\activate # En Windowsuvを使用して依存関係をインストールします。uv pip install -r requirements.txt
詳細なプロセス
1. Firecrawlによるデータ抽出
Firecrawl MCP をカーソルに設定します。Firecrawl API キーがあることを確認します。カーソル MCP 構成で、以下を追加します。
"firecrawl-mcp": { "command": "npx", "args": [ "-y", "firecrawl-mcp" ], "env": { "FIRECRAWL_API_KEY": "fc-YOUR_FIRECRAWL_API_KEY" } }抽出を実行します。Cursorのエージェント (または同様のツール) を使用して、Firecrawl MCP を呼び出し、
https://www.berghain.berlin/en/program/からイベントを抽出するように要求します。**データを保存する:**抽出されたデータは、
events/ディレクトリに JSON ファイルとして保存する必要があります。たとえば、events/berghain_events_YYYY-MM-DD.json。
2. DynamoDBへのデータのロード
DynamoDB にテーブルを作成します。scripts
scripts/create_table.pyスクリプトがこれを処理します。実行します(必要に応じてパラメータを調整します)。uv run python scripts/create_table.py --table berghain_events --region tu-region-aws # Para desarrollo local con DynamoDB Local (ej. docker run -p 8000:8000 amazon/dynamodb-local): # uv run python scripts/create_table.py --table berghain_events --region localhost --endpoint-url http://localhost:8000テーブルにデータをロードします。scripts
scripts/load_data.pyスクリプトは、JSON ファイルからイベントをロードします。uv run python scripts/load_data.py --table berghain_events --region tu-region-aws --path events # Para desarrollo local: # uv run python scripts/load_data.py --table berghain_events --region localhost --endpoint-url http://localhost:8000 --path events引数として渡さない場合は
app/core/config.py(load_data.pyによってインポート) に必要な構成があることを確認してください。
3. FastAPIとMCPサーバーを使用したAPI
API ロジックは
app/ディレクトリにあり、エンドポイントが定義されています (例:app/api/endpoints/events.py)。app/main.pyファイルは、FastAPI アプリケーションと FastMCP サーバーを起動するように構成され、API エンドポイントを AI モデルのツールとして公開します。app/main.pyのcustom_mapsをチェックして、 GET ルートがRouteType.TOOLにどのようにマップされるかを確認します。
AWS へのデプロイメント
に。 Dockerfile
uvを使用し、 app/main.pyを実行するようにDockerfileが正しく構成されていることを確認します。
b.イメージをビルドして Amazon ECR (Elastic Container Registry) にアップロードする
ECR を使用して Docker を認証します。
aws ecr get-login-password --region tu-region-aws | docker login --username AWS --password-stdin tu-aws-account-id.dkr.ecr.tu-region-aws.amazonaws.comECR にリポジトリを作成します (存在しない場合)。
aws ecr create-repository --repository-name berghain-mcp-api --region tu-region-awsDocker イメージをビルドします。
docker build -t berghain-mcp-api .画像にタグを付けます:
docker tag berghain-mcp-api:latest tu-aws-account-id.dkr.ecr.tu-region-aws.amazonaws.com/berghain-mcp-api:latest画像を ECR にアップロードします。
docker push tu-aws-account-id.dkr.ecr.tu-region-aws.amazonaws.com/berghain-mcp-api:latesttu-region-awsとtu-aws-account-id実際の値に置き換えます。
紀元前Terraform でインフラストラクチャをデプロイする
Terraform ファイルを準備します。Terraform構成ファイル (例:
main.tf、variables.tf、outputs.tf) がディレクトリ (例:terraform/) にあることを確認します。これらのファイルでは、ECR イメージが使用する AWS App Runner サービスや DynamoDB テーブル (Terraform でも管理されている場合) などの必要な AWS リソースを定義する必要があります。 Terraform の App Runner 構成では、ECR にアップロードされたイメージを参照する必要があります。Terraform ディレクトリに移動します。
cd terraformTerraform を初期化します。
terraform initTerraform 構成を適用します。
terraform apply計画を確認し、申請を確定します。 Terraform がリソースをプロビジョニングします。
**サービス URL を取得します。**適用すると、Terraform によって、App Runner サービス URL を含む定義済みの出力が表示されます。この URL (例:
https://<id-servicio>.<region>.awsapprunner.com) をメモします。
展開したソリューションをテストする
に。ローカルテストスクリプトを調整する ( mcp_local.py )
mcp_local.pyファイルをプロジェクトのルートに設定します。
重要: mcp_local.pyのmcp_server_url変数を、Terraform 出力から取得した URL に更新します。
b.テストを実行
プロジェクトのルート (またはmcp_local.py保存した場所) から:
uv run python mcp_local.pyこれにより、PydanticAI エージェントが実行され、デプロイされた MCP に接続してクエリを実行しようとします。
ライセンス
マサチューセッツ工科大学
Related MCP Connectors
MCP server for the Z1N Protocol - on-chain identity for AI agents on Polygon
past.dev is a long-term memory API for AI agents. Send it timestamped text such as emails, meeting transcripts and support tickets. Ask a question and get the current fact, the value it replaced and the source behind it. With this server, your assistant can recall and save memory and manage your past.dev account.
Xata MCP server lets AI agents interact with your Xata projects, and Postgres database branches.
Hosted persistent memory with semantic search, importance and TTL for AI agents.
Related MCP Servers
- FlicenseBqualityDmaintenanceThis server integrates with the Ticketmaster API to provide AI agents with real-time concert and event data, enabling dynamic fetching and formatting for ease of interpretation.12-
- AlicenseBqualityDmaintenanceA server that enables LLMs like Claude to query AWS DynamoDB databases through natural language requests, supporting table management, data querying, and schema analysis.745 npm2MIT
- FlicenseAqualityDmaintenanceAn MCP server that gives LLM agents full access to Amazon DynamoDB, supporting table management, querying, scanning, and item CRUD operations.11-
- AlicenseNot gradedqualityDmaintenanceMCP server that exposes aggregated Shotgun event sales, net revenue, ticket quotas, and audience stats to AI assistants via natural language queries.MIT