Skip to main content

Cloud Studio MCP Server

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudstudio_mcp_server-0.1.3.tar.gz (50.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudstudio_mcp_server-0.1.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file cloudstudio_mcp_server-0.1.3.tar.gz.

File metadata

File hashes

Hashes for cloudstudio_mcp_server-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6735bc03f8e40f96be9f789972fd949278d71ce92e4c796003a8d61c8bbb6bfe
MD5 4c0082fc0f4aab52c7110cc12c5a3aeb
BLAKE2b-256 70916dd7904cc7d2f6c8784e8db2eddcaa69ce9130d6921220fe7984d5a5a36f

See more details on using hashes here.

File details

Details for the file cloudstudio_mcp_server-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudstudio_mcp_server-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d65cf3b07b61fc115e37dcdf3bb171cbd8c121c35da53c0ddb168bd66cf86974
MD5 d621c7359ea5e5712dad775d755a33b5
BLAKE2b-256 cb4f61c2f0899410aa8693891dda259c9c68a230f7e7f034c8887188e35d1081

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page