Skip to content

Embassy (MCP Base)

Embassy (called MCP Bases in the app) is a single server (cmd/mcpbase) running beside a project on the customer's network. It converts OpenAPI-described HTTP APIs into tools at POST /mcp. Optional runner mode executes assigned agents locally using a local OpenAI-compatible model such as Ollama, or a configured cloud provider. Reports wait locally for operator approval; by default, no report reaches the platform without approval.

Flow

sequenceDiagram
    autonumber
    participant P as Agent Tale platform
    participant E as Embassy (customer network)
    participant A as Project API
    participant O as Operator (TUI)
    P->>P: Register MCP Base
    P->>E: Check (initialize + tools/list)
    P->>P: Assign agent (prompt copy, cron, max turns)
    E->>P: GET /api/v1/embassy/sync (API key)
    P-->>E: Assignments with prompt copies
    E->>A: Model tool-use execution
    E->>E: Save report (pending_approval)
    O->>E: approve_report (POST /admin/mcp)
    E->>P: POST /api/v1/embassy/reports (approved only)
    P-->>E: Accept with duplicate detection

Two directions, two requirements

Check, Tools and Case runs require platform access to Embassy's /mcp. Runner only needs outbound access from Embassy to the platform. Registration does not test connectivity.

Setup

The static binary is in services/mcpbase-service/cmd/mcpbase, with Dockerfile at services/mcpbase-service/Dockerfile. No database is required. Runner state uses STATE_DIR/assignments.json and reports/<uid>.json, which operators can inspect and back up. GET /health returns project name and tool count.

Basic

Environment variable Default Purpose
PROJECT_NAME Spec title Name returned by describe_project
UPSTREAM_BASE_URL — Local API; required unless a PATHFINDER_* source is enabled
SPEC_FILE — OpenAPI JSON/YAML file, tried first
SPEC_URL — Spec URL; otherwise probe upstream well-known paths
MCP_TOKEN — Bearer token platform must send to /mcp
PORT 8090 Listening port

tools/list derives operations from the spec; tools/call proxies the upstream with a 256 KiB response limit.

Discovery (optional)

Use PATHFINDER_DOCKER, PATHFINDER_DOCKER_HOST, PATHFINDER_DOCKER_HOST_GATEWAY, PATHFINDER_SCAN_CIDRS (your network only), PATHFINDER_SCAN_PORTS, PATHFINDER_PROJECT_DIR, PATHFINDER_ALLOW_CIDRS, PATHFINDER_CONCURRENCY (default 32). Legacy DISCOVER_* names remain supported, with PATHFINDER_* taking precedence.

When enabled, pathfinder_discover (formerly discover_services) scans Docker containers, project spec files and allowed ranges. POST /api/v1/mcp-bases/:id/discover returns candidates only; it does not register them automatically.

Runner (optional)

All three PLATFORM_* values are required to start the runner. Otherwise Embassy opens no platform connection and serves only /mcp and /health.

Variable Default Purpose
PLATFORM_BASE_URL — Platform API root
PLATFORM_API_KEY — agst_ with read:assignments, submit:report
PLATFORM_BASE_ID — Registered MCP Base ID
STATE_DIR ./mcpbase-state Assignment/report files
SYNC_INTERVAL 5m Assignment sync
SCHEDULE_TICK 30s Check due assignments
LLM_PROVIDER Automatic openai or anthropic; blank uses OpenAI-compatible if LLM_BASE_URL exists, otherwise looks for Anthropic key
LLM_BASE_URL — OpenAI-compatible endpoint, for example http://localhost:11434/v1
LLM_MODEL — Model ID such as qwen2.5:14b; Anthropic haiku/sonnet/opus, default sonnet
LLM_API_KEY — Optional for OpenAI-compatible (blank omits Authorization); Anthropic falls back to CLAUDE_API_KEY, then ANTHROPIC_API_KEY
MAX_TOOL_TURNS 5 Default when assignment does not specify turns
MCP_ADMIN_TOKEN — Separate bearer token for POST /admin/mcp; blank disables the route and leaves reports pending
RUNNER_AUTO_APPROVE false true bypasses local approval; intentionally disabled by default

Create PLATFORM_API_KEY as the MCP Base's owner. The web dialog does not list these scopes; use authenticated POST /api/v1/user/api-keys with {"name":"...","scopes":["read:assignments","submit:report"]}. The first reporting key binds to the base; reports from another key are rejected.

Model choice determines data flow

Agent prompts and tool results go to the configured model. A local model keeps this traffic on your network; Anthropic or a remote OpenAI-compatible endpoint receives it externally. Runner startup fails if no model is configured.

Platform side

