# @ghostpaw/affinity [Health: Active]

**Category:** 👤 Customer Data Platforms  
**Repository:** https://github.com/GhostPawJS/affinity  
**GitHub Stars:** 1  
**npm Downloads (last month):** 1689  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/ghostpaw-affinity

## Description
Relationship intelligence and social CRM model for Node.js — SQLite, zero dependencies, with a built-in LLM tool facade

## Tools
Capabilities this server exposes over MCP:

- **search_affinity** — Search contacts by name, identity, attributes, link roles, bonds and event text. All whitespace tokens must match. Dormant and lost contacts are excluded by default; use includeDormant and includeLost to include them.
- **review_affinity** — Review one affinity surface such as contacts, journals, link queues, commitments, dates, graph state, or merge history.
- **inspect_affinity_item** — Inspect one exact affinity item such as the owner profile, a contact profile, or one link detail.
- **manage_contact** — Create, revise, export or permanently delete a contact (confirm: true required; owner cannot be deleted). Export without contact exports the whole database. Lifecycle lost is soft delete. ALWAYS search_affinity first before creating — duplicates corrupt the graph.
- **merge_contacts** — Merge one loser contact into one winner contact using explicit contact locators.
- **manage_duplicate_dismissal** — Dismiss or un-dismiss a duplicate candidate pair so it does not resurface in review_affinity contacts.duplicates.
- **manage_identity** — Add, revise, verify, or remove one routing identity on a contact. Use this for emails, phone numbers, social handles, and URLs — anything that could locate a person. Do not use manage_attribute for these.
- **manage_relationship** — Seed social links, revise bond and state, and manage structural ties. Seed a link as soon as a relationship is mentioned — do not wait for repeated evidence.
- **record_event** — Record one social event such as an interaction, observation, milestone, or transaction. For interactions, milestones, and transactions the owner contact is auto-injected into participants if missing. Observations may omit the owner when recording third-party evidence.
- **manage_commitment** — Record or resolve one commitment such as a promise or agreement. The owner contact is auto-injected into participants if missing.
- **manage_date_anchor** — Add, revise, or remove recurring date anchors on contacts or links. Use this for birthdays, anniversaries, and yearly events — not manage_attribute.
- **manage_attribute** — Set, unset, or replace custom metadata attributes on contacts, links and events. For emails, phones, handles, and URLs use manage_identity instead — those are routing keys, not attributes.
- **manage_event** — Revise or delete one event by eventId or external reference. Delete requires confirm=true and recomputes affected relationships.
- **check_contactable** — Check do-not-contact flags through works_at and member_of ties.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "affinity": {
    "command": "npx",
    "args": ["-y","@ghostpaw/affinity","mcp"],
    "env": {
      "GHOSTPAW_AFFINITY_DB": ""
    }
  }
}
```

**Requires environment variables:** `GHOSTPAW_AFFINITY_DB` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What @ghostpaw/affinity does

@ghostpaw/affinity stores relationship data for an agent in a SQLite file. The model covers contacts, routing identities, social links, journal events, commitments, recurring date anchors, custom attributes, duplicate candidates, and relationship graph state. It is suited to personal or agent-managed relationship records rather than a general-purpose customer database.

The server exposes MCP operations for finding people, inspecting stored records, maintaining the graph, and checking whether a contact can be approached. Search can match names, identities, attributes, link roles, bonds, and event text. By default, dormant and lost contacts are omitted from search results.

## How it works

The command-line binary runs against a database located at `~/.ghostpaw/affinity.db` by default. Use `--db <path>` or `GHOSTPAW_AFFINITY_DB` to select another file; relative database paths are resolved from the current working directory. The npm package requires Node.js 24 or newer and has no runtime dependencies.

The data model distinguishes identities from ordinary attributes. Emails, phone numbers, social handles, and URLs belong in identity records because they can locate a person. Other custom metadata belongs in attributes. Relationships can be seeded when first mentioned, while events, promises, and recurring dates provide additional context over time.

## Setup and configuration

Install the latest platform binary for Linux x64, Linux arm64, macOS Apple silicon, macOS Intel, or Windows x64. The release archives are checked against `SHA256SUMS`. Linux installs to `~/.local/bin`, macOS installs to `/usr/local/bin`, and Windows installs to `%LOCALAPPDATA%\\Programs\\ghostpaw\\bin`; the installers also handle PATH updates for those locations.

For npm-based environments, run `npx -y @ghostpaw/affinity --help` or install the package globally with `npm install -g @ghostpaw/affinity`. A library installation is also available with `npm install @ghostpaw/affinity`.

Initialize an owner with `ghostpaw-affinity contact create '{"name":"Owner","kind":"agent"}' --bootstrap-owner`. The command-line interface also includes `search` and `skill` commands for querying records and viewing the tool reference.

## Tools and capabilities

- `search_affinity` searches across contact and relationship context, with options to include dormant or lost contacts.
- `review_affinity` reviews contacts, journals, link queues, commitments, dates, graph state, or merge history.
- `inspect_affinity_item` retrieves a specific owner, contact, or link record.
- Contact tools create, revise, export, delete, merge, and dismiss duplicate candidates.
- Identity, relationship, event, commitment, date-anchor, and attribute tools maintain different parts of the model.
- `check_contactable` evaluates do-not-contact flags through `works_at` and `member_of` ties.

## Limitations and notes

Search requires every whitespace-separated token to match. Creating a contact should follow a `search_affinity` lookup because duplicates can damage the graph. Permanent contact and event deletion require confirmation; deleting the owner is prohibited, while a lost contact is handled as a soft deletion. Exporting without naming a contact exports the complete database. The owner is automatically added to participants for applicable interactions, milestones, transactions, and commitments, but third-party observations may omit the owner.

_Full upstream README: https://allmcps.com/mcp/ghostpaw-affinity/readme_

