> ## Documentation Index
> Fetch the complete documentation index at: https://levers9.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Deploy a FastMCP server as a URL that agents and IDEs can call

`MCPServer` wraps a [FastMCP](https://github.com/jlowin/fastmcp) app as an ASGI endpoint. Tools defined in
Python become callable over the Model Context Protocol from Claude, Cursor, or your own agents, running on the
cluster with the image, secrets and GPU you give it.

```python server.py theme={null}
from fastmcp import FastMCP
from levers9 import Blueprint
from levers9.integrations import MCPServer

mcp = FastMCP("levers-tools")

@mcp.tool()
def word_count(text: str) -> int:
    return len(text.split())

server = MCPServer(
    mcp,
    name="tools",
    cpu=1, memory="512Mi",
    image=Blueprint(python_version="python3.11", python_packages=["fastmcp"]),
    secrets=["OPENAI_API_KEY"],
    authorized=True,                   # clients send the workspace token
)
```

```bash theme={null}
levers9 serve server.py:server         # a temporary URL while you build
levers9 deploy server.py:server --name tools
claude mcp add --transport http tools <the URL>/mcp \
  --header "Authorization: Bearer <workspace token>"
```

`levers9 deploy` prints the URL; FastMCP's streamable HTTP transport answers at `/mcp` under it, and clients
send the workspace token as a bearer header. A JSON client config carries the same header:

```json theme={null}
{ "mcpServers": { "tools": { "url": "<the URL>/mcp",
                             "headers": { "Authorization": "Bearer <workspace token>" } } } }
```

Pass `authorized=True` every time. The server holds your secrets and maybe a GPU, and a public one lets anyone
with the URL call every tool. `authorized=False` makes it public on purpose, for example for a client that can't
send a header. If you leave it out, the server is public, as it always was, and deploy and serve warn you; a
later release makes `True` the default. `MCPServerArgs(fastmcp_version="2.7.1")` pins the FastMCP release
installed in the image.

Everything from [Parameters](https://levers9.mintlify.site/sdk/parameters.md) applies: `keep_warm_seconds`, `autoscaler`, `volumes`, `gpu`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.