M

Modal云服务器

@smehmood/modal-mcp-server
0 Stars 358 次浏览 smehmood 更新于 2026-08-23

一个MCP服务器,它使AI代理能够与Modal交互,从而让他们在无服务器的云环境中部署应用程序和运行函数。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

Modal MCP 服务器

一个用于在 Cursor 内与 Modal 卷交互并部署 Modal 应用程序的 MCP 服务器实现。

安装

  1. 克隆此仓库:
git clone https://github.com/smehmood/modal-mcp-server.git
cd modal-mcp-server
  1. 使用 uv 安装依赖项:
uv sync

配置

要在 Cursor 中使用此 MCP 服务器,请将以下配置添加到您的 ~/.cursor/mcp.json 文件中:

{
  "mcpServers": {
    "modal-mcp-server": {
      "command": "uv",
      "args": [
        "--project", "/path/to/modal-mcp-server",
        "run", "/path/to/modal-mcp-server/src/modal_mcp/server.py"
      ]
    }
  }
}

/path/to/modal-mcp-server 替换为克隆仓库的绝对路径。

要求

  • Python 3.11 或更高版本
  • uv 包管理器
  • 配置了有效凭证的 Modal CLI
  • 对于支持 Modal 部署:
    • 被部署的项目必须使用 uv 进行依赖管理
    • Modal 必须安装在项目的虚拟环境中

支持的工具

  1. 列出 Modal 卷 (list_modal_volumes)

    • 列出环境中的所有 Modal 卷
    • 返回 JSON 格式的卷信息
    • 参数:无
  2. 列出卷内容 (list_modal_volume_contents)

    • 列出 Modal 卷中的文件和目录
    • 参数:
      • volume_name: Modal 卷的名称
      • path: 卷内的路径(默认: "/")
  3. 复制文件 (copy_modal_volume_files)

    • 在 Modal 卷内复制文件
    • 参数:
      • volume_name: Modal 卷的名称
      • paths: 路径列表,最后一个路径是目标位置
    • 示例:["source.txt", "dest.txt"]["file1.txt", "file2.txt", "dest_dir/"]
  4. 移除文件 (remove_modal_volume_file)

    • 从 Modal 卷中删除文件或目录
    • 参数:
      • volume_name: Modal 卷的名称
      • remote_path: 要删除的文件/目录的路径
      • recursive: 递归删除的布尔标志(默认: false)
  5. 上传文件 (put_modal_volume_file)

    • 将文件或目录上传到 Modal 卷
    • 参数:
      • volume_name: Modal 卷的名称
      • local_path: 要上传的本地文件/目录的路径
      • remote_path: 卷内的上传路径(默认: "/")
      • force: 布尔标志,用于覆盖现有文件(默认: false)
  6. 下载文件 (get_modal_volume_file)

    • 从 Modal 卷下载文件
    • 参数:
      • volume_name: Modal 卷的名称
      • remote_path: 卷中要下载的文件/目录的路径
      • local_destination: 保存下载文件的本地路径(默认: 当前目录)
      • force: 布尔标志,用于覆盖现有文件(默认: false)
    • 注意:使用 "-" 作为 local_destination 可以将文件内容写入标准输出
  1. 部署 Modal 应用程序 (deploy_modal_app)
    • 部署一个 Modal 应用程序
    • 参数:
      • absolute_path_to_app: Modal 应用程序文件的绝对路径
    • 注意:包含 Modal 应用程序的项目必须:
      • 使用 uv 进行依赖管理
      • 在其虚拟环境中安装了 modal CLI

响应格式

所有工具返回的响应都采用标准化格式,根据操作类型略有不同:

# JSON operations (list volumes, list contents):
{
    "success": True,
    "data": {...}  # JSON data from Modal CLI
}

# File operations (put, get, copy, remove):
{
    "success": True,
    "message": "Operation successful message",
    "command": "executed command string",
    "stdout": "command output",  # if any
    "stderr": "error output"     # if any
}

# Error case (all operations):
{
    "success": False,
    "error": "Error message describing what went wrong",
    "command": "executed command string",  # for file operations
    "stdout": "command output",  # if available
    "stderr": "error output"     # if available
}

贡献

欢迎贡献!请随时提交 Pull Request。

许可证

本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。

相关 MCP 服务