Skip to main content
Glama

Berghain Events MCP Server

by alejofig
  • Linux
  • Apple

Berghain 活动 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 archivo

要求

  • Python 3.10+
  • uv(用于依赖管理和虚拟环境)
  • AWS 账户(用于 DynamoDB 和 App Runner)
  • Firecrawl API 密钥

设施

  1. 克隆此存储库:
    git clone <repository-url> cd berghain-api
  2. 使用uv创建并激活虚拟环境:
    uv venv source .venv/bin/activate # En Linux/macOS # .venv\\Scripts\\activate # En Windows
  3. 使用uv安装依赖项:
    uv pip install -r requirements.txt

详细流程

1. 使用 Firecrawl 提取数据

  • **将 Firecrawl MCP 设置为 Cursor:**确保您拥有 Firecrawl API 密钥。在 Cursor MCPs 配置中,添加:
    "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/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/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

确保您的Dockerfile已正确配置以使用uv并运行app/main.py

b.构建并上传图像至 Amazon ECR(弹性容器注册表)

  1. 使用 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.com
  2. 在 ECR 中创建一个存储库(如果不存在):
    aws ecr create-repository --repository-name berghain-mcp-api --region tu-region-aws
  3. 构建你的 Docker 镜像:
    docker build -t berghain-mcp-api .
  4. 标记您的图像:
    docker tag berghain-mcp-api:latest tu-aws-account-id.dkr.ecr.tu-region-aws.amazonaws.com/berghain-mcp-api:latest
  5. 将图像上传到 ECR:
    docker push tu-aws-account-id.dkr.ecr.tu-region-aws.amazonaws.com/berghain-mcp-api:latest
    tu-region-awstu-aws-account-id替换为您的值。

c.使用 Terraform 部署基础设施

  1. **准备您的 Terraform 文件:**确保您的 Terraform 配置文件(例如main.tfvariables.tfoutputs.tf )位于目录(例如terraform/ )中。这些文件应该定义必要的 AWS 资源,例如 ECR 映像将使用的 AWS App Runner 服务,以及 DynamoDB 表(如果 Terraform 也管理它)。 Terraform 中的 App Runner 配置将需要引用上传到 ECR 的图像。
  2. 导航到 Terraform 目录:
    cd terraform
  3. 初始化 Terraform:
    terraform init
  4. 应用 Terraform 配置:
    terraform apply
    审查计划并确认申请。 Terraform 将提供资源。
  5. **获取服务 URL:**一旦应用,Terraform 应该显示定义的输出,包括 App Runner 服务 URL。记下此 URL(例如https://<id-servicio>.<region>.awsapprunner.com )。

测试已部署的解决方案

到。调整本地测试脚本( mcp_local.py

mcp_local.py文件设置为项目的根目录

**重要提示:**使用您从 Terraform 输出中获得的 URL 更新mcp_local.py中的mcp_server_url变量。

b.运行测试

从项目的根目录(或保存mcp_local.py任何位置):

uv run python mcp_local.py

这将运行 PydanticAI 代理,它将尝试连接到您部署的 MCP 并执行查询。

执照

麻省理工学院

Related MCP Servers

  • A
    security
    F
    license
    A
    quality
    This 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.
    Last updated -
    1
    Python
  • A
    security
    A
    license
    A
    quality
    An unofficial server that allows AI assistants to access Fathom Analytics data, enabling users to retrieve account information, site statistics, events, aggregated reports, and real-time visitor tracking.
    Last updated -
    5
    20
    2
    TypeScript
    MIT License
  • A
    security
    A
    license
    A
    quality
    This server provides tools for AI assistants to interact with the Eventbrite API, allowing users to search for events, get event details, retrieve venue information, and list event categories.
    Last updated -
    4
    2
    2
    JavaScript
    MIT License
    • Apple
  • -
    security
    A
    license
    -
    quality
    A Server-Sent Events implementation using FastAPI framework that integrates Model Context Protocol (MCP), allowing AI models to access external tools and data sources like weather information.
    Last updated -
    9
    Python
    MIT License

View all related MCP servers

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/alejofig/mcp-berghain'

If you have feedback or need assistance with the MCP directory API, please join our Discord server