xaffinity MCP

io.github.yaniv-golan由 GitHub 帳號 yaniv-golan 發布v1.22.0更新於 Oct 27, 2026

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

已驗證STDIO僅桌面資料與分析商業與電商

概覽

AI 產生的概覽

面向 Affinity CRM 的本機 MCP 伺服器,讓助理搜尋人員、公司與商機,執行結構化查詢,並記錄互動或更新銷售流程。

可以做什麼
  • 搜尋與查詢人員、公司、商機,並取得單一實體的綜合檔案
  • 執行含篩選、關聯與彙總的結構化 JSON 查詢,或搜尋並執行唯讀 CLI 指令
  • 建立、更新、刪除紀錄,管理清單項目並變更流程階段
  • 取得關係強度分數並找出可引薦的人脈路徑
  • 在紀錄上記錄通話、會議、電子郵件與訊息
  • 使用內建提示完成會議簡報、流程檢視與互動摘要
適用情境
適合團隊 CRM 資料存放在 Affinity、希望助理不必切換應用程式就能準備會議簡報、檢視銷售流程、找出引薦路徑或記錄互動的情況。它是供 Claude Desktop、Claude Code 或其他 MCP 用戶端使用的桌面端附加元件。
執行需求
以 stdio 本機程序執行,MCPB 套件僅支援桌面端。需要 Python 3.10+ 與透過 pipx 安裝的 xaffinity CLI,以及透過 AFFINITY_API_KEY(或 CLI 設定)提供的 Affinity API 金鑰。手動安裝另需 Bash 3.2+ 與 jq 或 gojq,並需要連線至 Affinity API 的網路。
安裝前請注意
API 金鑰可存取你的 CRM 資料;在 Claude Desktop 輸入的金鑰會覆蓋設定檔或金鑰檔案變數中的金鑰。寫入工具可建立、更新、刪除與合併紀錄,破壞性指令無法復原。請為寫入指令保留用戶端的工具核准提示,不要選擇「永遠允許」;另有唯讀與停用破壞性指令的設定。擴充套件與 CLI 須同步升級,MCPB 套件不會自動更新。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 xaffinity MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

xaffinity MCP Server

An MCP (Model Context Protocol) server for Affinity CRM, built with the MCP Bash Framework.

Features

  • Entity Management - Search and lookup persons, companies, and opportunities
  • Workflow Management - View and update pipeline status, manage list entries
  • Relationship Intelligence - Get relationship strength scores and find warm intro paths
  • Interaction Logging - Log calls, meetings, emails, and messages
  • Session Caching - Efficient caching to minimize API calls

Quick Start

bash
# 1. Install the xaffinity CLIpipx install "affinity-sdk[cli]"
# 2. (Optional) Configure your API key - Claude Desktop will prompt if skippedxaffinity config setup-key
# 3. Install the MCP server (choose one)#    - Claude Desktop: Download and double-click xaffinity-mcp-*.mcpb#    - Other clients: See "Manual Installation" below#    - Claude Code: /plugin marketplace add yaniv-golan/affinity-sdk

Prerequisites

For Claude Desktop / MCPB Installation (Recommended)

The .mcpb bundle is self-contained — it includes the MCP Bash Framework and gojq. You only need:

RequirementHow to InstallVerify
Python 3.10+python.org or your package managerpython --version
xaffinity CLIpipx install "affinity-sdk[cli]"xaffinity --version
Affinity API keyxaffinity config setup-key (or let Claude Desktop prompt)xaffinity config check-key

Keep the CLI and the extension in step. They are installed separately. When you upgrade one, upgrade the other: download the latest .mcpb after pipx upgrade affinity-sdk, and the other way round. Since MCP 1.25.2, with a CLI older than the extension needs, changes are refused ("This MCP server needs the xaffinity CLI … or later to make changes") and reads still run with a warning that results may be incomplete. An older extension with a newer CLI can fail without saying why (for example, merges with CLI 1.22.0 need extension 1.25.1 or later). Claude Desktop never updates an extension installed from a .mcpb file: install each new release yourself.

For Manual Installation

Manual installation requires additional dependencies:

RequirementHow to InstallVerify
Bash 3.2+Included on macOS/Linux; Windows: use WSL or Git Bashbash --version
Python 3.10+python.org or your package managerpython --version
jq or gojqSee Installing jq/gojq belowjq --version or gojq --version
xaffinity CLIpipx install "affinity-sdk[cli]"xaffinity --version
Affinity API keyxaffinity config setup-keyxaffinity config check-key
Installing jq/gojq

Either jq or gojq works — the server auto-detects which is available.

Which to choose:

  • jq (recommended) — The original, widely available, full regex support
  • gojq — Pure Go implementation, also supports YAML, better error messages

