Skip to main content
Modal is the server’s default backend. Tools run in a Modal workspace you own, keeping their model weights warm between calls, so an agent that calls the same tool repeatedly pays the load cost once. This page covers what the MCP server does with Modal. For account setup, creating an environment, and the configuration options that apply to every caller, see Modal Integration in the Tools section.

What the agent sees

The server resolves its backend once at startup, so the catalog the agent lists and the tools it can actually run never disagree.
  • workspace_info reports which workspace and environment calls go to, how many apps are deployed, and whether Modal credentials are present at all.
  • list_tools defaults to the tools you have deployed. Passing deployed_only=false returns the full catalog, which is how the agent identifies what remains available to deploy.
  • run_tool executes a deployed tool and blocks until it finishes.

Deploying a tool

An agent can deploy a tool you have not set up yet, through deploy_tool. It never does so silently.
Every deployment asks you to confirm first. The prompt names the app and the target environment, and states that the build is billed to your own Modal account. Declining deploys nothing and incurs no cost. A client that cannot present the prompt is treated as a refusal, so an agent can never deploy by default.
The spend is real: a deployment builds a container image and then executes the tool once to warm it, on a GPU where the tool requires one. Both happen before any result comes back, and both are billed to your account. The weights it downloads then persist on a Modal volume and accrue storage cost until you remove them. The target environment is a required argument rather than an inherited default, so an agent cannot deploy into production by accident. Deployment is a one-time cost per tool. Later calls reuse the app and the cached weights.

Keeping spend predictable

Two things account for most of what a workspace costs:
  • Deploy only what you need. Cached weights persist on a Modal volume and accrue storage cost until they are removed. Remove the weights for tools you no longer use.
  • Tune the scale-down window. Containers stay warm briefly after a call so the next one skips the model load. A longer window is faster for an interactive session and costs more while the GPU idles.
Both are covered in full on the Modal Integration page, including the PROTO_MODAL_SCALEDOWN_WINDOW setting.

Next Steps

Modal Setup

Account creation, authentication, environments, and deploying from the command line.

Installation

Install the extra, register the server, and select the Modal backend.

Server Functions

Every function the server exposes, including deploy_tool and its confirmation step.

Cloud Inference

A runnable walkthrough that deploys a model and folds a structure with it.