Web: Settings → Developer → MCP Bridge → Go to MCP Bases → (/settings/projects). TUI: MCP Bases, with n new, s assignments, p reports and l local approval.

Action Description
Add MCP Base Name, MCP URL (such as http://host:8090/mcp), optional OpenAPI fallback URL, auth header and encrypted token
Check Manual MCP initialize/tools/list, then well-known OpenAPI fallback; online/offline
Tools List/call via server proxy; browser never receives the auth token
Assignments Bind agents to Embassy
Reports Delivered approved reports: success/failed, summary, tool calls, approver, receipt time; read-only web view
Runner indicator Runner connected if synced within ten minutes, Runner stale if older, No runner if never synced

Assignment

  • Assign only agents you own or purchased. Web takes agent ID and optional cron.
  • Prompt is copied as prompt v1. Later agent edits do not change it. Explicit PUT /api/v1/mcp-bases/:id/assignments/:aid with resync_prompt: true updates it and increments the version.
  • Schedule: five-field cron, no seconds, UTC. Blank means manual-only. Invalid cron is rejected.
  • Max turns: default five, maximum 20. Web uses the default; API can override.
  • With Lore connected, sync prepends context. Delivered summaries enter agent memory; full reports, including tool calls, enter Lore documents.

Case runs

Select 2–5 registered Embassies. The platform introspects each and analyzes with an LLM asynchronously, charging your wallet.

Case Credits Output
Case 1 — Project Diff 3 Feature comparison: shared, compatible, incompatible, different
Case 2 — Endpoint Merge → MCP 5 Merged endpoints, project coverage and toolset opportunities

Optional on-chain attestation anchors the output hash of successful Case runs only. It never blocks the run and requires chain configuration.

Approval flow

stateDiagram-v2
    [*] --> pending_approval: Run completes
    pending_approval --> approved: approve_report
    pending_approval --> rejected: reject_report
    approved --> delivering: outbox
    delivering --> delivered: Platform accepts
    delivering --> dead: 12 attempts or 4xx
    dead --> approved: retry_report
  • pending_approval, rejected and dead are local-only. The platform sees delivered reports only.
  • Approval uses the separate POST /admin/mcp MCP server with MCP_ADMIN_TOKEN. Its tools are hidden from platform introspection and the local model.
  • Connect TUI with --embassy-url http://<embassy>:8090/admin/mcp --embassy-token <MCP_ADMIN_TOKEN>, AGENT_TALE_EMBASSY_URL / AGENT_TALE_EMBASSY_TOKEN, or config.toml [[embassies]]. Multiple Embassies show a selector first.
Tool Action
list_reports Summaries with optional status filter
get_report Full report with untruncated tool arguments/results
approve_report Approve pending report and queue delivery
reject_report Reject; never delivered
retry_report Requeue dead report with reset attempts
run_assignment Run now and wait for completion
list_assignments Synced assignments with next/last run
runner_status Assignment count, report counts by state, model

Delivery: the outbox retries exponentially from 30 seconds to 30 minutes, with ±20% jitter. After 12 attempts (about 2.5 hours) it becomes dead. Platform 4xx goes directly to dead, except 409 (already exists), which counts as delivered. Report IDs make retries idempotent. Every transition persists to disk for crash recovery. Platform limits: summary 8 KiB, output 256 KiB, up to 50 tool calls (64 KiB).

What approval sends

The report includes summary, output and every tool call's arguments and results. Inspect the full get_report before approval; that trace is delivered too.

Prompt-injection boundary

The agent prompt is the system instruction; tool output is supplied as user content, not a replacement instruction. The model sees only Embassy's own MCP tools.

Current capabilities and limits

Topic Today
OpenAPI HTTP API → MCP Supported
Direct source-code/database → tools Unsupported; HTTP OpenAPI only
Local agent execution Optional runner, local or configured cloud model
Send without approval Disabled by default (RUNNER_AUTO_APPROVE=false)
Send tool-call traces Included in approved reports
Outbound traffic Platform API, configured model and local upstream only
Embassy-to-Embassy communication Unsupported
Blockchain Platform-only optional Case attestation, never Embassy itself
Web approval Unsupported; TUI uses local approval, web shows delivered reports
Automatic health monitoring Unsupported; manual Check and last-sync indicator
Report templates, format validation, mobile approval Roadmap only

Roadmap

Planned, not available: format-validated report templates; two-company on-chain agreements (offer, acceptance, expiry); report-hash anchoring and recipient verification; encrypted direct Embassy delivery; tamper-evident audit log; mobile approval. A two-node proof of concept is planned first.

Related pages

Toolsets · Connectors · API keys · Lore