Skip to main content

Cloud Studio MCP 部署服务

Python Version FastAPI

Cloud Studio MCP 部署服务是一个基于FastMCP的服务器,提供Cloud Studio工作空间的管理功能,包括创建工作空间、上传文件和执行命令等操作。

功能特性

  • 创建工作空间:创建新的Cloud Studio工作空间实例
  • 文件管理:上传文件到指定工作空间
  • 命令执行:在工作空间中执行shell命令
  • MCP集成:通过MCP协议提供标准化接口

安装指南

前置要求

  • Python 3.8+
  • API_TOKEN环境变量(Cloud Studio API访问令牌)

安装步骤

  1. 克隆仓库:

    git clone <repository-url>
    cd mcp_deploy
    
  2. 创建并激活虚拟环境:

    python -m venv .venv
    source .venv/bin/activate  # Linux/macOS
    .\.venv\Scripts\activate   # Windows
    
  3. 安装依赖:

    pip install -e .
    

配置说明

在运行服务前,需要设置以下环境变量:

export API_TOKEN="your_cloud_studio_api_token"
export region="ap-shanghai"  # 可选,默认为ap-shanghai

使用说明

启动服务

python -m mcp_deploy

API 文档

服务提供以下MCP工具:

1. 创建工作空间

create_workspace() -> dict

返回示例:

{
    "workspace_key": "ws-kmhhvqnlogr48",
    "webIDE": "https://ws-kmhhv1pyvc48--ide.ap-shanghai.cloudstudio.club"
}

2. 上传文件

write_files(workspace_key: str, region: str, files: list[File]) -> str

文件格式:

class File:
    save_path: str    # 文件保存路径
    file_content: str # 文件内容(UTF-8编码)

3. 执行命令

execute_command(workspace_key: str, region: str, command: str) -> str

示例:

execute_command("ws-xxxx", "ap-shanghai", "ls -al")

开发指南

项目结构

mcp_deploy/
├── __init__.py
├── __main__.py
├── mcp_handlers.py    # 核心业务逻辑
├── models.py          # 数据模型定义
└── server.py          # FastMCP服务器实现

测试

  1. 确保已设置API_TOKEN环境变量
  2. 运行测试命令:
    python -m pytest
    

贡献

欢迎提交Pull Request或Issue报告问题。

许可证

MIT License

Metadata

Release files for mcp-deploy 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-deploy 0.1.12
File Size Uploaded Provenance
mcp_deploy-0.1.12.tar.gz 23.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-deploy 0.1.12
File Interpreter ABI Platform
mcp_deploy-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 34.4 kB

Release files / mcp_deploy-0.1.12.tar.gz

Download URL mcp_deploy-0.1.12.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
202c064bdb669169c05d7291e9903aa5a7f8107049803ed2095b9a117a5453d7
BLAKE2b-256 checksum
How to use checksums
f2afe297908eee4a6889c138e0c3e836f23fb1b6c0d55a5cf94c7d9f7cb14198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / mcp_deploy-0.1.12-py3-none-any.whl

Download URL mcp_deploy-0.1.12-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
090c07a1646d73a7a6cb18ddaf833fde83d2a1f439d10cb33db6a537ea45f7c5
BLAKE2b-256 checksum
How to use checksums
07d4fae08e98635fa0976fc539ec690ed1ffb5a43006aea3834794903ce83bec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Security for mcp-deploy 0.1.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page