Skip to main content

foro (Python)

PyPI Python License: MIT

The Python SDK and CLI for foro.sh — the fastest path from "I want to build an MCP server" to a deployed https://<slug>.foro.sh URL.

Quickstart

uvx foro init my-server && cd my-server
uvx foro dev

foro init scaffolds a working FastMCP server; foro dev runs it exactly as foro.sh will and confirms it would pass the platform's health check. Once it looks good:

git init && git add -A && git commit -m "init" && gh repo create --push

Then, on the foro.sh dashboard: sign in with GitHub, pick the repo, add any secrets your tools need, and deploy.

CLI

Install once with uv tool install foro, or run ad-hoc with uvx foro ... — no need to add it to your project's own dependencies.

Command What it does
foro init [name] Scaffold a new project, or record an existing one's foro settings in its pyproject.toml (run with no argument). --yes takes every default without prompting, for CI and coding agents
foro check [path] Validate a repo against foro.sh's deploy contract before you push
foro dev [path] Run the server locally exactly as foro.sh will, and confirm it would pass the health check
foro verify <url> Prove a deployed server actually serves MCP, by opening a session and listing its tools
foro auth <login|status|logout|token> Sign in to foro.sh, so the CLI can act on your behalf

foro check mirrors the platform's own validation rule for rule, so a repo it passes will deploy and one it flags will not — the same reason code, surfaced locally instead of as a 60-second health-check timeout.

foro verify applies foro dev's standard to a deployed server: a URL that answers HTTP is not the same as one serving MCP, and a green deploy only means the container passed a TCP probe. It runs the same handshake foro dev does — initialize, then tools/list — and exits non-zero when that fails, so a script or a CI step can branch on it.

$ foro verify https://swift-harbor-a3f2.foro.sh
✓ https://swift-harbor-a3f2.foro.sh/mcp is serving MCP
Tools: get_forecast, list_cities

The /mcp path is appended when you leave it off, so the URL foro deploy printed works as-is.

Signing in

init, check and dev are entirely local and need no account. foro auth is for everything that talks to foro.sh:

$ foro auth login
! First copy your one-time code: 7A2F-K9QP
Press Enter to open foro.sh in your browser...
- Waiting for authorization... 6s
✓ Logged in as danielsteman (workspace: acme)

A browser approves the code, the CLI polls until you do — the same device flow gh auth login uses, so it works over SSH where a loopback redirect wouldn't.

  • The token is workspace-scoped, picked when you approve it. Access to a second workspace means logging in again for a second token; there is no workspace-switch command.
  • foro auth status validates against the API rather than reporting that a file exists, so a revoked token shows as broken. It exits 1 when you aren't authenticated, which is what a script should branch on.
  • foro auth logout revokes the token server-side and deletes it here. If revocation fails it still deletes locally and tells you to finish the job on /account.
  • foro auth token prints the raw token and nothing else, for curl -H "Authorization: Bearer $(foro auth token)".

Credentials live in ~/.config/foro/hosts.yml ($XDG_CONFIG_HOME is honoured; %APPDATA%\foro on Windows) at mode 0600, keyed by host. Two environment variables override it:

Variable Effect
FORO_TOKEN Use this token instead of the stored one, and never write it to disk — the GH_TOKEN convention. foro auth status says when it's in play
FORO_HOST Point the CLI at another instance (localhost:3001 for a native dev stack). Defaults to foro.sh

For CI, skip the browser entirely:

$ echo "$FORO_TOKEN" | foro auth login --with-token

Runtime

One import, used from your server's entrypoint:

from fastmcp import FastMCP
import foro

mcp = FastMCP("my-server")

@mcp.tool
def add(a: int, b: int) -> int:
    return a + b

if __name__ == "__main__":
    foro.run(mcp)  # streamable HTTP, host 0.0.0.0, port $PORT - identical locally and deployed
Function What it does
foro.run(server, *, port=None) The one correct way to start a server for foro.sh. Accepts any FastMCP-shaped server (standalone fastmcp.FastMCP, mcp.server.fastmcp.FastMCP, or a low-level Server) — it's duck-typed, not tied to a specific class.
foro.secret(name) Read a required secret from the environment, raising a dashboard-actionable error if it's missing. Set secrets in your project's Secrets tab on the dashboard; they arrive as env vars at deploy time.

Bare foro (what a deployed container installs — no [cli] extra) stays dependency-free, so a deployed container never pulls in CLI tooling it doesn't use.

Project config

There is no foro-specific manifest. A repo's pyproject.toml (Python) or package.json (Node) already names the project and points at the file that starts it, and that is what foro.sh reads:

What foro needs Python Node
display name [project].name name
runtime a pyproject.toml is here a package.json is here
interpreter version requires-python, resolved to the newest supported version it allows engines.node, same
entry file server.py, main.py, src/server.py or app.py main, then bin, then index.js
dependency manager the lockfile (uv, PDM, Poetry, pipenv, requirements.txt) the lockfile (npm, pnpm, yarn)

The rest is optional, and only for what those files can't say:

# pyproject.toml - every key optional, most projects have no such table
[tool.foro]
entrypoint = "cmd/serve.py"   # only when it isn't one of the names above
runtime_version = "3.13"      # only to pin against what requires-python allows
port = 9000                   # only when your server can't listen on $PORT
dependency_manager = "poetry" # only when a repo is genuinely ambiguous
// package.json - the same keys, under "foro"
{ "foro": { "port": 9000 } }

At runtime the container gets PORT and every project secret as its own env var. Public traffic arrives at https://<slug>.foro.sh, so your server must listen on 0.0.0.0:$PORT — which is exactly what foro.run() does for you.

Example

foro-sh/todo-mcp is a small stateful todo-list server built the way described above — every new foro.sh workspace gets a deployed copy of it to poke at before deploying anything of your own.

Develop this package

uv sync
uv run pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foro-0.11.0.tar.gz (398.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

foro-0.11.0-py3-none-any.whl (45.8 kB view details)

Uploaded Python 3

File details

Details for the file foro-0.11.0.tar.gz.

File metadata

  • Download URL: foro-0.11.0.tar.gz
  • Upload date:
  • Size: 398.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for foro-0.11.0.tar.gz
Algorithm Hash digest
SHA256 4df6ab4b98985c361bc428a756d7cc85ca2a5c0ec86c5347b188154d6d3dd417
MD5 f25f243c640d3ae1628dbae498435329
BLAKE2b-256 31711a266324c2d26354c55bc063851197ddb635f04a6bb3bd62a7c93502953d

See more details on using hashes here.

Provenance

The following attestation bundles were made for foro-0.11.0.tar.gz:

Publisher: semantic-release.yml on foro-sh/foro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file foro-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: foro-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 45.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for foro-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a859688abc7e0a6d1cd34c18d12e9b2cbf46837fb84884ac42705de363c1284
MD5 0a58b964fb0fe8d0585d06f527ed30e8
BLAKE2b-256 471c94f075d12a105d8e6c5679c129694bf92f4d22ccad3bdb957fb239732574

See more details on using hashes here.

Provenance

The following attestation bundles were made for foro-0.11.0-py3-none-any.whl:

Publisher: semantic-release.yml on foro-sh/foro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.12.2

2 files

0.12.1

2 files

This release

0.11.0 This release

2 files

0.10.0

2 files

0.9.3

2 files

0.9.1

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.4.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page