Skip to main content
Glama
benepass-mcp

benepass-mcp

by brian7989

benepass-mcp

Unofficial, read-only MCP server for the Benepass employee-web API.

This project is not affiliated with, endorsed by, or supported by Benepass. It reverse-engineers the public employee-web client. Do not contact Benepass support about this server, login issues, missing endpoints, or anything else related to this unofficial tool.

The package name on the public registry is already taken. This repo sets private: true and is not published there.

Layout

  • src/index.ts — stdio entry (serveStdio)

  • src/server.ts — McpServer factory

  • src/tools.ts — thin MCP adapters (TOOL_NAMES)

  • src/app.ts — composition root

  • src/accounts.ts — benefits derivation, HSA account selection

  • src/hsa.ts — investment GET path walk

  • src/api.ts — GET-only Benepass HTTP client

  • src/http.ts — ky + host allowlist

  • src/cognito.ts — Cognito OTP + token refresh

  • src/session.ts — local session file

  • src/schemas.ts — Zod models for Benepass JSON

  • src/errors.ts — typed errors

  • test/ — Vitest (in-process MCP client + unit tests)

Related MCP server: mcp-nightscout

Security model

  • Read-only. The ky client for api.benefitsapi.com throws if the method is not GET. There are no tools for deposits, withdrawals, expense submit/update/delete, cards/PIN, payouts, or generic call_api.

  • Tokens stay on your machine. After OTP login, the Cognito refresh token is stored at ~/.config/benepass-mcp/session.json (XDG via env-paths), mode 0600. Override with BENEPASS_SESSION_PATH (two P's). Tools never return refresh or access tokens. Tokens are never logged. Session files are gitignored.

  • Outbound hosts only: cognito-idp.us-east-1.amazonaws.com, cognito.benefitsapi.com, api.benefitsapi.com.

  • Cognito app client id 6l7jeu4r44kgndgeab4aot355m is a public client id (not a secret); it is baked into the employee-web app.

Login flow

  1. Call start_login with your Benepass email. Cognito InitiateAuth CUSTOM_AUTH sends an OTP.

  2. Call complete_login with the email, OTP, and challenge_session. Cognito RespondToAuthChallenge CUSTOM_CHALLENGE yields a refresh token that is written to the local session file. The tool returns only { ok, email }.

  3. Later API calls POST grant_type=refresh_token to the token URL and send the access token as Authorization Bearer. Expiry is honored (expires_in and JWT exp).

  4. If workspace_id is omitted, GET /v2/me/workspaces/ and persist the first type=employment workspace.

Tools

Auth: start_login, complete_login, auth_status, logout.

Reads: list_workspaces, list_accounts, list_benefits (derived from accounts enrollment.benefit + available balance), list_transactions, get_hsa_account_details, get_hsa_investments, list_documents, get_document, get_current_user.

list_benefits: Benepass has no /v2/me/benefits/. Benefits are derived from each account enrollment.benefit and the balance key ending in /available.

get_hsa_investments: tries GET only, first 2xx wins:

  • /v2/me/accounts/{id}/hsa-investments/

  • /v2/me/accounts/{id}/hsa-investments/portfolio/

  • /v2/me/accounts/{id}/hsa-investments/portfolio/allocation/

  • /v2/me/accounts/{id}/hsa-investments/asset-links/

If account_id is omitted, HSA accounts are selected from Zod-parsed fields (enrollment.benefit.benefit_type, enrollment.benefit.key, account.key, account.account_type, account.type) matching hsa / health_savings / health_savings_account. Account names are not searched. If those fields are absent, the tool falls back to an account id on GET /v2/me/hsa-account-details/. If every candidate 404s, the tool errors and includes that get_hsa_account_details payload. Those investment GET paths are reverse-engineered and may not exist for every account.

License

MIT

Stdio

This server speaks MCP on stdout and writes logs to stderr. Use the start script after build, or the dev script during development.

Cursor

Add a benepass entry to MCP settings (mcp.json) that launches this package's compiled entry. Authenticate with start_login then complete_login.

Example Cursor config is in cursor-mcp.example.json.

Available Tools

13 tools
auth_statusAuth statusA
Read-only

Show whether a local Benepass session exists, and the logged-in email. Never returns secrets.

Inputs: no named parameters. Returns: object

complete_loginComplete loginA
Read-only

Complete Benepass login with the email OTP and challenge session from start_login. Persists a local session; never returns tokens.

Inputs: otp (required), email (required), challenge_session (required). Returns: ok, email

get_current_userGet current userA
Read-only

Fetch the current Benepass user profile (GET /v2/me/).

Inputs: no named parameters. Returns: object

get_documentGet documentA
Read-only

Fetch a single document by id.

Inputs: document_id (required), workspace_id. Returns: object

get_hsa_account_detailsGet HSA account detailsA
Read-only

Fetch Health Savings Account details (US HSA). May 404 for non-US users.

Inputs: workspace_id. Returns: object

get_hsa_investmentsGet HSA investmentsA
Read-only

Read HSA investment data by trying known GET paths on an HSA account. First 2xx wins. Reverse-engineered; paths may 404.

Inputs: account_id, workspace_id. Returns: body, path, account_id

list_accountsList accountsA
Read-only

List benefit accounts and balances for the current workspace.

Inputs: workspace_id. Returns: data

list_benefitsList benefitsA
Read-only

List enrolled benefits derived from accounts (Benepass has no /v2/me/benefits/ endpoint). Includes available balance.

Inputs: workspace_id. Returns: data

list_documentsList documentsA
Read-only

List documents available in the current workspace (statements, plan docs, tax forms).

Inputs: workspace_id. Returns: object

list_transactionsList transactionsB
Read-only

List transactions for the current workspace. Paginate with limit/offset; optionally filter by benefit_id.

Inputs: limit, offset, benefit_id, workspace_id. Returns: object

list_workspacesList workspacesA
Read-only

List Benepass workspaces for the logged-in user (employment and personal). Does not require a workspace header.

Inputs: no named parameters. Returns: object

logoutLog outB
Read-only

Delete the local Benepass session file.

Inputs: no named parameters. Returns: ok

start_loginStart loginB
Read-only

Start Benepass email OTP login. Sends a one-time code to the email and returns a short-lived challenge session.

Inputs: email (required). Returns: challenge_name, challenge_session

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool targets a distinct operation (auth, list, get) on distinct resources (user, workspaces, accounts, benefits, transactions, HSA, documents). No two tools appear to overlap in purpose, making selection unambiguous.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (list_*, get_*, start_login, complete_login). Minor deviations include auth_status (noun-like) and logout (single verb), but overall the convention is clear and predictable.

    Tool Count5/5

    13 tools is within the ideal 3-15 range and aligns well with the server's scope of accessing Benepass data. Each tool serves a clear purpose without redundancy, making the set well-proportioned.

    Completeness4/5

    The surface covers core read operations (auth, lists, details) with no obvious dead ends. Minor gaps include the lack of individual transaction detail fetch and potential reverse-engineering fragility of HSA investments, but the main workflows are supported.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only access to Bity cryptocurrency account balances, market data (ticker, order book, trades), and order history via the official API.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables read-only access to a Nightscout instance for glucose readings, treatments, and deterministic server-side aggregates, allowing users to discuss their diabetes data with an AI assistant without write permissions.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables read-only access to Klaviyo marketing data, including campaigns, flows, segments, metrics, reports, and customer profiles, across multiple Klaviyo accounts.
      24
      34 npm
      MIT