npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rule/mcp

v0.2.0-beta.4

Published

MCP server for Rule.io email marketing — deep workflow tools, not CRUD wrappers

Readme

Rule.io MCP Server

An MCP server that gives AI assistants deep access to Rule.io email marketing — campaigns, automations, subscribers, templates, analytics, and more.

License: MIT Node.js

Migrating from @rulecom/mcp

The package has moved to @rule/mcp. @rulecom/mcp is deprecated and will not receive further updates.

Update your MCP config — replace @rulecom/mcp with @rule/mcp in your args:

"args": ["-y", "@rule/mcp@next"]

Global install — reinstall under the new name:

npm install -g @rule/mcp@next

Binary names — the CLI commands have changed:

| Old | New | |-----|-----| | rulecom-mcp | rule-mcp | | rulecom-mcp-http | rule-mcp-http |


Quick Start

1. Get a Rule.io API key

Create one at app.rule.io under Settings > Developer.

2. Add to Claude Desktop

Open your Claude Desktop config (claude_desktop_config.json) and add:

{
  "mcpServers": {
    "rule-io": {
      "command": "npx",
      "args": ["-y", "@rule/mcp@next"],
      "env": {
        "RULE_IO_API_KEY": "your-api-key-here"
      }
    }
  }
}

3. Add to Claude Code

Add a .mcp.json file to your project root (or your user settings.json):

{
  "mcpServers": {
    "rule-io": {
      "command": "npx",
      "args": ["-y", "@rule/mcp@next"],
      "env": {
        "RULE_IO_API_KEY": "your-api-key-here"
      }
    }
  }
}

That's it. The server starts automatically when Claude needs it.


Tools

38 tools organized into 7 categories. Four are interactive — they return a ui:// resource that renders inline in claude.ai (account digest, analytics, template preview, campaigns table) and a JSON text fallback for non-UI clients.

Tags

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_list_tags | List all tags in your Rule.io account | (none) | | rule_find_tag | Find a tag's numeric ID by name | name |

Subscribers

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_create_subscriber | Create a new subscriber | email, phone_number?, language?, status? | | rule_get_subscriber | Get subscriber by email (profile + fields + tags) | email | | rule_delete_subscriber | Delete a subscriber | subscriber, identified_by? | | rule_manage_subscriber_tags | Add or remove tags from a subscriber | subscriber, identified_by?, action, tags, trigger_automation? | | rule_bulk_manage_tags | Bulk add/remove tags for multiple subscribers | action, tags, subscribers[{ email?, phone_number? }], trigger_automation? | | rule_set_subscriber_fields | Set custom field data on a subscriber | subscriber_id, groups[{ group, values[{ field, value, historical? }] }] | | rule_list_subscribers_by_tag | List subscribers having ALL given tag IDs (AND / intersection) | tag_ids[], limit?, page? | | rule_block_subscribers | Block or unblock multiple subscribers | action, subscribers[{ email? \| phone_number? \| id? }] |

Automations

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_create_automation_email | Create complete email automation in one step | name, trigger_tag, subject, template, sendout_type? | | rule_list_automations | List email automations | active?, query?, page?, per_page? | | rule_get_automation | Get automation details by ID, optionally merged with analytics metrics | id, include_analytics?{ date_from, date_to, metrics[], message_type? } | | rule_update_automation | Update an automation | id, active?, sendout_type?, trigger_type?, trigger_id? | | rule_delete_automation | Delete an automation | id |

Campaigns

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_create_campaign | Create a one-off email campaign | name?, sendout_type? | | rule_create_campaign_email | Create a complete campaign with email in one step | name, subject, tags or segments or subscribers, template or brand_style_id | | rule_list_campaigns | Interactive. List campaigns. Renders as a filterable, sortable table in claude.ai. | page?, per_page? | | rule_get_campaign | Get campaign details by ID, optionally merged with analytics metrics | id, include_analytics?{ date_from, date_to, metrics[], message_type? } | | rule_update_campaign | Update a campaign | id, name?, sendout_type? | | rule_delete_campaign | Delete a campaign | id | | rule_copy_campaign | Duplicate an existing campaign | id | | rule_list_segments | List available segments for campaign targeting | page?, per_page? | | rule_schedule_campaign | Schedule, send, or cancel a campaign | id, action, datetime? |

