> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Modal Integration

> How the MCP server uses Modal, and what an agent can deploy on your behalf

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](/docs/tools/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`](/docs/mcp/functions#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`](/docs/mcp/functions#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`](/docs/mcp/functions#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`](/docs/mcp/functions#deploy_tool). It never does so silently.

<Warning>
  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.
</Warning>

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](/docs/tools/modal-integration) page, including the
`PROTO_MODAL_SCALEDOWN_WINDOW` setting.

## Next Steps

<CardGroup cols={2}>
  <Card title="Modal Setup" icon="cloud" href="/docs/tools/modal-integration">
    Account creation, authentication, environments, and deploying from the command line.
  </Card>

  <Card title="Installation" icon="download" href="/docs/mcp/installation">
    Install the extra, register the server, and select the Modal backend.
  </Card>

  <Card title="Server Functions" icon="wrench" href="/docs/mcp/functions">
    Every function the server exposes, including `deploy_tool` and its confirmation step.
  </Card>

  <Card title="Cloud Inference" icon="play" href="/docs/tools/guides/cloud-inference">
    A runnable walkthrough that deploys a model and folds a structure with it.
  </Card>
</CardGroup>