Install jq:

PlatformCommand
macOSbrew install jq
Debian/Ubuntusudo apt-get install jq
Fedorasudo dnf install jq
Arch Linuxsudo pacman -S jq
Windowswinget install jqlang.jq or choco install jq

Install gojq (alternative):

PlatformCommand
macOSbrew install gojq
Any (Go required)go install github.com/itchyny/gojq/cmd/gojq@latest
Binary downloadGitHub Releases

Installation

Option 1: Claude Desktop (One-Click)

The .mcpb bundle is fully self-contained — it includes the MCP framework and JSON processor.

  1. Install the xaffinity CLI: pipx install "affinity-sdk[cli]"
  2. (Optional) Configure your API key: xaffinity config setup-key
    • If skipped, Claude Desktop will prompt for your API key during MCPB installation
  3. Download xaffinity-mcp-*.mcpb from the latest release
  4. Double-click the file or drag it into Claude Desktop

Note: MCPB bundles currently only work with Claude Desktop. Other clients require manual installation.

Option 2: Claude Code

bash
/plugin marketplace add yaniv-golan/affinity-sdk/plugin install affinity-crm-mcp-unofficial@xaffinity

Option 3: Manual Installation

For other MCP clients or development. Requires additional prerequisites.

  1. Download xaffinity-mcp-plugin.zip from the latest release
  2. Extract and configure your MCP client (see Usage below)
  3. The MCP Bash Framework runtime is vendored in .mcp-bash/ — no separate install needed to run the server.
  4. Optional — validate your configuration. validate and doctor are developer tools that need the full mcp-bash install (the vendored copy is runtime-only); the command prints the install line for the pinned version if it is missing:
    bash
    ./xaffinity-mcp.sh validate

Troubleshooting

Verify Installation

Before debugging, verify each layer works in order:

Step 1: CLI Installation

First, verify the CLI is installed and can reach the Affinity API. See CLI: Verify Installation.

bash
# Check CLI is installedxaffinity --version
# Check API connectivity (set your API key - same one entered in Claude Desktop)AFFINITY_API_KEY="your-key-here" xaffinity whoami --json

If whoami hangs, check network connectivity (firewall, proxy, VPN).

Step 2: MCP Server

Once the CLI works, test the MCP server end-to-end.

First, locate your MCP server directory:

bash
# MCPB installation (macOS)cd ~/Library/Application\ Support/Claude/Claude\ Extensions/local.mcpb.yaniv-golan.xaffinity-mcp/server
# Or find it automaticallycd "$(find ~ -name 'xaffinity-mcp.sh' -type f 2>/dev/null | head -1 | xargs dirname)"
Other platforms/installations
InstallationPath
MCPB (Windows)%APPDATA%\Claude\Claude Extensions\local.mcpb.yaniv-golan.xaffinity-mcp\server\
Manual installYour chosen extraction location
Development<repo>/mcp/

For MCPB installations: If Step 1 passes, your setup is complete. The MCP server shells out to CLI, so if CLI works with your API key, the MCP server will too. Restart Claude Desktop and test the tools there.

For manual installations: You can also test the MCP layer directly:

bash
AFFINITY_API_KEY="your-key-here" \  mcp-bash run-tool execute-read-command \  --args '{"command":"whoami"}'

Expected: JSON response with your user information.

If Step 1 works but Step 2 fails, the issue is MCP-specific. Run diagnostics (these need the full mcp-bash install, not just the vendored runtime — see step 4 of manual installation):

bash
./xaffinity-mcp.sh doctor./xaffinity-mcp.sh validate

Common Issues

ErrorCauseSolution
"Could not detect xaffinity CLI"CLI not installedpip install "affinity-sdk[cli]"
"older than this MCP server needs" / "This MCP server needs the xaffinity CLI X or later"Outdated CLIpipx upgrade affinity-sdk or pip install --upgrade "affinity-sdk[cli]"
"API key not configured"Missing credentialsxaffinity config setup-key
"No JSON processor found"jq/gojq not installed (manual install only)See Installing jq/gojq
"Framework not found"Vendored .mcp-bash/ directory missingcd mcp && mcp-bash vendor
Every tool call fails with "server.d/policy.sh was not loaded"The server's folder, server.d or policy.sh is writable by group or other users (common after a clone or unzip with umask 002), a symlink, or owned by another user. The server then refuses to run without its policy (read-only mode and other limits).Run the chmod go-w ... command the error names (or chmod -R go-w <server folder>), then restart the server

For detailed debugging, see docs/DEBUGGING.md.

Usage

With Claude Code

The server is automatically available through the Claude plugin at .claude-plugin/mcp.json.

With Other MCP Clients

Add to your MCP client configuration:

