Modal MCP server

Enables AI systems to deploy and execute serverless applications in the cloud through Modal's platform, providing tools for application deployment and function execution with custom parameters.
Back to servers
Setup instructions
Provider
Saad Mehmood
Release date
Mar 23, 2025
Language
Python
Stats
3 stars

This MCP server allows you to interact with Modal volumes and deploy Modal applications directly from within Cursor. It provides convenient tools for managing Modal volumes and deploying Modal applications through a standardized interface.

Installation

To install the Modal MCP server:

  1. Clone the repository:

    git clone https://github.com/smehmood/modal-mcp-server.git
    cd modal-mcp-server
    
  2. Install dependencies using uv:

    uv sync
    

Configuration

To use this MCP server in Cursor, add the following configuration to your ~/.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"
      ]
    }
  }
}

Make sure to replace /path/to/modal-mcp-server with the absolute path to your cloned repository.

Requirements

Before using the Modal MCP server, ensure you have:

  • Python 3.11 or higher
  • uv package manager installed
  • Modal CLI configured with valid credentials
  • For deployment functionality:
    • Your project must use uv for dependency management
    • Modal must be installed in the project's virtual environment

Using Modal Volume Operations

List Modal Volumes

Lists all Modal volumes in your environment:

{
  "tool": "list_modal_volumes"
}

List Volume Contents

Lists files and directories in a Modal volume:

{
  "tool": "list_modal_volume_contents",
  "volume_name": "your-volume-name",
  "path": "/"
}

Copy Files Within a Volume

Copies files within a Modal volume:

{
  "tool": "copy_modal_volume_files",
  "volume_name": "your-volume-name",
  "paths": ["source.txt", "dest.txt"]
}

You can also copy multiple files to a directory:

{
  "tool": "copy_modal_volume_files",
  "volume_name": "your-volume-name",
  "paths": ["file1.txt", "file2.txt", "dest_dir/"]
}

Remove Files

Deletes a file or directory from a Modal volume:

{
  "tool": "remove_modal_volume_file",
  "volume_name": "your-volume-name",
  "remote_path": "path/to/delete",
  "recursive": false
}

Set recursive to true to delete directories recursively.

Upload Files

Uploads a file or directory to a Modal volume:

{
  "tool": "put_modal_volume_file",
  "volume_name": "your-volume-name",
  "local_path": "path/to/local/file",
  "remote_path": "/",
  "force": false
}

Set force to true to overwrite existing files.

Download Files

Downloads files from a Modal volume:

{
  "tool": "get_modal_volume_file",
  "volume_name": "your-volume-name",
  "remote_path": "path/in/volume",
  "local_destination": "./download-folder",
  "force": false
}

Use - as local_destination to write file contents to stdout.

Deploying Modal Applications

You can deploy a Modal application using:

{
  "tool": "deploy_modal_app",
  "absolute_path_to_app": "/absolute/path/to/your/app.py"
}

Note: The project containing the Modal app must:

  • Use uv for dependency management
  • Have the modal CLI installed in its virtual environment

Response Format

All tools return responses in a standardized format:

For JSON operations:

{
    "success": true,
    "data": {}  // JSON data from Modal CLI
}

For file operations:

{
    "success": true,
    "message": "Operation successful message",
    "command": "executed command string",
    "stdout": "command output",
    "stderr": "error output"
}

For error cases:

{
    "success": false,
    "error": "Error message describing what went wrong",
    "command": "executed command string",
    "stdout": "command output",
    "stderr": "error output"
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later