Skip to main content
Glama
README.md
# formchime

formchime is a small local bridge to Formgong's hosted
MCP server, which manages contact forms for a website:
create a form, paste the ready-made embed snippet into
a page, read the submissions that arrive, and wire
webhooks so each new submission is also posted to your
own endpoint as signed JSON.

The bridge keeps no workspace of its own. It serves the
upstream server's tool list locally, exactly as captured
from the live endpoint, and forwards each tool call
upstream, returning the result untouched. Form and
webhook changes act on the caller's own Formgong
workspace; the listing and submission tools only read.

## Tools

- `list_forms` — every form owned by the account: id,
  name, public access key (`fk_…`) and submissions this
  month. The access key goes in the form's hidden
  `access_key` field. No arguments.
- `create_form` — create a new form. Required: `name`
  (shown in the dashboard and email subject, 1-80
  chars). Optional: `notify_email` (default true).
  Returns the form id and public access key.
- `get_form_snippet` — ready-to-paste form code for one
  form, with its access key, hidden `_lang` field,
  botcheck honeypot and Turnstile widget when enabled.
  Required: `form_id`. Optional: `framework` (`html`,
  `react` or `next`, default `html`) and `lang`.
- `list_recent_submissions` — the most recent
  submissions of one form: id, time and submitted
  fields only, no IP or browser data. Required:
  `form_id`. Optional: `limit` (1-50, default 10) and
  `include_spam` (default false).
- `list_webhooks` — the webhook URLs of one form: id,
  url and created time. Required: `form_id`.
- `create_webhook` — add a public HTTPS URL to one
  form; every new submission is then POSTed there as
  JSON with an `X-Signature` header (HMAC-SHA256 of the
  raw body, keyed with the form's signing key).
  Required: `form_id` and `url`. Returns the webhook id
  and the signing key.
- `delete_webhook` — remove one webhook from a form;
  submissions stop being sent to its URL. Required:
  `form_id` and `webhook_id`.
- `list_website_templates` — Formgong's free,
  MIT-licensed website templates, each with a contact or
  quote form already wired to Formgong. Optional:
  `topic` (`trades`, `consulting`, `portfolio`,
  `construction`, `health`, `food` or `shops`).

## Configuration

- `FORMGONG_MCP_URL` (optional) — override the upstream
  endpoint. Defaults to `https://formgong.com/mcp`.
  (The override hook is this rebuild's own labelled
  reconstruction.)
- `FORMGONG_API_KEY` (optional) — when set, every
  upstream request carries an
  `Authorization: Bearer <key>` header, for clients
  using a personal API token instead of OAuth. When it
  is not set, no auth header is sent; the original
  surface was captured keyless. (This forwarding is
  also a labelled reconstruction.)

### Forwarding mechanics

On the first tool call the client opens a streamable
HTTP session with the upstream: a JSON-RPC `initialize`
request (protocolVersion `2025-03-26`, clientInfo name
`formchime`), then a `notifications/initialized`
notification, then the `tools/call` request carrying
the caller's arguments unchanged. When the upstream
answers `initialize` with an `Mcp-Session-Id` header,
that value rides on every later request of the session,
which is reused for the life of the process. Replies
may arrive as plain JSON or as server-sent events;
both are read.

Successful upstream results pass through verbatim,
including any `isError` flag the upstream sets.
Failures — a JSON-RPC error, a non-2xx status, an
unreadable response, or a request that cannot be
completed — come back as an `isError` result whose
text starts with `formchime error:` (this rendering
is this rebuild's own labelled reconstruction).

## CLI

Each tool is also a subcommand taking one JSON argument
string (omit it for tools that take none):

```bash
npx @reneturcios/formchime list_forms
npx @reneturcios/formchime create_form '{"name":"Contact – acme.com"}'
npx @reneturcios/formchime get_form_snippet '{"form_id":"f_123","framework":"react"}'
npx @reneturcios/formchime list_recent_submissions '{"form_id":"f_123","limit":5}'
npx @reneturcios/formchime create_webhook '{"form_id":"f_123","url":"https://example.com/hook"}'
npx @reneturcios/formchime --version
```

Exit codes: `0` on success, `1` on an `isError`
result, `2` on a usage error.

## MCP server

```bash
npx -y @reneturcios/formchime mcp
```

MCP client config:

```json
{
  "mcpServers": {
    "formchime": {
      "command": "npx",
      "args": ["-y", "@reneturcios/formchime", "mcp"]
    }
  }
}
```

## Docker

```bash
docker run -i ghcr.io/cloudcorprecords/formchime
docker run --rm ghcr.io/cloudcorprecords/formchime --version
```

The container's default command is `mcp`, so the first
form is a stdio MCP server; any other arguments reach
the CLI normally.

## Development

```bash
npm install
npm run build
npm test
npm run dev
```

The test suite runs entirely against a stubbed
JSON-RPC upstream — no live network calls.

## License

MIT — see `LICENSE`.