json
{  "mcpServers": {    "xaffinity": {      "command": "/path/to/affinity-sdk/mcp/xaffinity-mcp.sh"    }  }}

Tools

CLI Gateway (Primary Interface)

The CLI Gateway provides full access to the xaffinity CLI with minimal token overhead:

ToolDescription
discover-commandsSearch CLI commands by keyword (e.g., "create person", "delete note")
execute-read-commandExecute read-only CLI commands (get, search, list)
execute-write-commandExecute write CLI commands (create, update, delete)

Query Tool

ToolDescription
queryExecute structured JSON queries with filters, joins, and aggregations

For complex data analysis (filtering, grouping, aggregations), use the query tool instead of individual CLI commands. See the Query Language Reference for full documentation.

Utility Tools

ToolDescription
get-entity-dossierGet comprehensive info for an entity (aggregates 5+ CLI calls)
read-xaffinity-resourceRead static MCP resources (data-model, etc.)
CLI Gateway Usage
  1. Discover the right command:

    json
    {"query": "add person to list", "category": "write"}

    Returns compact text format:

    # cmd|cat|params (s=str i=int b=bool f=flag !=req *=multi)list entry add|w|LIST:s! --person-id:i --company-id:i
  2. Execute the command:

    json
    {"command": "list entry add", "argv": ["Pipeline", "--person-id", "123"]}
Output Formats

Control the format of command results for optimal token efficiency:

json
{"command": "person ls", "format": "markdown"}
FormatToken EfficiencyBest For
jsonLowProgrammatic use (default)
markdownMedium-HighLLM comprehension - best for analysis tasks
toonHigh (~40% fewer)Large datasets, batch operations
csvMediumSpreadsheet export
jsonlMediumStreaming workflows

Recommendations:

  • Use markdown when you need to analyze or summarize data (LLMs read tables well)
  • Use toon for large exports to minimize tokens (30-60% smaller than JSON)
  • Use json when you need full structure with pagination/metadata
Destructive Commands

Commands that cannot be undone (delete, merge) need the user's confirmation:

  • In clients that support confirmation dialogs (MCP elicitation), the server asks you directly.
  • Claude Desktop extensions get no dialog. The tool refuses the first call and tells Claude to ask you in the conversation; Claude retries with confirm: true only after you agree:
json
{"command": "person delete", "argv": ["456"], "confirm": true}

The tool appends --yes for the CLI. Since MCP 1.27.0 confirm: true counts only after the server refused that exact command (or showed its dialog) in the last 15 minutes, once: if Claude sets it on its first call, the call is refused and Claude is told to ask you. The server can't see the conversation, so it can't tell whether you really agreed: keep Claude Desktop's tool-approval prompt on for execute-write-command and don't choose "always allow" — that prompt is the check that needs you.

Using Affinity's own connector too? If both this extension and Affinity's claude.ai connector are connected, Claude may pick either one. Say "use the xaffinity tools" when you mean this one.

Prompts

PromptDescription
prepare-briefingPrepare for a meeting with comprehensive context
log-interaction-and-update-workflowLog interaction and update pipeline
pipeline-reviewReview a workflow pipeline
change-statusChange workflow status with documentation
warm-introFind warm introduction paths
log-callQuick log a phone call
log-messageQuick log a chat/text message
interaction-briefGet interaction history summary

Configuration

API Key

The MCP server uses the xaffinity CLI, which resolves API keys in this order (highest priority first):

PrioritySourceDescription
1--api-key-fileCLI flag (reads from file, or - for stdin)
2--api-key-stdinCLI flag (reads from stdin)
3AFFINITY_API_KEY env var← Claude Desktop sets this. A .env file loaded with --dotenv can also set it
4AFFINITY_API_KEY_FILE env varPath to a file containing the key
5AFFINITY_API_KEY_COMMAND env varCommand whose stdout is the key
6Config fileapi_key in the user config file (xaffinity config path)

The MCP server doesn't pass the key flags, so for it the environment comes first.

Claude Desktop / MCPB: When you enter an API key in the Claude Desktop configuration UI, it's passed to the MCP server as the AFFINITY_API_KEY environment variable (priority 3). This means:

  • It overrides AFFINITY_API_KEY_FILE, AFFINITY_API_KEY_COMMAND and your config file
  • If you have a key configured via xaffinity config setup-key AND enter one in Claude Desktop, the Claude Desktop key wins

Recommendation: Use ONE of these methods:

  • Claude Desktop only: Enter your key in the MCPB configuration UI (simplest)
  • CLI + MCP: Run xaffinity config setup-key and leave the Claude Desktop field empty
  • Environment variable: Set AFFINITY_API_KEY in your shell profile

Read-Only Mode

Set AFFINITY_MCP_READ_ONLY=1 (or true) to block all write tools. In the Claude Desktop bundle this is the Read-Only Mode setting.

