mcp

v1.0.0
@un-static/mcp Checked 4 days ago Published 16 days ago

MCP server for Un-static Forms

An MCP (Model Context Protocol) server for Un-static Forms. It exposes 8 tools that let an AI assistant create and manage Un-static form endpoints, fetch submissions, and generate ready-to-paste HTML snippets. update_form covers the full spam/redirect surface an agent needs: The notification email address is set at creation time and cannot be changed via the API.

Summary extracted from the README.

@un-static/mcp

An MCP (Model Context Protocol) server for Un-static Forms. It exposes 8 tools that let an AI assistant create and manage Un-static form endpoints, fetch submissions, and generate ready-to-paste HTML snippets.

Tools

Tool Token required Description
create_form No (optional) Create a form endpoint. With a token, creates an account-linked form. Without a token, creates an anonymous form (requires accept_privacy_terms=true).
list_forms Yes List all form endpoints in the authenticated account.
get_form Yes Get settings (including captcha provider and auto-response) and stats for a specific form.
get_submissions Yes Fetch recent submissions for a form: id, timestamp, status, reason, referrer, submitted fields and file attachments with download links. limit (default 50, max 200) and include_spam (default false) control the page; sample=true returns the small webhook-shaped preview (up to 3) instead.
update_form Yes Update settings on a form you own: success redirect, captcha provider + keys, honeypot field, reply-to field, and auto-response.
delete_form Yes Soft-delete a form you own.
whoami Yes Return the authenticated account info: username, plan, limits.
get_form_snippet No Generate ready-to-paste HTML for a form, with up to 100 fields.

Configuring spam protection and redirects

update_form covers the full spam/redirect surface an agent needs:

  • Captcha provider: captcha_provider selects the widget (recaptcha, turnstile, hcaptcha, or off to disable). To use your own keys, set captcha_provider and pass your secret in recaptcha_secret; leave recaptcha_secret as "" to use the platform (Un-static managed) keys for that provider. When switching providers, always send recaptcha_secret in the same call (your new secret, or "" for platform keys): changing captcha_provider on its own keeps any previously stored secret, which would then belong to the wrong provider.
  • Captcha site key: captcha_site_key passes your public captcha site key matching recaptcha_secret, or "" to clear. Only valid together with an own secret. Un-static then renders its protection page and test form with your keys. It is cleared automatically when you switch back to platform keys.
  • Honeypot: honeypot_field names a decoy field; submissions that fill it are silently dropped.
  • Reply-to: reply_to_field names the submitted field to use as the reply-to address on notification emails.
  • Success redirect: success_redirect is where visitors land after a successful submit.
  • Auto-response: auto_response_enabled with auto_response_subject / auto_response_body / auto_response_from_name sends submitters a confirmation email.

The notification email address is set at creation time and cannot be changed via the API.

Usage

Local (stdio, for desktop MCP clients)

Add this to your MCP client config (Claude Desktop, Cursor, etc.):

{
  "mcpServers": {
    "un-static": {
      "command": "npx",
      "args": ["-y", "@un-static/mcp"],
      "env": { "UNSTATIC_API_TOKEN": "your-token-here" }
    }
  }
}

The server reads UNSTATIC_API_TOKEN from the environment at startup and uses it for all requests in that session.

Hosted (Streamable HTTP)

A hosted instance is planned at https://mcp.un-static.com/mcp (not yet available; the URL is confirmed when it launches). Once it is live, point any MCP client that speaks Streamable HTTP at it and send your own token:

{
  "mcpServers": {
    "un-static": {
      "type": "http",
      "url": "https://mcp.un-static.com/mcp",
      "headers": { "Authorization": "Bearer your-token-here" }
    }
  }
}

To run the same entry yourself:

npm run start:http
# or
node dist/http.js

The server listens on PORT (default 3000) at POST /mcp, and answers GET /healthz with 200 {"ok":true} for load balancer and deploy checks.

Each request is authenticated by its own Authorization: Bearer <token> header only, so a single hosted instance can serve many accounts. The HTTP entry never falls back to UNSTATIC_API_TOKEN from the server's environment. A request without a bearer runs at the anonymous tier, exactly like stdio without a token: get_form_snippet works and the account tools return the "needs an API token" error. It is not a 401. On the hosted endpoint every anonymous request reaches the API from the same address, so anonymous create_form calls there share one form-creation throttle across all callers and can be refused when others are creating forms at the same time. Calls with a token are unaffected. Use a token, or the stdio server, to create forms.

Note for hosted clients: The SDK's Streamable HTTP transport requires clients to send Accept: application/json, text/event-stream on every request, the server returns 406 Not Acceptable otherwise.

Configuration

Environment variable Default Description
UNSTATIC_API_TOKEN (none) Optional, stdio only. Enables account-management tools and account-linked form creation. Get one at https://forms.un-static.com/api-tokens. The HTTP entry ignores it.
UNSTATIC_API_BASE https://forms.un-static.com Override the API base URL (useful for self-hosting or testing). Read by both entries.
PORT 3000 HTTP entry only. The port node dist/http.js listens on.

Tiered authentication

  • No token needed: get_form_snippet always works. create_form works without a token but creates an anonymous form (managed via an admin link emailed to you) and requires accept_privacy_terms=true.
  • Token required: list_forms, get_form, get_submissions, update_form, delete_form, and whoami all require a valid API token. If no token is configured, they return a descriptive error with a link to create one.
  • Token + create_form: When a token is present, create_form creates an account-linked form that is manageable via the other API tools.

Security notes

  • Your API token grants full account access. Treat it like a password. Do not commit it to source control.
  • get_submissions returns submitter-provided content (names, emails, messages, referrer URLs, file links) into the AI context. Review this before sharing sessions. Submitter IP addresses are never exposed through this tool.

Submission status vocabulary

get_submissions returns a status and a reason per submission. A fresh form normally has exactly one test row, written by the onboarding test send; it is returned like any other submission, so filter on status if you only want real traffic.

Status Reason values Meaning
passed "", redelivered, released_on_credit_pack Delivered to the form owner.
failed inactive_address, rate_limited, attachment_storage_failed, mail_transport_error, failed_to_send Stored, but not delivered.
over_limit over_hard_limit Held because the plan ceiling was reached.
test test_submission The onboarding test send.
spam honeypot_filled, content_in_blacklist Caught by the spam filter. Only returned when include_spam is true.

Getting a token

Visit https://forms.un-static.com/api-tokens to create an API token.

Development

Build and run the unit tests:

npm install
npm run build
npm test

Smoke test

npm run smoke drives every tool through the in-memory transport against a running Un-static instance. It is a manual developer script, not part of CI. It creates a real account-linked form, reads it back, updates spam/redirect settings, fetches a submissions sample, generates a snippet, and deletes the form again.

UNSTATIC_API_BASE=http://localhost:8000 \
UNSTATIC_API_TOKEN=your-dev-token \
npm run smoke

Creating a form sends an activation email, so the write path needs the target instance to have working mail (Postmark) credentials configured.