mcp-rule
MCP server for Rule.io marketing automation platform. Enables managing subscribers, tags, campaigns, custom fields, and automations through the MCP interface.
README
mcp-rule
A Model Context Protocol (MCP) implementation for the Rule.io marketing automation platform.
Installation
You can install the mcp-rule package directly with the Universal Executor (uvx):
uvx mcp-rule
For development, you can install from the source code:
git clone https://github.com/swesam/mcp-rule.git
cd mcp-rule
pip install -e .
Features
This MCP implementation provides a standardized interface to Rule.io's API, allowing you to:
- Manage subscribers (create, read, update, delete)
- Work with tags
- Access campaigns
- Create and use custom fields
- Track transactions
- Set up automations
Direct API Usage
You can use the Rule.io client directly in your Python code:
from mcp_rule import RuleClient
# Initialize the client with your API key
client = RuleClient(api_key="your_api_key_here")
# List subscribers
subscribers = client.get_subscribers(limit=10)
for subscriber in subscribers:
print(f"{subscriber.email} - Created: {subscriber.created}")
# Create a new subscriber
new_subscriber = client.create_subscriber(
email="new@example.com",
tags=["new_user", "newsletter"],
fields={"first_name": "John", "last_name": "Doe"}
)
# Get tags
tags = client.get_tags()
for tag in tags:
print(f"{tag.name} - Subscribers: {tag.subscriber_count}")
MCP Usage
The primary purpose of this package is to provide a Model Context Protocol implementation for Rule.io. Here's how to use it with MCP:
import asyncio
import json
from mcp import ContextRequest, ContextRequestMetadata, get_provider
async def example():
# Get the Rule MCP provider
provider = get_provider("rule")
# Set up metadata with your API key
metadata = ContextRequestMetadata(api_key="your_api_key_here")
# Create a request to list subscribers
request = ContextRequest(
method="GET",
path="/subscribers",
query_params={"limit": "10"},
metadata=metadata,
)
# Send the request
response = await provider.handle_request(request)
# Parse and use the response
result = json.loads(response.body)
subscribers = result.get("subscribers", [])
for subscriber in subscribers:
print(f"{subscriber['email']}")
# Run the example
asyncio.run(example())
API Endpoints
The following MCP endpoints are available:
Subscribers
GET /subscribers- List subscribersGET /subscribers/{subscriber_id}- Get a specific subscriberPOST /subscribers- Create a new subscriberPUT /subscribers/{subscriber_id}- Update a subscriberDELETE /subscribers/{subscriber_id}- Delete a subscriber
Tags
GET /tags- List tagsPOST /tags- Create a new tag
Campaigns
GET /campaigns- List campaigns
Custom Fields
GET /fields- List custom fieldsPOST /fields- Create a new custom field
Examples
Check out the examples directory for complete usage examples:
basic_usage.py- Direct API client usagemcp_usage.py- MCP interface usage
Documentation
For more information about the Rule.io API, see:
For details on the Model Context Protocol (MCP), visit:
To-Do
[ ] Add more detailed error handling [ ] Implement more MCP endpoints [ ] Publish to a package registry (e.g., PyPI) [ ] Add unit tests for existing functionality
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.