bash
AFFINITY_MCP_READ_ONLY=1 ./xaffinity-mcp.sh

Disable Destructive Commands

Set AFFINITY_MCP_DISABLE_DESTRUCTIVE=1 (or true) to allow writes but block commands that cannot be undone (delete, merge), even with confirmation. In the bundle this is Disable Destructive Commands.

bash
AFFINITY_MCP_DISABLE_DESTRUCTIVE=1 ./xaffinity-mcp.sh

Check that a setting took effect: ask Claude to run a dry-run person delete 1. With read-only on, it is refused with "Writes are off: the server is in read-only mode"; with destructive commands disabled, it returns destructive_disabled. Nothing is changed either way.

Cache TTL

Adjust cache duration (default 10 minutes):

bash
AFFINITY_SESSION_CACHE_TTL=300 ./xaffinity-mcp.sh

Affinity API version

By default every request uses your API key's default Affinity V2 API version. To pin one (e.g. to get the newest response shapes), set AFFINITY_API_VERSION (or the Affinity API Version field in Claude Desktop's extension settings):

bash
AFFINITY_API_VERSION=2026-09-17 ./xaffinity-mcp.sh

Accepted values: 2024-01-01, 2026-07-15, 2026-09-17, or current (always the newest). AFFINITY_PROFILE is also passed through, so a profile from the xaffinity config file (including its api_version) can be selected. Tool results report the version that answered in meta.affinityApiVersion. See the API versions guide.

Update Notifications

The MCP server checks for CLI updates at startup and displays a warning if a new version is available. This helps MCP-only users (who don't run CLI commands directly) stay up to date.

Update checks are:

  • Non-blocking: The check runs in the background and doesn't delay server startup
  • Throttled: Background checks are limited to once per 24 hours
  • Respectful: Honors user opt-out via XAFFINITY_NO_UPDATE_CHECK=1 or config file

To disable update notifications:

bash
# Via environment variableXAFFINITY_NO_UPDATE_CHECK=1 ./xaffinity-mcp.sh
# Or via CLI configxaffinity config update-check --disable

Development

Run Diagnostics

bash
./xaffinity-mcp.sh doctor

Debug Mode

Enable debug logging for troubleshooting. Debug mode shows version info at startup and adds component prefixes to all log messages.

bash
# Persistent debug mode (recommended - survives reinstalls)mkdir -p ~/.config/xaffinity-mcp && touch ~/.config/xaffinity-mcp/debug
# Session-only via environment variableXAFFINITY_MCP_DEBUG=1 ./xaffinity-mcp.sh
# Disable persistent debug moderm ~/.config/xaffinity-mcp/debug

When debug mode is enabled, logs show:

[xaffinity-mcp:1.2.3] Debug mode enabled[xaffinity-mcp:1.2.3] Versions: mcp=1.2.3 cli=0.6.9 mcp-bash=v0.9.3[xaffinity-mcp:1.2.3] Process: pid=12345 started=2026-01-06T10:30:00-08:00
Log Locations
ContextLog Location
Claude Desktop (macOS)~/Library/Logs/Claude/mcp-server-xaffinity MCP.log
Claude Desktop (Windows)%APPDATA%\Claude\Logs\mcp-server-xaffinity MCP.log
CLI standalonestderr (console)
Advanced Debug Options
VariableDescription
XAFFINITY_MCP_DEBUG=1Enable debug mode (cascades to all components)
MCPBASH_LOG_VERBOSE=trueShow paths in logs (exposes file paths)
MCPBASH_TRACE_TOOLS=trueEnable shell tracing (set -x) for tools

See docs/DEBUGGING.md for full debugging guide.

Claude Code Plugin

The MCP server is also available as a Claude Code plugin, distributed via the repository's own marketplace (.claude-plugin/marketplace.json). For standalone MCP server usage with other clients, see the main MCP documentation.

The plugin files must be assembled before publishing:

Build the plugin
bash
make plugin

This copies the MCP server files into .claude-plugin/:

  • xaffinity-mcp.sh, xaffinity-mcp-env.sh
  • tools/, prompts/, resources/, lib/
  • completions/, providers/, scripts/, server.d/
Clean build artifacts
bash
make clean
Plugin structure
.claude-plugin/├── plugin.json          # Plugin manifest (checked in)├── skills/              # Claude Code skills (checked in)├── xaffinity-mcp.sh     # MCP server (copied by make)├── tools/               # MCP tools (copied by make)├── prompts/             # MCP prompts (copied by make)└── ...                  # Other MCP files (copied by make)

See CONTRIBUTING.md for release instructions.

License

See the main repository license.

來源:mcp/README.md,提交 6e1336d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.22.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分