mcp-server

v0.2.0
@sweapio/mcp-server Checked 3 days ago Published 1 month ago

Model Context Protocol server for the Sweap Core API (beta)

A Model Context Protocol server for the Sweap Core API. It lets an AI assistant (Claude Desktop, OpenAI Codex, VS Code Copilot, n8n, Open WebUI) read and manage Sweap events, guests, check-ins and contacts. Requires Node.js 22 or newer (24 LTS recommended) and Sweap API credentials, created in the Sweap UI under API credentials. There is nothing to install. Point your client at the package and it downloads and runs the server on demand, with the credentials passed in the client's own configuration rather than kept in a file.

Summary extracted from the README.

Sweap MCP Server

A Model Context Protocol server for the Sweap Core API. It lets an AI assistant (Claude Desktop, OpenAI Codex, VS Code Copilot, n8n, Open WebUI) read and manage Sweap events, guests, check-ins and contacts.

Beta. Interfaces may change.

Personal data is off by default: a fresh install is read-only and returns no information about any individual. Raising that is a deliberate step. See Privacy and data scope.

Quick start

Requires Node.js 22 or newer (24 LTS recommended) and Sweap API credentials, created in the Sweap UI under API credentials.

There is nothing to install. Point your client at the package and it downloads and runs the server on demand, with the credentials passed in the client's own configuration rather than kept in a file.

Claude Desktop, as an extension

The simplest route, and the one to give a colleague who does not edit JSON. Download sweap-mcp-server-<version>.mcpb from the releases page and double-click it, or drag it onto Settings > Extensions. Claude Desktop asks for the client id and secret in a form and keeps the secret in your operating system keychain rather than in a config file. The same form carries the data scope, the write switch and the custom field setting, all at their safe defaults.

Updating the extension

Download the newer .mcpb and install it the same way; it replaces the previous version in place. Your settings are keyed to the extension rather than to a version, so the credentials and the scope survive the update and you are not asked for them again. A new setting added by a later version appears in the form at its default.

Extensions installed from a file are not updated automatically, so a new release has to be installed deliberately. The npx configurations below work the same way: they name a version, so an update means changing that number. Leaving the version out picks up every new release on the next restart, which also means running code nobody in your organisation has looked at with your Sweap credentials. Pin it unless that is a trade you have made on purpose.

Claude Desktop, by hand

If you would rather configure it yourself, add this to claude_desktop_config.json and restart Claude Desktop:

{
  "mcpServers": {
    "sweap": {
      "command": "npx",
      "args": ["-y", "@sweapio/mcp-server@0.2.0"],
      "env": {
        "SWEAP_CLIENT_ID": "your_client_id",
        "SWEAP_CLIENT_SECRET": "your_client_secret",
        "SWEAP_DATA_SCOPE": "none",
        "SWEAP_ALLOW_WRITES": "false"
      }
    }
  }
}

The config file lives at ~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on Windows. There is a copy of the above, with the scope options explained, in claude-config-example.json.

Ask the assistant to "check the Sweap connection" to confirm it works: the verify_connection tool reports the account and the roles the credentials carry. The server also prints its effective policy on startup, which appears in the Claude Desktop MCP log.

Claude Code

claude mcp add sweap --env SWEAP_CLIENT_ID=your_client_id --env SWEAP_CLIENT_SECRET=your_client_secret -- npx -y @sweapio/mcp-server@0.2.0

OpenAI Codex

Add to ~/.codex/config.toml (or a project-scoped .codex/config.toml):

[mcp_servers.sweap]
command = "npx"
args = ["-y", "@sweapio/mcp-server@0.2.0"]

[mcp_servers.sweap.env]
SWEAP_CLIENT_ID = "your_client_id"
SWEAP_CLIENT_SECRET = "your_client_secret"
SWEAP_DATA_SCOPE = "none"
SWEAP_ALLOW_WRITES = "false"

VS Code

Create .vscode/mcp.json:

{
  "servers": {
    "sweap": {
      "command": "npx",
      "args": ["-y", "@sweapio/mcp-server@0.2.0"],
      "env": {
        "SWEAP_CLIENT_ID": "${input:sweapClientId}",
        "SWEAP_CLIENT_SECRET": "${input:sweapClientSecret}"
      }
    }
  },
  "inputs": [
    { "id": "sweapClientId", "type": "promptString", "description": "Sweap client id" },
    { "id": "sweapClientSecret", "type": "promptString", "description": "Sweap client secret", "password": true }
  ]
}

From source

For working on the server itself, or to pin a specific commit:

git clone https://github.com/sweapio/sweap-mcp-server.git
cd sweap-mcp-server
npm install
cp .env.example .env      # fill in SWEAP_CLIENT_ID and SWEAP_CLIENT_SECRET
node test/probe.mjs       # confirms the credentials work, lists their roles

Then use "command": "node" with an absolute path to mcpServer.js instead of the npx invocation above. A .env file is only read when running from a checkout; an installed package takes its configuration from the client's env block. See CONTRIBUTING.md.

HTTP transport (n8n, Open WebUI, local testing)

npm run start:http        # or: MCP_MODE=http MCP_PORT=3001 node mcpServer.js

Endpoint http://127.0.0.1:3001/mcp, health check /health. MCP_MODE=sse serves the older SSE transport.

This endpoint has no authentication and binds to 127.0.0.1 on purpose. Do not tunnel it or expose it to the internet: anyone who reaches the URL gets full use of your Sweap credentials. See SECURITY.md.

Requests are rejected unless Host is loopback and Origin, if sent at all, is loopback too. That stops a web page in your browser from reaching the server behind your back. Any loopback origin is accepted already, whatever its port, so a local dev server at http://localhost:5173 needs no configuration.

MCP_ALLOWED_ORIGINS is only for a trusted origin that is not loopback. Note that it permits the request; it does not make the server send CORS response headers, so a browser doing a cross-origin fetch will still be blocked by its own preflight. Put a proxy in front if you need that.

Docker

docker build -t sweap-mcp-server .
docker run --rm -i --env-file .env sweap-mcp-server

Credentials are passed at run time and are not in the image. The image holds what the npm package holds, because the Dockerfile builds it from npm pack, and .dockerignore keeps credential and key files out of the build context at any depth. If you change the Dockerfile, re-check:

docker run --rm --entrypoint sh sweap-mcp-server -c 'cd /app && find . -type f' \
  | node scripts/secret-files.js

That must report "0 secret file(s)".

ChatGPT: not yet

ChatGPT reaches MCP servers through connectors, which need a public HTTPS endpoint. This server's HTTP transport has no authentication, so exposing it would hand full use of your Sweap credentials to anyone who found the URL. Adding authentication is not implemented yet. Use Codex meanwhile, same server, locally, over stdio.

Privacy Policy

Sweap's privacy policy is at https://www.sweap.io/en/privacy-policy.

This server holds nothing itself. It stores no data, keeps no cache of records and makes no third-party calls beyond api.sweap.io and auth.sweap.io. What it does is pass Sweap data to whichever AI assistant you connect it to, and retention there is between you and that provider. The scope you choose decides how much can be passed. PRIVACY.md sets out what flows where in detail, for a data protection review.

Privacy and data scope

Anything a tool returns enters the AI provider's context window. Running the server locally does not change that. So the server decides at the resource level what it will expose, and the safe option is the default.

SWEAP_DATA_SCOPE selects how far it may go. Scopes are cumulative.

Scope What it adds Endpoints
none (default) no personal data events, event statistics, arrival counts, categories, event tags, visibility groups, registration pages, custom field definitions
pseudonymous guests referenced by UUID only, no names check-ins
personal names, e-mail addresses, RSVP state, custom field values guests, guest bulk imports, contacts, recipients

Two switches are independent of the scope:

  • SWEAP_ALLOW_WRITES (default false): all create, update and delete tools.
  • SWEAP_CUSTOM_FIELDS (default all): set to redact to withhold organiser-defined custom field values while keeping the rest of the record.

Tools outside the selected scope are not offered to the model at all. They are filtered out before the tool list is sent, so the assistant cannot ask for them. The policy is checked again on every call.

See what a configuration would expose, without starting a client:

npm run list-tools -- --scope personal --writes

Before you raise the scope. At personal you are sending guest and contact data to your AI provider, as controller and not covered by Sweap's Data Processing Agreement. PRIVACY.md has what a data protection review needs: what the server stores (nothing), what it logs (no record data), why pseudonymous is not a legal exemption, and where personal data sits in custom fields.

Choosing a configuration. For a chat client, leave SWEAP_ALLOW_WRITES at false and raise the scope only as far as your questions need. Writes disabled removes every create, update and delete tool, which narrows what an assistant can do by accident and leaves more context for it to choose well among the reads. Exercise write paths through node scripts/smoke-test.js --write instead, on a test account: it creates and deletes its own guests, contacts and imports, but an event cannot be created through this API, so the two event write tools necessarily act on an existing event and activating one is not fully undoable.

Settings are per-process, so you can run one instance read-only for a chat client and another with writes for an automation, on separate credentials.

Tools

