
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
概览
面向 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 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 xaffinity MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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
Prerequisites
For Claude Desktop / MCPB Installation (Recommended)
The .mcpb bundle is self-contained — it includes the MCP Bash Framework and gojq. You only need:
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:
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:
Install gojq (alternative):
Installation
Option 1: Claude Desktop (One-Click)
The .mcpb bundle is fully self-contained — it includes the MCP framework and JSON processor.
- Install the xaffinity CLI:
pipx install "affinity-sdk[cli]" - (Optional) Configure your API key:
xaffinity config setup-key- If skipped, Claude Desktop will prompt for your API key during MCPB installation
- Download
xaffinity-mcp-*.mcpbfrom the latest release - 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
Option 3: Manual Installation
For other MCP clients or development. Requires additional prerequisites.
- Download
xaffinity-mcp-plugin.zipfrom the latest release - Extract and configure your MCP client (see Usage below)
- The MCP Bash Framework runtime is vendored in
.mcp-bash/— no separate install needed to run the server. - Optional — validate your configuration.
validateanddoctorare 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:
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.
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:
Other platforms/installations
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:
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):
Common Issues
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:
Tools
CLI Gateway (Primary Interface)
The CLI Gateway provides full access to the xaffinity CLI with minimal token overhead:
Query Tool
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
CLI Gateway Usage
-
Discover the right command:
Returns compact text format:
-
Execute the command:
Output Formats
Control the format of command results for optimal token efficiency:
Recommendations:
- Use
markdownwhen you need to analyze or summarize data (LLMs read tables well) - Use
toonfor large exports to minimize tokens (30-60% smaller than JSON) - Use
jsonwhen 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: trueonly after you agree:
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
Configuration
API Key
The MCP server uses the xaffinity CLI, which resolves API keys in this order (highest priority first):
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_COMMANDand your config file - If you have a key configured via
xaffinity config setup-keyAND 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-keyand leave the Claude Desktop field empty - Environment variable: Set
AFFINITY_API_KEYin 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.
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.
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 returnsdestructive_disabled. Nothing is changed either way.
Cache TTL
Adjust cache duration (default 10 minutes):
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):
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=1or config file
To disable update notifications:
Development
Run Diagnostics
Debug Mode
Enable debug logging for troubleshooting. Debug mode shows version info at startup and adds component prefixes to all log messages.
When debug mode is enabled, logs show:
Log Locations
Advanced Debug Options
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
This copies the MCP server files into .claude-plugin/:
xaffinity-mcp.sh,xaffinity-mcp-env.shtools/,prompts/,resources/,lib/completions/,providers/,scripts/,server.d/
Clean build artifacts
Plugin structure
See CONTRIBUTING.md for release instructions.
License
See the main repository license.
来源:mcp/README.md,提交 6e1336d
工具
0版本历史
1- v1.22.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分