Asynchronous FastMCP server for Poke. It exposes exactly one tool: orchestrate.
The tool stores subagent definitions in PostgreSQL, selects an execution path,
and sends the final result back to Poke via webhook callback.
- MCP entrypoint:
src/server.py - Orchestrator + execution logic:
src/agent.py - Postgres persistence:
src/db.py - Poke callback sender:
src/poke.py - Templates:
src/templates/*.json
- Poke invokes MCP tool
orchestrate(task_description). - Server returns immediate ack (
{"status": "accepted", ...}) and starts a background job. - Orchestrator queries PostgreSQL
subagentstable. - It routes to one of:
match: run an existing DB subagenttemplate: load matching JSON templatebuild_new: persist a generated subagent and ask user to retry
- Subagent execution streams through Claude Agent SDK with headless permissions.
- Result is POSTed back to Poke callback.
DATABASE_URL: Render PostgreSQL connection string (required in deployment)POKE_API_KEY: callback auth token for PokePOKE_WEBHOOK_URL: optional override for Poke inbound webhook URLPOKE_DRY_RUN: set to1for local non-network callback testsPOKESTRATOR_AGENT_TIMEOUT: Claude execution timeout in seconds (default90)DB_POOL_MIN_SIZE: minimum DB connections in asyncpg pool (default1)DB_POOL_MAX_SIZE: maximum DB connections in asyncpg pool (default5)LOG_LEVEL: logging verbosity (defaultINFO)
Optional DB tuning:
Render compatibility note: postgres:// and postgresql:// URLs are both accepted.
pip install -r requirements.txt
python src/server.pyA lightweight React dashboard is included under frontend/ to visualize live
orchestrator/subagent activity from the runtime log file.
cd frontend
npm install
npm run devOpen http://localhost:5173 while the MCP server is running.
Notes:
- The frontend polls
/api/demo-stateevery ~1.2 seconds. - The API is served by Vite middleware and parses
logs/pokestrator.logby default. - Override log source with
POKESTRATOR_LOG_FILE(absolute path or workspace-relative).
render.yaml already includes a web service and startup command.
- Add a Render PostgreSQL service to your project.
- Set one of these env vars on the web service:
DATABASE_URL,POSTGRES_URL,POSTGRESQL_URL,RENDER_DATABASE_URL,DB_URL. - Set
POKE_API_KEYandPOKE_WEBHOOK_URLin web service env. - Deploy.
Verification after deploy:
- In web logs:
PostgreSQL initialized and subagents table is ready(or acceptable:database init failed...if running degraded mode for local fallback). - In logs for live runs:
acceptedrequest logs followed by callback status.
Server endpoint should be reachable at:
https://<your-service>.onrender.com/mcp
- Confirm the Postgres service is
Runningin Render. - Copy the external/managed connection URL and set it as
DATABASE_URLin the web service. - Confirm migrations are auto-created on boot; no manual DDL is required.
- Use
POKE_DRY_RUN=1for local or Render logless smoke checks if needed.
- The repository is intentionally minimal; template and dynamic subagent behavior is a starting implementation.
build_newbranch persists generated subagents so future matching can improve quickly.