Skip to main content
Glama

add_or_update_member

Add new subscribers or update existing ones in Mailchimp lists, manage subscription status and tags.

Instructions

Add a new subscriber or update if exists (upsert). Status: subscribed, pending, unsubscribed. Tags: comma-separated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYes
emailYes
statusNosubscribed
first_nameNo
last_nameNo
tagsNo

Implementation Reference

  • The `add_or_update_member` tool handler is implemented in `mcp_mailchimp/server.py` using `@mcp.tool()` to expose it to the MCP protocol. It performs an upsert operation on a Mailchimp list member using the Mailchimp API.
    @mcp.tool()
    async def add_or_update_member(
        list_id: str,
        email: str,
        status: str = "subscribed",
        first_name: str = "",
        last_name: str = "",
        tags: str = "",
    ) -> str:
        """Add a new subscriber or update if exists (upsert). Status: subscribed, pending, unsubscribed. Tags: comma-separated."""
        mc = get_client()
        h = mc.subscriber_hash(email)
        body: dict[str, Any] = {
            "email_address": email.lower().strip(),
            "status_if_new": status,
        }
        merge_fields: dict[str, str] = {}
        if first_name:
            merge_fields["FNAME"] = first_name
        if last_name:
            merge_fields["LNAME"] = last_name
        if merge_fields:
            body["merge_fields"] = merge_fields
        if tags:
            body["tags"] = [t.strip() for t in tags.split(",") if t.strip()]
        m = await mc.put(f"/lists/{list_id}/members/{h}", json=body)
        return _fmt({
            "email": m.get("email_address", ""),
            "status": m.get("status", ""),
            "id": m.get("id", ""),
            "message": "Member added/updated.",
        })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AlexlaGuardia/mcp-mailchimp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server