AgentAPIGate
Sunset Migration Blueprint · Dec 10 Read-Only → Jan 10, 2027 Shutdown

Val Town MCP & Webhook Alternative: Complete Migration Blueprint Before Jan 10, 2027

If your Claude Desktop / Cursor agents rely on custom api.val.town/v3/mcp tools or incoming *.val.run webhook receivers, you have two hard deadlines: December 10, 2026 (read-only code lock) and January 10, 2027 (permanent runtime shutdown). Here is the step-by-step export and zero-server replacement guide.

Verified Val Town Shutdown Schedule

Cited Timeline · Official Val Town Sunset Announcement (Steve Krouse, val.town)
  • Nov 10, 2026: Val Town ended new account signups and paused billing.
  • Dec 10, 2026 (8 days away): All Val Town code becomes read-only (no further edits to vals or env vars).
  • Jan 10, 2027 (39 days away): All *.val.run HTTP endpoints, scheduled crons, email triggers, and hosted MCP servers stop running permanently.
  • Feb 1, 2027: Val Town open-sources the platform codebase.
Step 1 · Execute Before Dec 10, 2026 Read-Only Lock

1. Export Vals, SQLite Tables, Blobs, Crons, Email Triggers & Secrets

Inspect your MCP inventory via https://api.val.town/v3/mcp and run the backup script below to archive every val, std/sqlite table, and std/blob object locally. Note that environment secret values cannot be exported via read API after shutdown—audit your secret keys in val.town/settings/environment-variables and rotate or copy them from their upstream dashboards immediately.

#!/usr/bin/env node
// Run BEFORE Dec 10, 2026 read-only lock (requires VAL_TOWN_API_KEY)
import fs from 'node:fs/promises';

const TOKEN = process.env.VAL_TOWN_API_KEY;
if (!TOKEN) throw new Error('Export VAL_TOWN_API_KEY from val.town/settings/api-tokens first');
const headers = { Authorization: `Bearer ${TOKEN}`, Accept: 'application/json' };

await fs.mkdir('./valtown-backup/blobs', { recursive: true });

// 1. Export all Vals (HTTP *.val.run handlers, scheduled crons, email triggers, MCP vals)
const valsRes = await fetch('https://api.val.town/v2/me/vals?limit=100', { headers });
const valsJson = await valsRes.json();
await fs.writeFile('./valtown-backup/vals.json', JSON.stringify(valsJson, null, 2));

// 2. Dump std/sqlite schema & rows
const tablesRes = await fetch('https://api.val.town/v1/sqlite/execute', {
  method: 'POST',
  headers: { ...headers, 'Content-Type': 'application/json' },
  body: JSON.stringify({ statement: "SELECT name, sql FROM sqlite_master WHERE type='table'" }),
});
const tables = await tablesRes.json();
await fs.writeFile('./valtown-backup/sqlite-schema.json', JSON.stringify(tables, null, 2));

// 3. Export std/blob keys & contents
const blobsRes = await fetch('https://api.val.town/v1/blob', { headers });
const blobs = await blobsRes.json();
for (const item of Array.isArray(blobs) ? blobs : []) {
  const r = await fetch(`https://api.val.town/v1/blob/${encodeURIComponent(item.key)}`, { headers });
  await fs.writeFile(`./valtown-backup/blobs/${item.key.replace(/\//g, '__')}`, Buffer.from(await r.arrayBuffer()));
}
console.log('Backup complete -> ./valtown-backup/');
Val Town PrimitiveJan 10, 2027 ImpactRecommended Zero-Ops Replacement
api.val.town/v3/mcpHosted MCP endpoint terminateshttps://mcp.agentapigate.ai/mcp?mode=lazy (400+ live data & entity tools)
*.val.run webhooksNo URL redirect survives shutdownRe-point senders to agent.webhook.inbox_create (pull) or 15-line CF Worker (push)
Scheduled Cron ValsCron scheduler haltsGitHub Actions on.schedule + AgentAPIGate REST / /alerts fan-out
@valtown.email triggersInbound MX stops accepting mailCloudflare Email Routing Worker → webhook or queue
Step 2 · Replace Custom API Wrapper Vals