Tools cover events, event statistics, categories, event tags, visibility groups, registration pages, check-ins, guests, guest bulk imports, contacts and recipients. npm run list-tools -- --verbose prints the current set with parameters, and how many of them your configuration would expose. A few worth knowing:

  • get_events: start here. Most other tools need an eventId.
  • get_event_statistics: attendance counts per event. Answers "how many people are coming" with no personal data, so prefer it over listing guests. Note attendeeCount (distinct people present) is not checkinCount (CHECK_IN records, which repeat when someone is scanned twice).
  • get_event_arrivals: check-in scans per 15 minutes for one event, in the event's timezone. The server reads the check-ins itself and returns only counts, leaving out any bucket with fewer than 5 scans, so it is available at scope none. It needs both the checkins_read and the events_read role.
  • verify_connection: checks the credentials and reports their roles. Use it when something fails with a permission error.
  • update_guest_fields vs replace_guest: the first patches individual fields and is almost always what you want. The second is a full PUT: it needs the record's current version and can blank out omitted fields.
  • create_checkin: there is no way to delete or edit a check-in afterwards; the only way to remove one is to delete the guest, which destroys their whole record. Treat it as permanent.
  • Bulk imports: create_guest_bulk_import → append_guests_to_bulk_import → set state to UPLOAD_FINISHED via update_guest_bulk_import → a person completes the import in the Sweap web app. The API only stages rows; nothing in this flow creates guests, and UPLOAD_FINISHED cannot be undone. Use it instead of repeated create_guest calls.

Tools carry MCP annotations (readOnlyHint, destructiveHint), so hosts that support it prompt before destructive calls.

If a credential lacks the role an endpoint needs, its tools are withheld rather than failing at call time. registration_pages_read, checkins_write and deleted_resources_read are not part of the default API license. Contact support@sweap.io for those.

Things to try

Questions that work well, roughly in order of how much they show:

  • "Which of my events has the weakest RSVP rate?": one call to get_event_statistics, no personal data.
  • "When did guests actually arrive at ? Bucket it by 15 minutes.": arrival curves are not in the Sweap UI, and get_event_arrivals answers it at the default scope: the server counts the check-ins and the model sees only totals per bucket, no guest ids. Expect to be surprised: on our test data arrivals form two separate peaks rather than one rush at the start.
  • "How many people actually came, and how does that compare to acceptances?": the interesting gap is usually between acceptedCount and attendeeCount.
  • "What custom fields does collect?": works at any scope, including the default, because field definitions carry no personal data.
  • "Find the guests with no reply and summarize by category.": needs SWEAP_DATA_SCOPE=personal.

Environment variables

Variable Default Purpose
SWEAP_CLIENT_ID — OAuth client id. Required.
SWEAP_CLIENT_SECRET — OAuth client secret. Required.
SWEAP_DATA_SCOPE none none, pseudonymous or personal.
SWEAP_ALLOW_WRITES false true enables create/update/delete tools.
SWEAP_CUSTOM_FIELDS all redact withholds custom field values. Any other value also redacts.
SWEAP_BASE_URL https://api.sweap.io For staging or a local API. Must be https, except on localhost.
SWEAP_AUTH_URL https://auth.sweap.io Identity provider. Must be https, except on localhost.
SWEAP_API_VERSION 1.7.0 Sent as X-API-Version. The API records it but does not select behaviour by it.
MCP_MODE stdio http or sse.
MCP_PORT 3001 Port for http / sse. Falls back to PORT.
MCP_ALLOWED_ORIGINS empty Extra browser origins allowed on http / sse, comma-separated. Loopback is always allowed.

An unrecognised SWEAP_DATA_SCOPE or SWEAP_CUSTOM_FIELDS falls back to its safe value and says so on startup, rather than failing open.

License and terms

Two documents apply, covering different things:

Governs Where
Apache License 2.0 This source code — use, modify, run, redistribute, including commercially LICENSE
Sweap terms The Sweap service, your API access, and the data the API returns legal.sweap.io

The license grants no access to the Sweap API, and the Sweap terms place no restriction on copying this code. Running the server means both apply: you need an active Sweap subscription and API credentials for it to do anything at all.

"Sweap" is a trademark of MATE Development GmbH. Section 6 of the Apache license grants no rights to use it, so a fork should not present itself as Sweap's.

Development

npm test              # policy gating, redaction, pagination signals
npm run check:spec    # reconcile with the live OpenAPI spec
npm run list-tools    # what the current config would expose
npm run smoke         # call the tools against a real account (reads only)

Only smoke talks to the API. The others cannot tell you whether a path is right or a response matches what the code assumes.

See CONTRIBUTING.md for adding a tool, writing descriptions, verifying against a real account, and the repository layout. SECURITY.md covers the security properties and how to report a vulnerability.