Skip to main content
The mcp-server template ships Python 3, Node.js 20, fastmcp, the reference mcp SDK, uvicorn, FastAPI, Flask, requests, httpx, and pydantic. Pick it when you need an isolated runtime to host or validate an MCP server — a PR-review tool, an internal-docs reader, a per-tenant agent tool surface, etc.

What you’ll learn

  • Picking template="mcp-server" so the MCP toolchain is already installed
  • Writing a tiny FastMCP server with one tool
  • Starting it as a background process and calling it over HTTP inside the sandbox

Prerequisites

Code

Expected output

The second block is the tools/call response — note the greet output inside result.content[0].text:
The server listens on 127.0.0.1 inside the sandbox — traffic stays entirely within the sandbox. To expose the MCP server to an external agent you’d typically run it behind an HTTPS reverse proxy or embed the tool via the declaw sandbox’s own commands.run.