ReOrc MCP客户端
ReOrc模型创建平台(MCP)的客户端。
安装
先决条件
在安装ReOrc MCP客户端之前,请确保您拥有以下内容:
- 光标IDE -从下载并安装 cursor.sh
- Python 3.12 -下载自 python.org 或通过系统软件包管理器安装
- ReOrc工作室帐户 -确保您有权以适当的权限访问ReOrc Studio
安装步骤
1.克隆存储库
1.a Gitlab
git clone https://gitlab.tool.reorc.cloud/recurve/reorc-mcp-client.git && cd reorc-mcp-client1.b Github
git clone https://github.com/reorc/reorc-mcp-client.git && cd reorc-mcp-client2.安装依赖项
# Install required Python packages
pip install -r requirements.txt该工具需要:
requests>=2.28.0-用于API通信PyYAML>=6.0-用于YAML处理
3.配置ReOrc Studio MCP设置
- 打开 ReOrc工作室 在浏览器中
- 点击用户图标(左下角)
- 导航至 个人资料 → ReOrc MCP设置
- 复制 MCP访问代码 (JSON格式)来自此页面
4.配置游标MCP集成
- 打开 光标IDE
- 首选 设置 (Cmd/Ctrl+逗号)
- 导航至 光标设置 → 工具和集成 → MCP工具
- 点击 新建MCP服务器,这将打开一个JSON文件
- 粘贴上述步骤3中的JSON代码,并保存
- 光标可以通知新MCP的注册,并要求启用(在左下角)
5.验证安装
通过运行以下命令测试您的安装:
# Validate your authentication
python cli.py auth validate
# If validation fails, login to get a new token
python cli.py auth login配置文件
MCP配置存储在 .cursor/mcp.json:
{
"mcpServers": {
"reorc-mcp": {
"transport": "sse",
"url": "https://mcp.test.reorc.cloud/mcp?access_token={YOUR_ACCESS_TOKEN}",
"auth": {
"defaultCredentials": {
"email": "{YOUR_REORC_ACCOUNT}",
"password": "{YOUR_REORC_PASSWORD}",
"tenant_domain": "{TENANT_DOMAIN}"
}
}
}
}
}故障排除
如果您遇到问题:
- 身份验证问题:运行
python cli.py auth validate检查您的令牌 - 缺少的依赖:确保所有软件包都已安装
pip install -r requirements.txt - Python 版本:验证您使用的是Python 3.11+
python --version - 光标集成:尝试在游标设置中刷新MCP服务器
入门指南
完成安装后,您可以直接在Cursor IDE中开始使用ReOrc MCP客户端。以下是一个快速指南,助您快速上手:
快速启动命令
打开Cursor IDE,使用聊天界面与ReOrc MCP交互。您可以让Cursor执行以下操作:
1.列出可用项目
List all my ReOrc projects2.在本地下载项目
Download project "my_project_code" locally3.创建数据模型
Create a new staging model called "stg_customers" for project "my_project_code" that selects all customers from the raw customers table4.预览数据模型
Preview the data from model "stg_customers" in project "my_project_code"5.构建数据模型
Build model "stg_customers" in project "my_project_code"工作流示例
- 在Cursor中开始对话:打开Cursor的聊天室,要求列出您的项目
- 下载项目:让Cursor下载您要处理的项目
- 创建模型:描述你想创建什么样的数据模型
- 预览和迭代:在构建之前预览模型以查看数据
- 构建和部署:构建模型,使其在数据仓库中可用
视频教程
有关通过Cursor使用ReOrc构建数据基础的全面演练,请观看我们的教程视频: 📺 通过Cursor使用ReOrc构建数据基础
成功秘诀
- 具有描述性:当要求Cursor创建模型时,请清楚地描述您的业务逻辑
- 使用自然语言:你不需要知道SQL——用简单的英语描述你想要什么
- 本地迭代:在同步到服务器之前,使用本地优先的方法进行更改和测试
- 先预览:在构建模型之前,始终预览模型,以便及早发现问题
概述
ReOrc MCP客户端是一个客户端应用程序,它与ReOrc Studio服务器交互,同时使用户能够完全控制其本地环境中的模型创作、计划验证和质量保证。
地方优先发展模式
此客户端实现了本地优先的模型开发方法,允许用户:
- 在本地创建和修改模型 在与服务器同步之前
- 使用Git跟踪更改 为了更好的版本控制和协作
- 预览和验证计划 在应用它们之前
- 回滚不需要的更改 轻易地
- 保持透明度 如何修改模型
目录结构
local-model-projects/-下载DBT项目进行本地编辑utils/-使用python运行CLI操作的实用程序.cursor/-Cursor IDE集成配置
CLI使用情况
客户端包括一个命令行界面,用于处理本地项目文件和Git存储库:
文件操作
# List files in a project
python3 cli.py file list dbt_project_1 [--path models/staging]
# Read a file
python3 cli.py file read dbt_project_1 models/staging/stg_customers.sql
# Write to a file
python3 cli.py file write dbt_project_1 models/staging/stg_orders.sql --content "SELECT * FROM orders"
# Or pipe content
cat new_model.sql | python3 cli.py file write dbt_project_1 models/staging/stg_orders.sql
# Delete a file
python3 cli.py file delete dbt_project_1 models/staging/deprecated_model.sqlGit操作
# Initialize Git repository for a project
python3 cli.py git init dbt_project_1
# Check Git status
python3 cli.py git status dbt_project_1
# Commit changes
python3 cli.py git commit dbt_project_1 "Add new staging model for orders"
# Reset changes (soft reset by default)
python3 cli.py git reset dbt_project_1
# Hard reset (discard all changes)
python3 cli.py git reset dbt_project_1 --hard
# Reset specific file
python3 cli.py git reset dbt_project_1 --file-path models/staging/stg_orders.sql
# View commit history
python3 cli.py git history dbt_project_1 --max-count 5项目运营
# Sync local changes to the server
python3 cli.py project sync dbt_project_1 --plan-id my_plan_name
# Sync specific models only
python3 cli.py project sync dbt_project_1 --plan-id my_plan_name --models stg_orders,stg_customers
# Automatically commit changes after syncing
python3 cli.py project sync dbt_project_1 --plan-id my_plan_name --commit
# Skip confirmation prompt
python3 cli.py project sync dbt_project_1 --plan-id my_plan_name --yesMCP服务器连接
客户端按照中的配置连接到MCP服务器 .cursor/mcp.json。此文件包含:
{
"mcpServers": {
"reorc-mcp": {
"transport": "sse",
"url": "https://mcp.test.reorc.cloud/mcp?access_token={YOUR_ACCESS_TOKEN}"
}
},
"auth": {
"defaultCredentials": {
"email": "{YOUR_REORC_ACCOUNT}",
"password": "{YOUR_REORC_PASSWORD}",
"tenant_domain": "{TENANT_DOMAIN}"
}
}
}完成端到端工作流
1.下载并初始化项目
# 1. Download the project files using CLI:
python cli.py project download dbt_project_1
# 2. Extract the project files (happening automatically via CLI)
# 3. Initialize git repository in the project directory
python cli.py git init dbt_project_12.在本地创建和编辑模型
# Edit models using your preferred code editor
# OR use the CLI to write models:
python cli.py file write dbt_project_1 models/staging/stg_orders.sql --content "SELECT * FROM orders"
# Check status of your changes
python cli.py git status dbt_project_1
# Commit changes locally to track your work
python cli.py git commit dbt_project_1 "Update staging orders model"3.将更改同步到服务器
# Sync all modified SQL models to the server
python cli.py project sync dbt_project_1 --plan-id my_plan_name
# Sync specific models and commit changes
python cli.py project sync dbt_project_1 --plan-id my_plan_name --models stg_orders --commit4.在服务器上构建和测试
# In Cursor IDE: Call the build_data_model tool with your project_code and model_name5.必要时回滚
# Reset to the state before your changes using git
python cli.py git reset dbt_project_1 --hard
# Reset specific file only
python cli.py git reset dbt_project_1 --file-path models/staging/stg_orders.sql开发工作流程的好处
- 地方发展优先
- 在首选编辑器中编辑文件 - 使用版本控制跟踪更改 - 在同步到服务器之前进行本地测试
- 透明的变更历史记录
- 查看git diff正在进行哪些更改 - 在本地跟踪修订历史 - 保持对同步时间的控制
- 协作工作流
- 多个开发人员可以在不同的模型上工作 - 更改很容易作为git历史进行审查 - 仅在准备好与服务器集成时进行同步
- 风险缓解
- 使用git轻松回滚更改 - 在同步到服务器之前验证更改 - 维护所有模型版本的本地备份
贡献
欢迎投稿!请随时提交拉取请求。