Templates

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_create_template | Create RCML email template | name, message_id, content | | rule_list_templates | List templates | page?, per_page? | | rule_render_template | Interactive. Render template to HTML (with optional merge tag substitution). Renders as a sandboxed preview in claude.ai. | id, subscriber_id? | | rule_get_template | Get template details by ID | id | | rule_delete_template | Delete a template | id | | rule_find_template_usage | Find the single campaign or automation that owns a template (returns { owner: null } if unused). Scans dispatchers until first match — no direct owner endpoint in Rule.io yet. | id |

Analytics

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_get_analytics | Interactive. Per-object metrics for one or more dispatchers (campaigns, automations, A/B tests, transactional sends, journeys). object_type, object_ids, and metrics are all required — the Rule.io API has no account-wide aggregation mode. For an account-level digest of the first 100 campaigns and 100 automations, use rule_get_account_digest. message_type optionally filters by channel. Renders as a chart + filterable table in claude.ai. | date_from, date_to, object_type, object_ids[], metrics[], message_type? | | rule_export_data | Export raw data: dispatchers (send metadata, max 1-day range), statistics (one record per subscriber event — opens, clicks, bounces, etc.), or subscribers. Use rule_get_analytics for per-dispatcher totals or rule_get_account_digest for an account-level summary. | type, date_from, date_to, statistic_types[]?, next_page_token? | | rule_get_account_digest | Interactive. Pre-rolled performance digest for a date range — totals + rates summed across the first 100 campaigns and 100 automations returned by the listing endpoints (no date filter on the listings themselves; per-dispatcher metrics are still scoped to the window), top N dispatchers by unique opens, and a soft/hard/spam bounce breakdown. Totals are computed client-side because the Rule.io API has no account-wide endpoint. Defaults to the last 7 days. Partial failures surface as warnings instead of failing the whole call. Renders as a dashboard in claude.ai. | days_back?, date_from?, date_to?, top_n? |

Admin

| Tool | Description | Key Inputs | |------|-------------|------------| | rule_list_brand_styles | List brand styles | (none) | | rule_get_brand_style | Get full details of a brand style | id | | rule_manage_brand_style | Create/update/delete brand styles | action, id?, domain?, name? | | rule_suppress_subscribers | Suppress subscribers from emails | subscribers[] | | rule_unsuppress_subscribers | Remove suppression | subscribers[] |


Resources

Resources provide read-only context that AI assistants can pull in automatically.

| URI | Description | |-----|-------------| | rule://tags | All tags | | rule://brand-styles | All brand styles | | rule://segments | All segments | | rule://automations/{id} | Automation by ID | | rule://campaigns/{id} | Campaign by ID | | rule://templates/{id} | Template by ID | | rule://brand-styles/{id} | Brand style by ID |


Prompts

Pre-built workflow guides that walk the AI through multi-step email setups.

E-commerce

| Prompt | Description | |--------|-------------| | create_order_confirmation_email | Order confirmation automation guide | | create_shipping_update_email | Shipping notification guide | | create_abandoned_cart_email | Abandoned cart recovery guide | | create_order_cancellation_email | Order cancellation guide |

Hospitality

| Prompt | Description | |--------|-------------| | create_reservation_confirmation_email | Reservation confirmation guide | | create_reservation_reminder_email | Pre-arrival reminder guide | | create_feedback_request_email | Post-stay feedback guide |

Integrations

