Modal MCP server
95 operations0 webhooks
Modal's serverless cloud through its JavaScript SDK: sandboxes (create from any image, exec, files, tunnels, snapshots, logs), image builds, calls to deployed functions and classes, function calls, volumes, secrets, queues, dicts, apps and environments (95 operations).
Try Modal with your agent
Connect Modal, then paste this into Claude, ChatGPT or Cursor. For ideas from other apps, see the use cases.
Using Corsair, show me what you can do in Modal on my account, then run one read-only example and show me the result.
Modal tools and triggers
Tools are what your agent can do in Modal through Corsair's MCP server. Triggers are the Modal events a routine can start from.
Sandboxes
- CreateDestructive
Start a Modal Sandbox (a container billed per second for CPU, memory and any GPU) from a registry image, a built image or a published one. Returns its id, plus tunnel URLs when ports are exposed.
sandboxes.create
- Create Connect TokenWrite
Create a URL and bearer token for HTTP requests into a sandbox port (default 8080). Treat the token as a secret.
sandboxes.createConnectToken
- ExecDestructive
Run a command in a running sandbox and wait for it: returns exit code, stdout and stderr. For a shell line pass ["sh", "-c", "..."].
sandboxes.exec
- Fetch LogsRead-only
A sandbox's entrypoint logs over a time range, with optional text search.
sandboxes.fetchLogs
- GetRead-only
Whether a sandbox is still running, and its exit code once it has finished.
sandboxes.get
- Get By NameRead-only
Find a running sandbox by the name it was created with, inside a deployed App.
sandboxes.getByName
- Get Exit SnapshotRead-only
The filesystem Image captured when a sandbox created with enableExitSnapshot exited.
sandboxes.getExitSnapshot
- Get TagsRead-only
The tags on a sandbox.
sandboxes.getTags
- ListRead-only
List running sandboxes in the environment, or in one App, optionally filtered by tags.
sandboxes.list
- LogsRead-only
The most recent entrypoint log lines of a sandbox (not the output of sandboxes.exec commands).
sandboxes.logs
- Mount ImageWrite
Mount an Image (e.g. from sandboxes.snapshotDirectory) at a path in a running sandbox; without imageId an empty directory is mounted.
sandboxes.mountImage
- PauseWrite
Stop the container of a persistent sandbox, keeping its state for sandboxes.resume. Persistent sandboxes are not enabled on every workspace yet.
sandboxes.pause
- Reload VolumesWrite
Reload the Volumes mounted in a sandbox to see changes committed elsewhere.
sandboxes.reloadVolumes
- Restore SnapshotDestructive
Start a new sandbox from a memory snapshot (billed like any sandbox).
sandboxes.restoreSnapshot
- ResumeDestructive
Start a paused persistent sandbox again from its saved state (billed while running).
sandboxes.resume
- Set NameWrite
Name a running V2 sandbox that has none (once only), so sandboxes.getByName can find it.
sandboxes.setName
- Set TagsWrite
Replace all tags on a sandbox (an empty object clears them).
sandboxes.setTags
- Snapshot DirectoryWrite
Save one directory of a running sandbox as an Image (mount it elsewhere with sandboxes.mountImage).
sandboxes.snapshotDirectory
- Snapshot FilesystemWrite
Save a sandbox's filesystem as an Image; pass its id to sandboxes.create to start a copy.
sandboxes.snapshotFilesystem
- Snapshot MemoryWrite
Snapshot filesystem and memory of a sandbox created with enableMemorySnapshot (and no Volumes). The sandbox stops once the snapshot is taken; sandboxes.restoreSnapshot starts a copy.
sandboxes.snapshotMemory
- TerminateDestructive
Stop a sandbox and end its billing. Its filesystem is lost unless it was snapshotted.
sandboxes.terminate
- TunnelsRead-only
Public URLs and TCP endpoints for the ports a sandbox exposes (encryptedPorts, h2Ports, unencryptedPorts).
sandboxes.tunnels
- Unmount ImageWrite
Unmount an Image mounted with sandboxes.mountImage.
sandboxes.unmountImage
- Update Network PolicyWrite
Replace the outbound allowlists of a running sandbox. Pass both lists; [] blocks that dimension, ["0.0.0.0/0"] or ["*"] allows all. Only works on a sandbox created with outboundCidrAllowlist/outboundDomainAllowlist (to start open, create it with ["0.0.0.0/0"] and ["*"]); Modal answers 409 otherwise.
sandboxes.updateNetworkPolicy
- WaitRead-only
Wait for a sandbox to finish (up to timeoutMs) and return its exit code.
sandboxes.wait
- Wait Until ReadyRead-only
Wait until a sandbox is ready: its readiness probe passes, or it has started when it has none.
sandboxes.waitUntilReady
Dicts
- ClearDestructive
Remove every entry from the Dict. Cannot be undone.
dicts.clear
- ContainsRead-only
Whether a key is in the Dict.
dicts.contains
- CreateWrite
Get a named Dict (a key/value store shared by sandboxes and functions), creating it if it does not exist.
dicts.create
- DeleteDestructive
Delete a Dict and all its entries. Cannot be undone.
dicts.delete
- GetRead-only
Read the value stored under a key. Python tuples and sets come back as arrays, bytes as { $bytes: base64 }, other objects (datetimes, class instances) as { $pickle: base64 }.
dicts.get
- ItemsRead-only
Keys and values in the Dict, decoded as in dicts.get (a tuple key comes back as an array).
dicts.items
- LenRead-only
Number of entries in the Dict.
dicts.len
- ListRead-only
List the named Dicts in an environment, newest first.
dicts.list
- PopWrite
Remove a key and return its value.
dicts.pop
- PutWrite
Store a JSON value under a key. With skipIfExists an existing key is left alone.
dicts.put
- UpdateWrite
Store several key/value pairs at once.
dicts.update
Functions
- CallDestructive
Run a deployed function with arguments and wait for its result (billed for the compute it uses). The function must accept CBOR input (Modal 1.2+ deployments).
functions.call
- Current StatsRead-only
Current backlog (queued inputs) and number of running containers.
functions.currentStats
- Fetch LogsRead-only
A function's logs over a time range, with optional text search.
functions.fetchLogs
- GetRead-only
Look up a deployed function by App and name (or by id) and return its id and web URL, if it has one.
functions.get
- InfoRead-only
A deployed function's configuration: CPU, memory, GPUs, image, timeouts, retries, regions, schedule, volumes, secrets, web endpoint and class methods.
functions.info
- LogsRead-only
The most recent log lines of a function.
functions.logs
- MetricsRead-only
Time series metrics for a function (see functions.metricsSchema for the available groups and names).
functions.metrics
- Metrics SchemaRead-only
The metric groups and definitions functions.metrics can export.
functions.metricsSchema
- SpawnDestructive
Start a deployed function without waiting; returns a function call id for functionCalls.get or functionCalls.cancel.
functions.spawn
- StatsRead-only
Input and container counts and latency percentiles for a function over a time window.
functions.stats
- Update AutoscalerDestructive
Change min/max/buffer containers and the scale-down window of a deployed function. Warm containers (minContainers, bufferContainers) are billed while idle.
functions.updateAutoscaler
Queues
- ClearDestructive
Remove every value from a Queue partition, or from all partitions with all. Cannot be undone.
queues.clear
- CreateWrite
Get a named Queue, creating it if it does not exist. Values are pickled, so Python code reads them as ordinary objects.
queues.create
- DeleteDestructive
Delete a Queue and everything in it. Cannot be undone.
queues.delete
- GetWrite
Remove and return up to `count` values from the front of a Queue, waiting up to timeoutMs for one to arrive. Returns [] when it stays empty. Python tuples and sets come back as arrays, bytes as { $bytes }, other objects as { $pickle: base64 }.
queues.get
- LenRead-only
Number of values in a Queue partition, or in all partitions with total.
queues.len
- ListRead-only
List the named Queues in an environment with their partition count and size.
queues.list
- PeekRead-only
Read values from a Queue in order without removing them (decoded as in queues.get).
queues.peek
- PutWrite
Add values (JSON) to the end of a Queue. { $bytes: base64 } is stored as Python bytes.
queues.put
Apps
- CreateWrite
Get a Modal App by name, creating an empty one if it does not exist. Sandboxes and image builds run inside an App.
apps.create
- GetRead-only
Look up a Modal App by name and return its id. Fails with 404 if the App does not exist.
apps.get
- InfoRead-only
An App's description, lifecycle (state, deploys, who and when) and the ids of its functions and servers.
apps.info
- ListRead-only
List the live Apps in an environment (stopped and disabled Apps are left out).
apps.list
- Sandbox StatsRead-only
Cost in USD of an App's sandboxes over a time range (at most 7 days, on UTC hour boundaries), optionally grouped by tag values.
apps.sandboxStats
- StatsRead-only
Call, request, container and sandbox counts for an App over a time window (default the last hour; at most 7 days, starting within the last 30 days).
apps.stats
- StopDestructive
Stop an App: terminates all its running containers and sandboxes and stops it taking new inputs. A deployed App has to be deployed again to come back.
apps.stop
Files
- ListRead-only
List the entries of a directory in a running sandbox.
files.list
- Make DirectoryWrite
Create a directory in a running sandbox.
files.makeDirectory
- ReadRead-only
Read a file from a running sandbox, as UTF-8 text or base64 for binary files.
files.read
- RemoveDestructive
Delete a file or directory in a running sandbox (recursive for non-empty directories).
files.remove
- StatRead-only
Type, size, owner, permissions and modified time of a path in a running sandbox.
files.stat
- WriteWrite
Write a file in a running sandbox, replacing it if it exists. Parent directories must exist (see files.makeDirectory).
files.write
Volumes
- CreateWrite
Get a Volume by name, creating it if it does not exist. Volumes are persistent network file systems for sandboxes and functions (storage is billed).
volumes.create
- DeleteDestructive
Delete a Volume and all its files. Running Apps that mount it lose access. Cannot be undone.
volumes.delete
- GetRead-only
Look up a Volume by name and return its id. 404 if it does not exist.
volumes.get
- ListRead-only
List the Volumes in an environment, newest first.
volumes.list
- List FilesRead-only
List files and directories in a Volume under a path.
volumes.listFiles
- Remove FileDestructive
Delete a file, or with recursive a directory, from a Volume. Cannot be undone.
volumes.removeFile
Environments
- CreateWrite
Create an environment in the workspace.
environments.create
- DeleteDestructive
Delete an environment and every App, Volume, Secret, Queue and Dict in it. Cannot be undone.
environments.delete
- GetRead-only
Look up a Modal environment by name and return its id.
environments.get
- Get DefaultRead-only
The environment calls run in: the account's configured environment, else the workspace default.
environments.getDefault
- ListRead-only
List the environments in the workspace.
environments.list
Images
- BuildDestructive
Build an image (registry base plus optional Dockerfile commands) on Modal and return its id. The build runs on Modal compute; later sandboxes reuse the cached image.
images.build
- DeleteDestructive
Delete an image. Sandboxes and functions using it keep running, but it cannot be used again.
images.delete
- GetRead-only
Check that an image id exists and return it.
images.get
- Get By NameRead-only
Look up an image published with images.publish by its name.
images.getByName
- PublishWrite
Give a built image a name in the environment, so images.getByName and sandboxes.create (publishedName) can use it.
images.publish
Secrets
- CreateWrite
Create a named Secret from key/value pairs (injected into sandboxes and functions as environment variables). Fails if it exists unless overwrite is set.
secrets.create
- DeleteDestructive
Delete a Secret. Apps that use it fail on their next start. Cannot be undone.
secrets.delete
- GetRead-only
Look up a Secret by name and return its id (values are never returned). With requiredKeys, fails if any key is missing.
secrets.get
- ListRead-only
List the Secrets in an environment with their key names and last use (values are never returned).
secrets.list
Function Calls
- CancelDestructive
Cancel a spawned call. With terminateContainers the containers running it are stopped too.
functionCalls.cancel
- GetRead-only
The result of a spawned call, waiting up to waitMs; status "pending" if it is still running.
functionCalls.get
- LogsRead-only
The most recent log lines of one function call.
functionCalls.logs
Classes
- CallDestructive
Run a method of a deployed class and wait for its result (billed for the compute it uses).
classes.call
- SpawnDestructive
Start a method of a deployed class without waiting; returns a function call id.
classes.spawn
Proxies
- GetRead-only
Look up a Modal Proxy (static outbound IP, set up in the dashboard) by name; pass its name as proxyName to sandboxes.create.
proxies.get
Connect Modal to Claude, ChatGPT or Cursor
- 1
Connect Modal in Corsair
Add your Modal API key once in Corsair. Corsair stores the credential encrypted and makes the Modal API calls for your agent, so it never goes into a prompt or a config file. Connect Modal
If your link lets the agent add apps, you can skip this: it gives you a sign-in link the first time it needs Modal. On a ChatGPT personal plan, connect Modal here first.
- 2
Add Corsair's MCP server to your agent
Every client uses the same address:
https://mcp.corsair.dev/mcpOpen Plugins → Add → Add custom connector, name it Corsair, paste the address, select Continue, then Add.Add a custom MCP server with the address and choose OAuth. Personal plans get read tools only.Add to CursorOr add this to~/.cursor/mcp.json. Cursor opens Corsair to sign in the first time it connects.{ "mcpServers": { "corsair": { "url": "https://mcp.corsair.dev/mcp" } } }Run this, then run/mcpin Claude Code to sign in.claude mcp add --transport http corsair https://mcp.corsair.dev/mcpCodex, Gemini CLI, VS Code, Zed and other clients with OAuth sign-in work the same way. Clients without it, such as GitHub Copilot's coding agent, use a link's own address and an API key. Setup for every client
- 3
Sign in and choose what needs your approval
Your client opens Corsair to sign in. Pick a link: the apps your agent can use and a mode that decides what it may do without asking. In the default Cautious mode, Modal's read and write operations run right away and its 23 destructive operations wait for your approval. Strict mode asks before every write and refuses destructive operations, and Read mode allows reads only.
FAQ
Install corsair and @corsair-dev/modal, add the Modal plugin, and connect with an API key. Then call methods like corsair.modal.api.apps.create() from your app. Corsair keeps each tenant isolated.
Yes. Modal requires an API key from your Modal account or developer dashboard. Create credentials with access that matches what you automate, then paste them into Corsair or connect through managed auth in Hub.
Yes. One Corsair client can hit Modal, GitHub, Notion, Stripe, and the rest. Trigger Modal from a webhook, push updates to Slack, or chain actions across plugins. Same tenant context across integrations, plain TypeScript.
Teams use Corsair for modal's serverless cloud through its JavaScript SDK: sandboxes (create from any image, exec, files, tunnels, snapshots, logs), image builds, calls to deployed functions and classes, function calls, volumes, secrets, queues, dicts, apps and environments (95 operations). Common builds include sync jobs, admin tooling, and agents that call Modal APIs from your backend.
The SDK is open source. Self-host and you pay Corsair nothing for the integration layer. Hub bills for hosted auth and execution, not per Modal API call. Hub has a generous free tier. For hobby projects you can probably run the whole thing on free. Paid plans start to matter with more tenants or heavier traffic.
We maintain @corsair-dev/modal in the open repo. When Modal ships API changes, upgrade the package. Your call sites stay typed. You should not need to rewrite the integration layer each time.
No. Corsair does not read your Modal data or hold individual access credentials. Credentials stay in your database. API calls run on your instance. We do not store Modal data on your behalf.
Yes. Add https://mcp.corsair.dev/mcp as a custom connector or MCP server in Claude, ChatGPT, Cursor, VS Code, Claude Code, Codex or any client that supports remote MCP servers with OAuth sign-in, then sign in to Corsair. On ChatGPT personal plans, custom servers currently get read tools only.
Yes. Put Modal on a link in Strict mode and every write waits for your approval, while destructive actions are refused. The default Cautious mode asks only before the 23 destructive Modal operations. You can change a link's mode at hub.corsair.dev/me.