MCP server for managing Modal apps, containers, volumes, and secrets.
Project description
MCP Modal Server
An MCP server for managing Modal — apps, containers, volumes, and secrets — and for deploying & running Modal apps directly from Claude Code and other MCP clients.
Every tool shells out to your local modal CLI, so it operates against whatever Modal profile and credentials are configured on your machine. There are no extra tokens to manage.
Installation
The server is published on PyPI as mcp-modal. No manual install is needed — the recommended way to run it is with uvx, which fetches and launches it on demand. Just point your MCP client at the command below (see Configuration).
Logging in to Modal
This server uses your local Modal credentials. If you haven't authenticated yet, run:
modal setup
This opens a browser to log in and stores a token in ~/.modal.toml. Already logged in elsewhere? Check with modal profile current.
Configuration
Add the server to Claude Code with the claude mcp CLI:
claude mcp add mcp-modal -- uvx mcp-modal
Or add it to a .mcp.json file in your project root:
{
"mcpServers": {
"mcp-modal": {
"command": "uvx",
"args": ["mcp-modal"]
}
}
}
To pin a specific release, use uvx mcp-modal@0.2.0.
Requirements
- Python 3.11 or higher
uv(providesuvx)- Modal CLI 1.x configured with valid credentials (
modal setup) - For Modal deploy and run support:
- The project being deployed/run must use
uvfor dependency management modalmust be installed in that project's virtual environment
- The project being deployed/run must use
Supported Tools
26 tools, grouped by area. Account-scoped tools accept an optional env argument to
target a specific Modal environment; if
omitted, they use the profile's default (or MODAL_ENVIRONMENT).
Deploy & Run
-
Deploy Modal App (
deploy_modal_app)- Deploys a Modal app (
modal deploy). Deployed web endpoints persist, so any links in the output are live and shareable (returned inurls). - Parameters:
absolute_path_to_app(required),env,name,tag,strategy(rolling/recreate),stream_logs - The app's directory must use
uvwithmodalinstalled in its virtualenv.
- Deploys a Modal app (
-
Run Modal App (
run_modal_app)- Runs a function or local entrypoint once and streams its output (
modal run). - Parameters:
absolute_path_to_app(required),function_name,env,detach,timeout_seconds(default 120) - Returns a snapshot with
truncated: trueif the run is still going at the timeout. Passdetach=Trueto keep long jobs alive on Modal past the timeout.
- Runs a function or local entrypoint once and streams its output (
Why no
modal servetool?modal serveonly keeps its endpoints alive while the blocking process runs — an MCP tool that returns would tear them down immediately, handing back a dead URL. Usedeploy_modal_appfor a persistent, shareable endpoint.
Apps
-
List Modal Apps (
list_modal_apps)- Lists apps currently deployed/running or recently stopped. Use this to find the app name/ID for the other app tools.
- Parameters:
env
-
Get Modal App Logs (
get_modal_app_logs)- Fetches or streams logs for an app by name or ID (
modal app logs). - Parameters:
app_identifier(required),timeout_seconds(default 30),env,since,until,tail,search,source(stdout/stderr/system),follow - With
follow=True, logs stream until the app stops ortimeout_secondsis reached, returning a snapshot withtruncated: true.
- Fetches or streams logs for an app by name or ID (
-
Stop Modal App (
stop_modal_app)- Permanently stops an app and terminates its containers (
modal app stop). - Parameters:
app_identifier(required),env
- Permanently stops an app and terminates its containers (
-
Roll Back Modal App (
rollback_modal_app)- Redeploys a previous version of an app (
modal app rollback). - Parameters:
app_identifier(required),version(optional — defaults to the previous version),env
- Redeploys a previous version of an app (
-
Get Modal App History (
get_modal_app_history)- Returns an app's deployment history (
modal app history). Use it to find aversionfor rollback. - Parameters:
app_identifier(required),env
- Returns an app's deployment history (
Containers
-
List Modal Containers (
list_modal_containers)- Lists currently running containers (
modal container list). - Parameters:
app_id(optional filter),env
- Lists currently running containers (
-
Get Modal Container Logs (
get_modal_container_logs)- Fetches or streams logs for a container ID (
modal container logs). - Parameters:
container_id(required),timeout_seconds(default 30),since,until,tail,search,source,follow
- Fetches or streams logs for a container ID (
-
Exec in Modal Container (
exec_modal_container)- Runs a command inside a running container (
modal container exec --no-pty). - Parameters:
container_id(required),command(list of args, e.g.["python", "-c", "print('hi')"]),timeout_seconds(default 60)
- Runs a command inside a running container (
-
Stop Modal Container (
stop_modal_container)- Terminates a running container (
modal container stop). - Parameters:
container_id(required)
- Terminates a running container (
Log Search
- Search Modal Logs (
search_modal_logs)- Greps an app's or container's logs for a pattern and returns each hit with the
surrounding lines — built for "where did it go wrong?" debugging. Logs are fetched
once and searched locally, so (unlike the
searchargument on the log tools) you get context, regex, case control, and match counts, not just the bare matching line. - Parameters:
identifier(required — app name/ID or container ID),pattern(required),target(app/container, defaultapp),regex,case_sensitive,context_lines(default 3),max_matches(default 50),since,tail(defaults to the last 1000 entries),timeout_seconds,env - Returns
match_countandmatches: line-numbered context blocks where matched lines are prefixed with>, e.g.> 8: ValueError: bad input.
- Greps an app's or container's logs for a pattern and returns each hit with the
surrounding lines — built for "where did it go wrong?" debugging. Logs are fetched
once and searched locally, so (unlike the
Volumes — Files
- List Modal Volumes (
list_modal_volumes) — lists all volumes. Parameters: none. - List Volume Contents (
list_modal_volume_contents) —volume_name,path(default/). - Copy Files (
copy_modal_volume_files) —volume_name,paths(last is destination). - Remove File (
remove_modal_volume_file) —volume_name,remote_path,recursive. - Upload File (
put_modal_volume_file) —volume_name,local_path,remote_path,force. - Download File (
get_modal_volume_file) —volume_name,remote_path,local_destination,force. Use-as the destination to stream contents to stdout.
Volumes — Lifecycle
- Create Volume (
create_modal_volume) — creates a named persistent volume. Parameters:volume_name,env. - Delete Volume (
delete_modal_volume) — deletes a volume and all its data (irreversible). Parameters:volume_name,env. - Rename Volume (
rename_modal_volume) — Parameters:old_name,new_name,env.
Secrets
-
List Secrets (
list_modal_secrets)- Lists published secrets (names and timestamps only — values are never exposed).
- Parameters:
env
-
Create Secret (
create_modal_secret)- Creates a secret from inline key/values or a local file (
modal secret create). Secret values are redacted from the returnedcommand. - Parameters:
secret_name(required),key_values(dict),from_dotenv(path),from_json(path),force,env. Provide at least one ofkey_values,from_dotenv, orfrom_json.
- Creates a secret from inline key/values or a local file (
-
Delete Secret (
delete_modal_secret) — Parameters:secret_name,env.
Discovery
-
Get Modal Profile (
get_modal_profile)- Shows the active profile and all configured profiles. Use it to confirm which workspace/account the server is authenticated as. Parameters: none.
-
List Modal Environments (
list_modal_environments)- Lists the environments in the current workspace; the names are valid
envarguments for the other tools. Parameters: none.
- Lists the environments in the current workspace; the names are valid
Response Format
All tools return responses in a standardized format, with slight variations depending on the operation type:
# JSON / list operations (apps, containers, volumes, secrets, history, ...):
{
"success": True,
"apps": [...] # or "containers", "volumes", "secrets", "history", "environments"
}
# Action operations (deploy, stop, create, delete, rename, copy, put, get, rm):
{
"success": True,
"message": "Operation successful message",
"command": "executed command string",
"stdout": "command output", # if any
"stderr": "error output" # if any
}
# Log / run / exec operations (snapshot-based):
{
"success": True,
"logs": "...", # or "output" for run/exec
"truncated": False, # True when cut off at timeout_seconds
"command": "executed command string"
}
# Error case (all operations):
{
"success": False,
"error": "Error message describing what went wrong",
"command": "executed command string",
"stdout": "command output", # if available
"stderr": "error output" # if available
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_modal-0.2.1.tar.gz.
File metadata
- Download URL: mcp_modal-0.2.1.tar.gz
- Upload date:
- Size: 94.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac696dbe86f296115d7e0f08205987613af2ac9987a4645f3bc3944f222b97eb
|
|
| MD5 |
77f3f71339181258d6a8964b0a5b0fb6
|
|
| BLAKE2b-256 |
104b536178bda4934d6a709d67a82500fb2a216bb47a29b71f55eb6f1f1d1a59
|
File details
Details for the file mcp_modal-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mcp_modal-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96ccf5957ff2183b693b3b5b1a5424edc649647fffb9584b704ba00e8d057653
|
|
| MD5 |
e6d2f102476e041145574b0ec6b33152
|
|
| BLAKE2b-256 |
d56f4e53cf82759e2f370729083257a3c29ac3f118f86c5024db836130707720
|