Skip to main content

Self-Host in 5 Minutes with stoactl

Get a local MCP Gateway running and bridge your first REST API β€” no cloud account needed.

What You'll Build​

By the end of this guide, you'll have:

  • A running STOA MCP Gateway (Docker)
  • An OpenAPI spec automatically converted to MCP tools
  • AI-callable tools registered on your local gateway

Prerequisites​

Install stoactl​

Legacy install channels

Do not use go install github.com/stoa-platform/stoactl@latest (frozen standalone repository at v0.3.0), brew install stoa-platform/tap/stoactl (outdated Homebrew tap formula 0.1.1 and cask 0.3.0), or https://get.gostoa.dev (legacy bootstrap URLs). Monorepo GitHub Releases stoa-go-v0.3.9 and stoa-go-v0.3.10 publish zero binary assets; build stoactl from a verified monorepo checkout instead.

git clone https://github.com/stoa-platform/stoa.git
cd stoa
git checkout stoa-go-v0.3.10
cd stoa-go
make install # installs stoactl into GOBIN if set, otherwise $(go env GOPATH)/bin

Ensure GOBIN (or $(go env GOPATH)/bin when GOBIN is unset) is in your PATH, then verify the installation:

stoactl version

Step 1: Initialize a Project​

stoactl init my-api
cd my-api

This creates a complete project scaffold:

my-api/
β”œβ”€β”€ docker-compose.yml # Gateway + echo backend
β”œβ”€β”€ stoa.yaml # Gateway configuration
β”œβ”€β”€ echo-nginx.conf # Echo backend (returns static JSON)
β”œβ”€β”€ example-api.yaml # Example OpenAPI spec
β”œβ”€β”€ tools/ # Output directory for bridge
└── README.md # Project-specific instructions

Step 2: Start the Gateway​

docker compose up -d

Wait a few seconds for the gateway to start, then verify:

stoactl doctor

You should see all checks passing:

STOA Doctor

βœ“ Docker: running (v27.x)
βœ“ Gateway: healthy (http://localhost:8080/health)
βœ“ Port 8080: available
...

Step 3: Bridge an API to MCP​

The project includes an example-api.yaml (OpenAPI 3.0 spec) with 3 operations. Convert it to MCP tools:

stoactl bridge example-api.yaml --namespace default --output ./tools/

Output:

βœ“ Parsed OpenAPI 3.0 spec: my-api API (3 operations)
βœ“ Generated 3 Tool CRDs β†’ ./tools/
- list-items.yaml
- create-item.yaml
- get-item.yaml

Preview what was generated​

Each file in tools/ is a valid Tool CRD:

cat tools/list-items.yaml
apiVersion: gostoa.dev/v1alpha1
kind: Tool
metadata:
name: list-items
namespace: default
labels:
generated-by: stoactl-bridge
spec:
displayName: List all items
endpoint: http://echo:8888/items
method: GET
inputSchema:
type: object
properties:
limit:
type: integer
maximum: 100
default: 20
timeout: 30s
enabled: true

Step 4: Register Tools with the Gateway​

Apply each generated tool to the running gateway:

for f in tools/*.yaml; do stoactl apply -f "$f"; done

Verify tools are registered:

stoactl get tools

Step 5: Test via MCP​

Call the gateway's MCP endpoint to list available tools:

curl -s http://localhost:8080/mcp/v1/tools | jq .

Invoke a tool:

curl -s http://localhost:8080/mcp/v1/tools/invoke \
-H "Content-Type: application/json" \
-d '{"name": "list-items", "arguments": {"limit": 5}}' | jq .

Bridge Your Own API​

Replace the example spec with your own OpenAPI 3.x file:

# Use your own spec
stoactl bridge your-api.yaml --namespace default --output ./tools/

# Filter specific operations by tag
stoactl bridge your-api.yaml --namespace default --include-tags payments

# Override the backend URL
stoactl bridge your-api.yaml --namespace default --server https://api.internal.com

# Preview without writing files
stoactl bridge your-api.yaml --namespace default --dry-run

Bridge flags reference​

FlagDescriptionDefault
--namespaceTarget namespace for tools (required)β€”
--outputOutput directory for YAML files./tools/
--serverOverride servers[0].url from specFrom spec
--auth-secretK8s secret name for authβ€”
--include-tagsOnly include operations with these tagsAll
--exclude-tagsExclude operations with these tagsNone
--include-opsOnly include these operationIdsAll
--timeoutDefault timeout for tools30s
--dry-runShow summary without writing filesfalse

What's Next?​

FAQ​

What is stoactl?​

stoactl is a kubectl-style CLI for managing STOA Platform resources. It provides project scaffolding (init), API-to-MCP bridging (bridge), diagnostic checks (doctor), and resource management (apply, get, delete).

Can I bridge any REST API?​

Yes. Any API with an OpenAPI 3.0 or 3.1 specification can be bridged to MCP tools. Each path+method operation becomes a separate MCP tool with its parameters mapped to the tool's input schema.

Do I need a STOA cloud account?​

No. The self-hosted setup with stoactl init + Docker is completely standalone. You can optionally connect to the hosted STOA Platform later for multi-tenant management, observability, and team features.

Cookies and privacy

With your permission, we use cookies to measure visits and understand navigation to improve the site.

Learn more

Google Analytics measures visits and useful clicks. Microsoft Clarity provides masked interaction replays. No advertising use. Your choice is saved for six months. You can change or withdraw it at any time using the β€œCookies” button.

Read the audience measurement details