Skip to main content
Glama
apinator-io

@apinator/mcp

Official
by apinator-io

@apinator/mcp

npm version License: MIT CI

Model Context Protocol server for Apinator. It lets an AI agent (Claude Code, Claude Desktop, Cursor, …) publish events, inspect channels and watch live traffic on your Apinator app, so it can build and debug realtime features end to end.

Setup

You need your app's ID, key, secret and cluster from the Apinator console. Node.js 18 or newer.

Claude Code

claude mcp add apinator \
  -e APINATOR_APP_ID=your-app-id \
  -e APINATOR_KEY=your-key \
  -e APINATOR_SECRET=your-secret \
  -e APINATOR_CLUSTER=eu \
  -- npx -y @apinator/mcp

Claude Desktop, Cursor and other clients (mcpServers JSON config)

{
  "mcpServers": {
    "apinator": {
      "command": "npx",
      "args": ["-y", "@apinator/mcp"],
      "env": {
        "APINATOR_APP_ID": "your-app-id",
        "APINATOR_KEY": "your-key",
        "APINATOR_SECRET": "your-secret",
        "APINATOR_CLUSTER": "eu"
      }
    }
  }
}

Environment variables

Variable

Required

Description

APINATOR_APP_ID

yes

App ID

APINATOR_KEY

yes

API key

APINATOR_SECRET

yes

API secret. Used to sign requests; never returned by any tool

APINATOR_CLUSTER

yes

Region the app was created in, e.g. eu or us

APINATOR_READ_ONLY

no

1 removes publish_event, so the agent can only observe

APINATOR_API_URL

no

