Xaffinity MCP logo

Xaffinity MCP

MCP server for Affinity CRM - entity search, relationship intelligence, and workflow management

Install Xaffinity MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "xaffinity-mcp": {
      "command": "uvx",
      "args": [
        "affinity-sdk"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx affinity-sdk

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 2d ago.

Overview

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

5/5 checks healthy over the last 45d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8d ago via OSV.dev · affinity-sdk (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

Last commit9d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

From the project README

Affinity Python SDK

CI Coverage PyPI version Python versions License: MIT Typed Pydantic v2 Documentation MCP MCP Bash Framework Claude Code Built with Skill Creator Plus

A modern, strongly-typed Python wrapper for the Affinity CRM API.

Disclaimer: This is an unofficial community project and is not affiliated with, endorsed by, or sponsored by Affinity. “Affinity” and related marks are trademarks of their respective owners. Use of the Affinity API is subject to Affinity’s Terms of Service.

Maintainer: GitHub: yaniv-golan

Documentation: https://yaniv-golan.github.io/affinity-sdk/latest/

Affinity's Official MCP Server

Affinity runs an official MCP Server: a hosted server you connect to from Claude, ChatGPT, Copilot, Notion and other AI clients with OAuth sign-in. It reads and updates most CRM records and is the easiest way to work with Affinity in a chat.

This SDK serves a different purpose — it's a strongly-typed Python client and CLI for the Affinity API (companies, persons, opportunities, lists, field values, notes, reminders, interactions, webhooks, files, and more). Use it when you work with Affinity in code, scripts or a terminal: bulk updates, exports, data pipelines, webhooks, or custom integrations and tooling.

For a detailed comparison, see Affinity SDK vs. Official MCP.

Table of Contents

Features

  • Broad API coverage - V1 and V2, routed per operation (6 V2 operations still planned)
  • CLI included - Scriptable command-line interface for automation
  • Strong typing - Full Pydantic V2 models with typed ID classes
  • No magic numbers - Comprehensive enums for all API constants
  • Automatic pagination - Iterator support for seamless pagination
  • Rate limit handling - Automatic retry with exponential backoff
  • Response caching - Optional caching for field metadata
  • Both sync and async - Full support for both patterns

AI Integrations

  • Claude Code plugins - SDK and CLI knowledge for AI-assisted development
  • MCP Server - Connect desktop AI tools to Affinity

Installation

Terminal
pip install affinity-sdk

Requires Python 3.10+.

Optional (local dev): load .env automatically:

Terminal
pip install "affinity-sdk[dotenv]"

Optional: install the CLI:

bash
pipx install "affinity-sdk[cli]"

The CLI includes a powerful query command for structured data extraction with filtering, aggregations, and relationship includes. Output formats include JSON, CSV, markdown, and TOON (token-optimized for LLMs).

CLI docs: https://yaniv-golan.github.io/affinity-sdk/latest/cli/

MCP Server

Connect desktop AI tools to Affinity CRM.

Claude Desktop (easiest - MCPB bundle):

  1. Install CLI: pipx install "affinity-sdk[cli]"
  2. (Optional) Pre-configure API key: xaffinity config setup-key
    • If skipped, Claude Desktop will prompt for your API key during MCPB install
  3. Download the .mcpb bundle from GitHub Releases
  4. Double-click to install (or drag to Claude Desktop)

Other clients (Cursor, Windsurf, VS Code + Copilot, Zed, etc.):

These require manual configuration. See the MCP Server docs for step-by-step instructions.

MCP docs: https://yaniv-golan.github.io/affinity-sdk/latest/mcp/

Claude Code Plugins

If you use Claude Code, install plugins for SDK/CLI knowledge:

bash
/plugin marketplace add yaniv-golan/affinity-sdk
/plugin install affinity-crm-sdk-unofficial@xaffinity   # SDK patterns
/plugin install affinity-crm-cli-xaffinity-unofficial@xaffinity   # CLI patterns + hooks

Plugin docs: https://yaniv-golan.github.io/affinity-sdk/latest/guides/claude-code-plugins/

Documentation

Quick Start

server.ts
from affinity import Affinity
from affinity.types import FieldType, PersonId

# Recommended: read the API key from the environment (AFFINITY_API_KEY)
client = Affinity.from_env()

# If you use a local `.env` file (requires `affinity-sdk[dotenv]`)
# client = Affinity.from_env(load_dotenv=True)

# Or pass it explicitly
# client = Affinity(api_key="your-api-key")

# Or use as a context manager
with Affinity.from_env() as client:
    # List all companies
    for company in client.companies.all():
        print(f"{company.name} ({company.domain})")

    # Get a person with enriched data
    person = client.persons.get(
        PersonId(12345),
        field_types=[FieldType.ENRICHED, FieldType.GLOBAL]
    )
    print(f"{person.first_name} {person.last_name}: {person.primary_email}")

Usage Examples

Working with Companies

server.ts
from datetime import date

from affinity import Affinity
from affinity.criteria import Condition, Sort, all_of
from affinity.models import CompanyCreate
from affinity.types import CompanyId

with Affinity(api_key="your-key") as client:
    # Filter and sort on Affinity's side (V2 search, beta)
    page = client.companies.find(
        all_of(
            Condition("field-498220", "is-any-of", [3, 4]),
            Condition("affinity-data-last-funding-date", "is-after", date(2025, 1, 1)),
        ),
        sort=[Sort("affinity-data-total-funding-amount", "desc")],
        limit=50,
    )

    # Iterate through all companies with automatic pagination
    for company in client.companies.all():
        print(f"{company.name}: {company.fields}")

    # Get a specific company
    company = client.companies.get(CompanyId(123))

    # Create a company (uses V1 API)
    new_company = client.companies.create(
        CompanyCreate(
            name="Acme Corp",
            domain="acme.com",
        )
    )

    # Search by name, domain, or email
    results = client.companies.search("acme.com")

    # Get list entries for a company
    entries = client.companies.get_list_entries(CompanyId(123))

Working with Persons

server.ts
from affinity import Affinity
from affinity.models import PersonCreate
from affinity.types import PersonType

with Affinity(api_key="your-key") as client:
    # Get all internal team members
    for person in client.persons.all():
        if person.type == PersonType.INTERNAL:
            print(f"{person.first_name} {person.last_name}")

    # Create a contact
    person = client.persons.create(
        PersonCreate(
            first_name="Jane",
            last_name="Doe",
            emails=["jane@example.com"],
        )
    )

    # Search by email
    results = client.persons.search("jane@example.com")

Working with Lists

server.ts
from affinity import Affinity, FieldResolver, ResolveMode
from affinity.models import ListCreate
from affinity.types import CompanyId, FieldId, FieldType, ListId, ListType

with Affinity(api_key="your-key") as client:
    # Get all lists
    for lst in client.lists.all():
        print(f"{lst.name} ({lst.type.name})")

    # Get a specific list with field metadata
    pipeline = client.lists.get(ListId(123))
    print(f"Fields: {[f.name for f in pipeline.fields]}")

    # Create a new list
    new_list = client.lists.create(
        ListCreate(
            name="Q1 Pipeline",
            type=ListType.OPPORTUNITY,
            is_public=True,
        )
    )

    # Work with list entries
    entries = client.lists.entries(ListId(123))

    # List entries with field data
    for entry in entries.all(field_types=[FieldType.LIST]):
        print(f"{entry.entity.name}: {entry.fields}")

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Xaffinity MCP

xaffinity MCP is an MCP server that connects AI clients and developer workflows to Affinity CRM for entity search, relationship intelligence, and workflow management. It is associated with the Affinity Python SDK, an unofficial, strongly typed community project for the Affinity API, with documentation and MCP integration available through project resources.

xaffinity MCP supports entity search, relationship intelligence, and workflow management within Affinity CRM. These capabilities are intended for working with CRM data and processes through an MCP server.

No. The project README identifies the Affinity Python SDK as an unofficial community project and separately references Affinity’s official hosted MCP server. xaffinity MCP is associated with the community SDK rather than being described as Affinity’s official server.

xaffinity MCP is for developers and AI workflows that need to work with Affinity CRM through the Model Context Protocol. The underlying project is a strongly typed Python SDK and CLI for custom integrations, scripts, automation, and tooling.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewXaffinity MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/xaffinity-mcp?style=directory)](https://allmcps.com/mcp/xaffinity-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/xaffinity-mcp"><img src="https://allmcps.com/api/badge/xaffinity-mcp?style=directory" alt="Xaffinity MCP on AllMCPs" /></a>