布卢米MCP连接器
一种模型上下文协议服务器,用于将AI助手连接到Bloom Growth的GraphQL API,使它们能够查询数据并对Bloom Growth平台执行操作。
可用工具 (4 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get_query_details 1 个参数 需填 1 项
Get detailed information about specific GraphQL queries. Retrieves argument requirements, return type information, descriptions, and example usage for the specified queries. Args: query_names: Comma-separated list of query names to get details for Returns: A YAML-formatted string containing detailed information about the requested queries
必填参数:query_names
get_mutation_details 1 个参数 需填 1 项
Get detailed information about specific GraphQL mutations. Retrieves argument requirements, return type information, descriptions, and example usage for the specified mutations. Args: mutation_names: Comma-separated list of mutation names to get details for Returns: A YAML-formatted string containing detailed information about the requested mutations
必填参数:mutation_names
execute_query 2 个参数 需填 1 项
Execute a GraphQL query or mutation with variables. Parses and executes the provided GraphQL operation string with optional variables. Args: query: Raw GraphQL query or mutation string variables: Optional dictionary of variables to use in the operation Returns: Dictionary containing the operation results or an error message string Raises: Exception: Handled internally, returns error message as string
必填参数:query
get_authenticated_user_id
Get the ID of the currently authenticated user. Uses a special mutation to retrieve the ID of the user associated with the current API token. Returns: User ID string if successful, None if user not found, or error message string Raises: Exception: Handled internally, returns error message as string
该工具无需必填参数,直接调用即可
服务介绍
Bloomy MCP
一个用于与Bloom Growth的GraphQL API交互的模型上下文协议(MCP)服务器。
概述
Bloomy MCP是一个连接到Bloom Growth的GraphQL API并通过模型上下文协议暴露该API的服务器,使AI助手能够针对Bloom Growth平台执行操作。
特性
- 通过MCP查询Bloom Growth GraphQL API
- 获取查询和变更详情
- 通过MCP工具执行GraphQL查询和变更
- 获取已认证用户信息
- 自动模式内省
安装
前提条件
- Python 3.12或更高版本
- 访问Bloom Growth API
- uv(推荐)或pip用于包管理
包管理
本项目推荐使用uv,这是一个快速的Python包安装器和解析器,可以作为pip/pip-tools的替代品。它比传统的包管理器快得多。
安装uv
curl -sSf https://astral.sh/uv/install.sh | sh
对于其他安装方法,请参阅uv文档。
设置
-
克隆此仓库
-
设置Python虚拟环境:
python -m venv .venv source .venv/bin/activate # 在Windows上: .venv\Scripts\activate -
以开发模式安装包:
使用pip:
pip install -e .使用uv(推荐):
uv pip install -e .对于开发依赖项:
uv pip install -e ".[dev]"
环境变量
创建一个包含以下变量的.env文件:
BLOOM_API_URL=<Your Bloom API URL>
BLOOM_API_TOKEN=<Your Bloom API Token>
使用
Cursor集成
要将此MCP服务器与Cursor(基于AI的IDE)一起使用:
-
转到Cursor > Cursor设置 > MCP
-
单击“添加新的MCP服务器”
-
使用以下详细信息配置服务器:
- 名称:“Bloom Growth”(或“BG”或您喜欢的任何名称)
- 类型:命令
- 命令:
uv run --project /path/to/your/repo/ --env-file /path/to/your/repo/.env bloomy-server
重要:请将
/path/to/your/repo/替换为您的bloomy-mcp仓库的实际路径(例如,/Users/username/workspace/bloomy-mcp/)。
运行服务器
启动Bloomy MCP服务器:
bloomy-server
开发模式检查
为了开发和调试目的,您可以使用MCP检查工具:
npx @modelcontextprotocol/inspector bloomy-server
这允许您在开发过程中检查MCP服务器的行为和响应。
推荐工具
为了获得最佳的开发工作流程:
- direnv:用于管理环境变量,并在进入项目目录时自动加载它们
- uv:用于快速可靠的包管理
设置direnv:
- 安装direnv(例如,在macOS上运行
brew install direnv) - 在您的项目根目录中创建一个
.envrc文件:export BLOOM_API_URL=your_api_url export BLOOM_API_TOKEN=your_api_token - 运行
direnv allow来授权环境变量
这种工具组合(direnv + uv)为密钥管理和包管理提供了高效的环境。
可用的 MCP 工具
以下 MCP 工具可供 AI 助手使用:
get_query_details- 获取特定 GraphQL 查询的详细信息get_mutation_details- 获取特定 GraphQL 变更的详细信息execute_query- 使用变量执行 GraphQL 查询或变更get_authenticated_user_id- 获取当前认证用户的 ID
可用的 MCP 资源
bloom://queries- 获取所有可用查询的列表bloom://mutations- 获取所有可用变更的列表
开发
项目结构
src/
└── bloomy_mcp/
├── __init__.py # Package initialization
├── client.py # GraphQL client implementation
├── formatters.py # Data formatting utilities
├── introspection.py # GraphQL schema introspection
├── operations.py # GraphQL operation utilities
└── server.py # MCP server implementation
依赖项
mcp[cli]- Model Context Protocol 服务器gql- GraphQL 客户端库httpx- HTTP 客户端pyyaml- YAML 处理库