REST base URL of a local or self-hosted data plane (default https://ws-{cluster}.apinator.io)

APINATOR_WS_URL

no

WebSocket base URL of a local or self-hosted data plane (default wss://ws-{cluster}.apinator.io)

The server checks these at startup and exits with a message naming anything missing or malformed.

Related MCP server: console-stream-mcp

Tools

Tool

What it does

publish_event

Publish an event to a channel, or up to 100 channels. data can be an object or array (sent as JSON) or a string. Optional socket_id excludes the sender. realtime: event names are rejected. Not available in read-only mode.

list_channels

Active channels (with at least one subscriber) and their subscriber counts, optionally filtered by prefix.

get_channel

One channel's subscriber count, or active: false when nobody is subscribed.

sign_channel_auth

The auth (and channel_data) your auth endpoint should return for a private- or presence- subscription. Handy for testing an auth flow or debugging a signature mismatch.

watch_channel

Connects over WebSocket, subscribes (signing private/presence auth itself), and collects events for seconds (default 10, max 60). Keeps up to max_events (default 50, max 200); until_events returns early. Sends MCP progress notifications every 5 seconds, so clients that reset their timeout on progress can wait out a long watch. On presence channels the watcher joins as a member, which other subscribers will see.

Every tool except publish_event is annotated readOnlyHint, so clients can auto-approve them.

A typical end-to-end check an agent runs: start watch_channel on a channel, trigger the code path that publishes (or call publish_event), and compare the payload with what the client expects. On cache- channels the last event is replayed to new subscribers, so a watch started after a publish still receives it.

Resources and prompts

  • apinator://docs/llms.txt: the Apinator docs index, fetched from https://apinator.io/llms.txt.

  • apinator://reference/protocol: frames, system events, error codes, channel types and the auth signature.

  • Prompt add-realtime-feature: walks the agent through choosing channels, wiring the server and client SDKs, and verifying with watch_channel.

Security

  • The secret stays in the server process. Tool results and errors are scrubbed of it, and API error bodies are shortened to a one-line message.

  • publish_event reaches every subscriber of the channel. Set APINATOR_READ_ONLY=1 for an agent that should only look, or use a separate app for development.

  • sign_channel_auth produces valid subscription signatures for any channel name. Only give the server to agents you would trust with your app's auth endpoint.

Development

npm install
npm run build
npm test                  # unit tests (mocked fetch, local fake WebSocket server)
npm run typecheck         # src and tests

Releases are cut by release-please from Conventional Commits on main; the release PR bumps package.json, updates CHANGELOG.md and tags, and the workflow then publishes to npm.

Maintainers with the Apinator backend checked out next to this repo (../../backend, or set BACKEND_DIR) can run the integration test and the MCP inspector against a throwaway local stack:

./scripts/local-stack.sh up       # builds the backend, starts Postgres/Redis in Docker on spare ports, seeds an app
npm run build && npm run test:integration
./scripts/local-stack.sh down

local-stack.sh up writes the local credentials to .local-stack/env. It also sets APINATOR_API_URL and APINATOR_WS_URL, which point the server at a non-production data plane.

License

MIT

Available Tools

5 tools
get_channelGet channelB
Read-only

Get one channel's subscriber count. Reports active: false when nobody is subscribed to it.

NameRequiredDescriptionDefault
channelYesChannel name.

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=true, so safety is covered. The description does add one genuinely useful behavioral detail not available elsewhere - that `active: false` signals zero subscribers - but no output schema exists, so the burden of describing the returned payload is only partially met.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, zero waste, with the core purpose front-loaded before the response-semantics detail. Nothing could be cut without losing information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter read tool this is close to adequate, and the `active: false` note is a real addition. However, with no output schema, the description should say more about what else is returned (other fields, error behavior for unknown channels) than a single flag semantic.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single `channel` parameter (name, length bounds, non-whitespace pattern), so the schema does the heavy lifting. The description mentions 'one channel' but adds no format or constraint detail beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Get one channel's subscriber count'), and the singular framing naturally separates it from the sibling list_channels. It doesn't explicitly name any sibling, so sibling differentiation is implied rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this versus list_channels, watch_channel, or publish_event. The agent must infer from context that this is a single-channel detail lookup; there are no prerequisites or exclusions given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_channelsList channelsA
Read-only

List the app's active channels (channels with at least one subscriber right now) and their subscriber counts. Channels that nobody is subscribed to are not listed, even if events were published to them.

NameRequiredDescriptionDefault
prefixNoOnly return channels whose name starts with this, e.g. "presence-" or "private-".

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds real behavioral value beyond that: results are subscriber-gated rather than existence-gated, and subscriber counts are returned, which prevents an agent from misreading an empty result as a failure. No permissions, ordering, or pagination behavior is disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences with zero filler. The active-channel rule is front-loaded, and the second sentence pre-empts the most likely source of confusion.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-optional-parameter read tool with no output schema, the description covers the return content (channel names plus subscriber counts) and the inclusion rule, which is most of what an agent needs. It is silent on result ordering, size limits, and whether prefix filtering is case-sensitive, leaving minor gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the prefix parameter is documented in the schema with a concrete example ("presence-", "private-"). The description says nothing about filtering, so it adds no meaning beyond the schema — the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("List the app's active channels") and immediately narrows the scope to channels with at least one current subscriber. The exclusion clause ("channels that nobody is subscribed to are not listed, even if events were published to them") separates it cleanly from siblings like get_channel, publish_event, and watch_channel.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The definition makes the selection condition explicit — use this when you want currently-subscribed channels — and warns that a channel you published to may legitimately be absent. It does not, however, name an alternative such as get_channel for inspecting a specific channel that isn't listed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

publish_eventPublish eventA

Publish an event to one or more Apinator channels. Every client subscribed to those channels receives it immediately. On cache- channels the event is also stored and replayed to future subscribers. Pass exactly one of channel or channels.

NameRequiredDescriptionDefault
dataYesEvent payload. An object or array is sent as JSON; a string is sent as-is (clients JSON-decode it if they can).
nameYesEvent name, e.g. "order-created". Names starting with "realtime:" are reserved.
channelNoChannel to publish to, e.g. "orders" or "private-user-42".
channelsNoSeveral channels to publish the same event to (max 100).
socket_idNoExclude this connection from receiving the event (the sender's own socket).

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=false, openWorldHint=true, idempotentHint=false, and destructiveHint=false, so the safety profile is covered. The description adds non-obvious semantics the annotations cannot express: immediate fan-out to subscribers and that cache- channels persist and replay the event to future subscribers, which materially affects a publish decision.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, no waste, front-loaded with the core action and delivery behavior; the exclusivity constraint is placed last where a caller checks it before invoking. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a publish tool with no output schema, the description covers delivery, persistence/replay, and the channel selection rule, which is sufficient to call it correctly. It omits any mention of what the call returns or error behavior, but with no output schema and full annotation coverage that gap is minor.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline would be 3, but the description adds a genuine constraint absent from the schema: 'Pass exactly one of channel or channels.' The schema presents both as optional with no oneOf, so this mutual-exclusion rule is real value beyond the structured fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (publish) and resource (event) plus the target (Apinator channels), and describes the delivery mechanism: subscribers receive it immediately, cache- channels store and replay. This clearly distinguishes it from the read/auth siblings (list_channels, get_channel, watct_channel, sign_channel_auth).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear operational rule ('Pass exactly one of channel or channels') and explains the delivery context that decides reach. There is no competing publish sibling to route against, so no explicit alternative/exclusion language is needed, but no when-not guidance is offered either.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

sign_channel_authSign channel authA
Read-only

Compute the auth signature a client needs to subscribe to a private- or presence- channel, exactly as your auth endpoint would return it. Useful for testing an auth flow or debugging a signature mismatch. Presence channels need channel_data with a user_id.

NameRequiredDescriptionDefault
channelYesA "private-" or "presence-" channel.
socket_idYesSocket id of a connected client, from realtime:connection_established (e.g. "node-eu-1.42").
channel_dataNoPresence member data, e.g. {"user_id":"42","user_info":{"name":"Ada"}}. Required for presence channels.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations cover the safety profile (readOnlyHint=true, openWorldHint=false). The description adds real context beyond that: it is a pure computation mirroring the auth endpoint's output, plus the presence-channel channel_data requirement. It doesn't state whether it produces side effects (it doesn't, implied by annotations) or the exact return shape, but the added behavioral context is solid.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences, front-loaded with the core action, then use cases, then the one conditional requirement. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a no-output-schema tool, the description adequately conveys what is produced ('exactly as your auth endpoint would return it') and documents the input requirements. Only the literal return type/format is left implicit, which is a minor gap given the deterministic nature of the operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all three parameters with examples. The description reinforces the presence/channel_data link, but that fact is already in the schema's parameter description, so it adds little beyond baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb and resource: compute the auth signature for a private- or presence- channel subscription. It is immediately distinguishable from all siblings (list_channels, get_channel, publish_event, watch_channel), none of which involve signing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear when-to-use context: 'testing an auth flow or debugging a signature mismatch.' It also flags the presence-channel condition for channel_data. No explicit when-not guidance or named alternatives, but the usage intent is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

watch_channelWatch channelA
Read-only

Subscribe to a channel over WebSocket and collect the events that arrive for a few seconds, then disconnect. Use it to confirm events are flowing, see payload shapes, or test a publish end to end (start the watch, then publish). Private and presence channels are signed automatically. On presence channels the watcher joins as a member, which other subscribers will see. Long watches report progress every few seconds.

NameRequiredDescriptionDefault
channelYesChannel to subscribe to.
secondsNoHow long to listen after subscribing (default 10, max 60).
max_eventsNoHow many events to keep; later ones are counted but dropped (default 50, max 200).
channel_dataNoPresence member data to join with. Defaults to a watcher identity.
until_eventsNoStop early once this many events have arrived.

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations, it discloses meaningful behavior: private/presence channels are signed automatically, the watcher joins as a visible presence member, and long watches emit progress every few seconds. These are non-obvious side effects an agent needs, and they do not contradict readOnlyHint/openWorldHint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences, front-loaded with what the tool does and followed by usage, side effects, and progress behavior. Every sentence carries distinct information with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description adequately conveys the lifecycle and the presence/signing side effects, plus progress reporting. It could say more about what the collected events look like on return, but the essentials for correct invocation are present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning beyond the schema: channel_data is characterized as presence member data ('the watcher joins as a member') and the drop-versus-count behavior of max_events is reinforced. It stops short of documenting until_events semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb+resource: subscribe to a channel over WebSocket, collect events, then disconnect. It is clearly distinguished from siblings like publish_event and list_channels, and even frames the publish/watch pairing explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete when-to-use cases (confirm events are flowing, inspect payload shapes, test a publish end to end) including the ordering hint 'start the watch, then publish'. It does not state when NOT to use it or name sibling alternatives for those cases, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv1.0.1
    • First observedget_channel
    • First observedlist_channels
    • First observedpublish_event
    • First observedsign_channel_auth
    • First observedwatch_channel

TDQS

A4.1/5.0

Scored across 5 tools

Disambiguation5/5

Each tool occupies a clearly distinct niche: listing channels, reading one channel's state, publishing, generating auth signatures, and watching a WebSocket. The list_channels/get_channel pair is the only near-overlap and the descriptions make the aggregate-vs-single distinction explicit.

Naming Consistency5/5

All five tools follow a consistent snake_case verb_noun pattern (list_channels, get_channel, publish_event, sign_channel_auth, watch_channel). The verbs are precise and non-redundant.

Tool Count5/5

Five tools is well-scoped for a pub/sub service, with no filler. Each tool maps to a genuine capability (inspect, publish, authenticate, subscribe and observe) and none feels like a duplicate.

Completeness4/5

The surface covers the full agent-relevant lifecycle for a realtime channel service: discovery, inspection, publish, auth, and end-to-end observation. Minor gaps exist around channel lifecycle management and batch/multi-channel inspection, but core workflows are fully reachable.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Real-time observability dashboard for monitoring AI agents in multi-agent development workflows, with live WebSocket updates of tool calls, sessions, and usage statistics.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI coding agents to access live console logs, errors, and network requests from web applications via a local WebSocket connection, without copying data to chat.
    2 npm
    19
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to browse, click, and debug real websites in the user's own signed-in browser or a dedicated Chrome instance, with only explicitly shared tabs reachable and revocable at any time. Exposes the full developer toolbox — console, network, sources, debugger, elements, performance and CPU/memory profiling, storage, service workers, coverage, emulation, accessibility, security, Lighthouse, and Playwright-test recording — as first-class tools callable in one step.
    39 npm
    1
    MIT