| Prompt | Description | |--------|-------------| | setup_shopify_integration | Shopify setup guide | | setup_bookzen_integration | Bookzen setup guide |


Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | RULE_IO_API_KEY | Yes | Your Rule.io API key | | RULE_IO_DEBUG | No | Set to "true" for debug logging | | RULE_IO_BASE_URL_V2 | No | Custom base URL for v2 API | | RULE_IO_BASE_URL_V3 | No | Custom base URL for v3 API | | RULE_IO_MAX_CONCURRENCY | No | Max concurrent in-flight Rule.io API calls per session (default: 4). Lower this if your account hits rate limits; raise it once Rule.io documents official limits. | | RULE_IO_MAX_RETRIES | No | Number of retries on a 429 from the Rule.io API before surfacing the error (default: 2, so up to 3 total attempts). Set to 0 to disable retries entirely. |


Examples

Create a subscriber and tag them

"Add [email protected] as a subscriber with the tag 'VIP'"

The AI calls two tools in sequence:

// 1. rule_create_subscriber
{ "email": "[email protected]", "language": "en" }
// → { "id": 42, "email": "[email protected]", ... }

// 2. rule_manage_subscriber_tags
{ "subscriber": "[email protected]", "action": "add", "tags": ["VIP"] }
// → { "message": "Tags added successfully" }

Set up an abandoned cart automation

"Set up an abandoned cart recovery email for our Shopify store"

The AI uses the create_abandoned_cart_email prompt for step-by-step guidance, then calls rule_create_automation_email with the trigger tag, subject, and RCML template:

{
  "name": "Abandoned Cart Recovery",
  "trigger_tag": "shopify_checkout_abandoned",
  "subject": "You left something behind!",
  "template": { "type": "rcml", "content": [{ "type": "section", "content": ["..."] }] },
  "sendout_type": "marketing"
}
// → { "success": true, "automail_id": 101, "message_id": 202, "template_id": 303, "dynamic_set_id": 404 }

Check campaign performance

"How did last week's newsletter perform?"

The AI calls rule_get_analytics with the campaign ID and date range:

{
  "date_from": "2025-06-01",
  "date_to": "2025-06-07",
  "object_type": "CAMPAIGN",
  "object_ids": ["12345"],
  "metrics": ["open_uniq", "click_uniq", "total_bounce", "unsubscribe"]
}
// → { data: [{ id: "12345", metrics: [{ metric: "open_uniq", value: 1240 }, ...] }] }

Create a brand style from a website

"Create a brand style based on https://example.com"

The AI calls rule_manage_brand_style with action: create_from_domain to create a new brand style with colors, fonts, and logo extracted from the site:

{ "action": "create_from_domain", "domain": "https://example.com" }
// → { "id": 7, "name": "example.com", "colors": { "primary": "#000" }, "fonts": { "heading": "Arial" } }

Rate limits

Rule.io has not published formal rate limits. The server enables the Rule.io SDK's rateLimiting transport gate with two defenses:

  • Concurrency cap — every Rule.io HTTP request goes through a per-session semaphore (default RULE_IO_MAX_CONCURRENCY=4). Multiple tools running in parallel cannot saturate the API by themselves.
  • 429 retries that honor Retry-After — on a rate-limit response, the call is retried up to RULE_IO_MAX_RETRIES times (default 2). When Rule.io supplies a Retry-After header, the SDK transport honors it and the gate waits exactly that long before retrying — important because Rule.io's observed 49 % error-rate trigger means retrying inside the suggested window accelerates a longer block. Without the header, the gate falls back to exponential backoff with jitter. Server-suggested waits beyond the gate's cap rethrow the 429 immediately rather than stalling tool calls.

The gate lives in the SDK transport, so it counts every HTTP request — including the paginated fan-outs inside namespace methods like subscribers.listSubscribersByTagIds. Tools that fan out (rule_get_account_digest ≈14 calls, rule_find_template_usage capped scan, rule_get_campaign / rule_get_automation with include_analytics +1 call, rule_get_subscriber 3 parallel calls) all flow through the same gate. If you orchestrate this server from another agent, avoid looping the high-cost tools over a list of IDs; prefer batching at the LLM layer or scoping by date range.


Links


License

MIT