2. Drop-In Remote MCP Replacement (400+ Live APIs, 1 Key)

Most developer MCP vals wrapped SERP, YouTube transcripts, Reddit threads, SEC filings, domain WHOIS, or social feeds. Instead of maintaining separate upstream keys and Deno glue code, mount our lazy-discovery Remote MCP hub (<800 schema tokens) with a scoped aag_agent_* daily USD spend-cap sub-key:

{
  "mcpServers": {
    "agentapigate-hub": {
      "url": "https://mcp.agentapigate.ai/mcp?mode=lazy",
      "headers": {
        "Authorization": "Bearer aag_agent_YOUR_SCOPED_SUBKEY"
      }
    }
  }
}
Step 3 · Incoming Webhook Migration

3. Replacing *.val.run Webhooks Without Running a Public Server

Critical Cutover Rule (Zero Redirects After Jan 10): Once *.val.run shuts down on January 10, 2027, HTTP POSTs sent to old https://username-handler.val.run URLs will fail at DNS/TLS—no forwarding rule can rescue un-updated senders. Audit every third-party webhook dashboard (Stripe, GitHub, Linear, Shopify, Slack, Resend) and update the destination URL directly before Jan 10.

Option A: NAT-Friendly 7-Day Pull Inbox (agent.webhook.inbox_create + agent.webhook.pull)

For local Claude Code agents, desktop scripts behind NAT, or scheduled GitHub Actions jobs that do not expose a public HTTPS port, create a durable PostgreSQL-backed webhook inbox. Senders POST to https://api.agentapigate.ai/v1/webhooks/ingest/<inbox_id>, and your agent pulls buffered events on demand:

# Step 1: Create a 7-day durable webhook inbox ($0.001)
curl -sS -X POST https://api.agentapigate.ai/v1/agent/webhook/inbox_create \
  -H "Authorization: Bearer $AGENTAPIGATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"github-and-stripe-events"}'

# Returns:
# {
#   "inbox_id": "whi_9f82c4...",
#   "ingest_url": "https://api.agentapigate.ai/v1/webhooks/ingest/whi_9f82c4...",
#   "read_token": "whrt_...",
#   "expires_at": "2026-12-09T..."
# }
# -> Re-point your 3rd-party sender (GitHub / Stripe / Linear) directly to ingest_url!

# Step 2: Pull buffered events from local Claude Code, laptop, or GitHub Actions cron
curl -sS "https://api.agentapigate.ai/v1/agent/webhook/pull?inbox_id=whi_9f82c4...&limit=20" \
  -H "Authorization: Bearer $AGENTAPIGATE_API_KEY"
Push-to-Pull Latency & Retention Tradeoffs

• Polling Latency vs. Push: Unlike a synchronous *.val.run handler (~50–150ms push execution), a pull inbox introduces your chosen poll interval (typically 5s–60s for local daemons or 5m for GitHub Actions crons) and always returns 202 Accepted to the sender.

• Retention & Payload Window: Events are retained in PostgreSQL for 7 days (up to 256 KB raw body per event with full Stripe-Signature / X-Hub-Signature-256 headers preserved for local HMAC verification).

Option B: Synchronous <50ms Edge Responder (15-Line Cloudflare Worker)

If your webhook sender requires a custom synchronous response body (such as Slack url_verification challenges or sub-100ms interactive bot callbacks), deploy this 15-line Cloudflare Worker on the free tier:

// 15-Line Cloudflare Worker for synchronous (<50ms) challenge/HMAC webhooks
export default {
  async fetch(req, env) {
    if (req.method !== 'POST') return new Response('Method Not Allowed', { status: 405 });
    const sig = req.headers.get('x-hub-signature-256') || req.headers.get('stripe-signature') || '';
    const rawBody = await req.text();
    const payload = JSON.parse(rawBody || '{}');
    // Handle synchronous handshake challenges (e.g. Slack url_verification)
    if (payload.type === 'url_verification' && payload.challenge) {
      return Response.json({ challenge: payload.challenge });
    }
    await env.EVENTS_KV.put(`ev:${Date.now()}`, JSON.stringify({ sig, rawBody }), { expirationTtl: 604800 });
    return Response.json({ ok: true, received: true });
  },
};