斯特拉布里奇mcp
模型上下文协议(MCP) 服务器 星桥 API:驱动器(VFS)、文件传输、上传请求、项目和审核日志。内置于 FastMCP 以及Python 3.13+。
需求
- python 3.13+
- 紫外线 (推荐)或另一个PEP 517安装程序
安装```bash
uv sync
使用开发依赖项(测试、linters)进行安装:```bash
uv sync --group dev
配置
所有设置都使用前缀 STELLARBRIDGE_ (参见 src/stellarbridge_mcp/config.py).
变量 · 目的
STELLARBRIDGE_API_URL 关于Stellarbridge API 基础URL (没有 /api/v1 后缀)。违约: http://localhost:8080
STELLARBRIDGE_API_KEY · API密钥作为发送 X-API-Key 根据请求(不是 Authorization: Bearer)
STELLARBRIDGE_JWT_TOKEN · 可选;如果已设置,则跳过身份验证交换
STELLARBRIDGE_HTTP_TIMEOUT · HTTP超时(秒)(默认值: 30)
运行服务器
已安装的脚本(stdio,默认):```bash
uv run stellarbridge-mcp
**模块形式:**```bash
uv run python -m stellarbridge_mcp
服务器通过MCP进行通话 标准 除非您将FastMCP配置为其他传输。
示例:通过stdio的MCP客户端```json
{
"mcpServers": {
"stellarbridge": {
"command": "uv",
"args": ["run", "python", "-m", "stellarbridge_mcp"],
"cwd": "/path/to/stllr-mcp",
"env": {
"STELLARBRIDGE_API_URL": "https://your-api-host.example.com",
"STELLARBRIDGE_API_KEY": "your-api-key"
}
}
}
}
调整 `cwd` 复制到此存储库(或使用全局安装并省略 `cwd` 如果 `stellarbridge-mcp` 正在打开 `PATH`).
## 工具表面
在根服务器上安装工具时,工具是按命名空间排列的,例如:
- **`drive_*`** --列出/获取/创建/移动驱动器对象、上传/下载URL、共享、策略
- **`transfers_*`** --传输,多部分上传助手
- **`requests_*`** --文件上传请求
- **`projects_*`** --项目
- **`audit_*`** --审核日志查询
使用您的MCP客户端 **工具/列表** 查看构建的确切名称和模式。
### 传输ID(`tid`)
几个工具需要一个 **转移ID** (UUID字符串)。如果你还没有
(在env、args或客户端状态中),调用 **`transfers_list_transfers`** 第一:
JSON数组包括 **`tid`** 在每一行。使用该值
`transfers_get_transfer`, `transfers_share_transfer`, `transfers_add_transfer_to_drive`,
或相关流程。
对于 **实时pytest** env变量,set `STELLARBRIDGE_TEST_TRANSFER_ID` 到一个 `tid` 从
那个列表(或运行 `task live-first-transfer-id`,它调用相同的MCP列表
路径)。更倾向于使用原始HTTP:通过REST列出可以绕过您所在的MCP堆栈
验证。
### 驱动器文件上传
上传使用 **预签名URL** (字节通过HTTP PUT进入对象存储,而不是Stellarbridge JSON API):
- **手动链条:** `drive_create_drive_file_placeholder` → `drive_get_drive_upload_url` → **HTTP输入** 响应中URL的文件正文→ `drive_complete_drive_upload` (桶、来自PUT响应的ETag, `size_bytes`).
- **快捷方式:** 如果文件存在于 **MCP服务器** 文件系统,调用 `drive_upload_drive_file_from_path` 在FILE占位符上,以便服务器为您运行GET URL、PUT和complete。
## 发展
|任务|命令|
|------|---------|
|运行单元测试| `uv run pytest` (在没有选择加入环境的情况下跳过集成实时测试)|
|模拟MCP集成测试| `uv run pytest tests/integration -v` 或 `task test-integration` |
|现场API烟雾测试|参见 测试/README.md (`STELLARBRIDGE_LIVE_API=1`,真实URL+密钥)|
|Lint| `uv run ruff check` |
|类型检查| `uv run mypy src` |
**任务** 快捷方式(需要 任务): `task build`, `task run`, `task test-integration`, `task test-integration-live`, `task live-first-transfer-id` (stdio MCP:打印实时测试环境的传输id), `task inspector`.
完整的测试文档: **测试/README.md**.
## 项目布局```
src/stellarbridge_mcp/ # Package: server, HTTP client, tools by domain
tests/ # Unit + integration tests (see tests/README.md)
