Skip to main content
Glama
README.md
# surveyloop

surveyloop is a small local bridge to the hosted
Inquira MCP server, which runs AI surveys end to end.
Describe a research goal and it generates a
professional survey for it; from there you can publish
the survey, share its link, read the responses that
come back, and ask for an AI analysis report with an
executive summary, key metrics, per-question insights
and action recommendations.

The bridge keeps no survey data 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.
The captured surface stops at returning a survey's own
share link: sending that link to anyone is the
caller's own act, and there is no outreach or sending
tool in it.

## Tools

- `create_survey` — generate a survey from a research
  goal. Required: `goal`. Optional: `lang` (one of
  `"en"`, `"zh"`, `"ja"`, `"es"`, `"pt"`; defaults to
  `"en"`) and `publish` (publish immediately after
  creation; defaults to false). Returns the survey ID
  and shareable link.
- `get_surveys` — list all surveys belonging to the
  authenticated user. Optional: `status` (one of
  `"all"`, `"published"`, `"draft"`; defaults to
  `"all"`).
- `get_responses` — get all responses submitted to a
  specific survey. Required: `survey_id`.
- `get_ai_report` — generate an AI analysis report for
  a survey's responses. Required: `survey_id`.
- `publish_survey` — publish a survey to make it
  accessible via its share link. Required:
  `survey_id`.
- `get_survey_link` — get the shareable link for a
  published survey. Required: `survey_id`.

## Configuration

- `INQUIRA_MCP_URL` (optional) — override the upstream
  endpoint. Defaults to
  `https://getinquira.com/api/mcp`. (The override hook
  is this rebuild's own labelled reconstruction.)
- `INQUIRA_API_KEY` (optional) — when set, every
  upstream request carries an
  `Authorization: Bearer <key>` header, for the
  caller's own Inquira key. When it is not set, no key
  header is sent. (The header name is pinned by the
  original's registry record; the Bearer scheme and
  this env forwarding are labelled reconstructions —
  the original surface was captured keyless.)

### 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 `surveyloop`), 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 `surveyloop error:` (this rendering
is this rebuild's own labelled reconstruction).

## CLI

Each tool is also a subcommand taking one JSON
argument string:

```bash
npx @reneturcios/surveyloop create_survey '{"goal":"Customer satisfaction survey for our SaaS product after onboarding","lang":"en"}'
npx @reneturcios/surveyloop get_responses '{"survey_id":"sv_123"}'
npx @reneturcios/surveyloop --version
```

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

## MCP server

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

MCP client config:

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

## Docker

```bash
docker run -i ghcr.io/cloudcorprecords/surveyloop
docker run --rm ghcr.io/cloudcorprecords/surveyloop --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`.