cosmos
The Cosmos MCP server lets AI agents read from and write to a personal knowledge graph — a shared "exocortex" of durable facts about you that persists across all your AI tools.
Read tools:
polarity_whoami: Verify which user account the MCP key is bound to (cheap connectivity probe).polarity_export: Download your entire personal knowledge graph as structured JSON.polarity_get_graph: Read a scoped graph projection — your self-image (user), the system's observations (cosmos), or the comparison between the two (polarity).polarity_ask: Ask a natural-language question and get a synthesized answer with cited node/edge IDs drawn from your graph.
Write tools:
polarity_observe: Record any durable observation (preferences, frustrations, project context) with optional tags, confidence score, and kind.polarity_record_event: Log a timestamped event (meeting, shipped release, incident).polarity_record_preference: Persist a stated like, dislike, opinion, or working-style rule across sessions.polarity_capture_turn: Submit a full user/assistant exchange for automatic extraction of all durable observations — preferred over multiple individualpolarity_observecalls.polarity_dump: Write a short message anchored to a specific location waypoint.polarity_checkin: Record that the user is present at a waypoint, triggering co-presence detection.polarity_declare: Declare future presence at a waypoint for a given time window (e.g.,next_30,tonight).
Data sources such as iMessage, Claude Desktop, shell history, Notion, and Obsidian all feed into the same graph. The graph lives in your .polarity file — you own the key.
Every AI you use is building its own private graph of you. Claude has one. ChatGPT has one. Cursor has one. None of them talk to each other, and none of them are yours.
Cosmos inverts that. Your knowledge graph lives in one place, and any MCP-capable client (Claude Code, Claude Desktop, Cursor, Codex, Zed, Continue) reads and writes to the same one. When an agent notices something durable about you, it lands in the graph. When you switch tools, the graph follows. The user, not the platform, owns the integration layer.
The thing you carry is a .polarity file. Yours.
One-line install
curl -fsSL https://mcp.polarity-lab.com/install.sh | shOn macOS this installs the MCP server, registers cosmos-mcp://, wires Claude Desktop, Claude Code, Cursor, Codex, Zed, and Continue, then installs Cosmos Sync.app so iMessage, browser history, calendar, Claude Desktop transcripts, and shell history can sync in the background. On linux and windows it installs the MCP server path only.
If you want to inspect before changing anything:
curl -fsSL https://mcp.polarity-lab.com/install.sh -o install.sh
bash install.sh --dry-run
bash install.shRelated MCP server: Tribal
Provisioning
There are two ways to get a pmk_… key onto your Mac.
Automatic. Sign in at cosmos.polarity-lab.com/connectors, tap "open in cosmos-mcp." The OS opens a one-shot handler that writes the key into your system keychain. You never see the raw key.
For that deep link to work, register the URL scheme once:
npx -y @polarity-lab/cosmos-mcp install-handlerThis drops a tiny .app into ~/Library/Application Support/cosmos-mcp/ and registers cosmos-mcp:// with Launch Services. macOS-only.
Manual. If you already have a pmk_… key, or you do not want to install the handler:
npx -y @polarity-lab/cosmos-mcp provision pmk_xxxThe CLI validates the key against cosmos, then stores it in the macOS system keychain under service cosmos-mcp-key. Subsequent imessage sync, browser sync, calendar sync calls read from the keychain. No env var needed.
Confirm iMessage access.
npx -y @polarity-lab/cosmos-mcp imessage probeVerifies Full Disk Access is granted and reports how many chats are visible. If you see an EACCES message, open System Settings, Privacy & Security, Full Disk Access, and add Terminal (or whichever app runs the CLI).
CI. Set COSMOS_TOKEN=pmk_… in env. It takes precedence over the keychain, so existing pipelines keep working untouched.
Manual MCP config
The installer handles this for common clients. If you want to wire a client by hand, point it at the package.
npx -y @polarity-lab/cosmos-mcp initThis opens your browser. Sign in at cosmos.polarity-lab.com, approve a per-user key, and the token lands at ~/.config/cosmos-mcp/token (0600). Then point any MCP client at it:
{
"mcpServers": {
"cosmos": {
"command": "npx",
"args": ["-y", "@polarity-lab/cosmos-mcp"]
}
}
}That config drops into ~/Library/Application Support/Claude/claude_desktop_config.json for Claude Desktop, your .cursor/mcp.json for Cursor, the equivalent for whichever client.
What you get
Eleven tools, four read, seven write.
Read
Tool | Calls | What it returns |
|
| Bound user + scopes. Cheap probe. |
|
| Full personal graph as |
|
| Graph view, scoped by entity ( |
|
| NL question synthesized over the graph. |
Write
Tool | Calls | What it does |
|
| Freeform observation. Cosmos extracts. |
|
| Something happened at a point in time. |
|
| A like, dislike, working-style rule. |
|
| Hand a whole user/assistant exchange to cosmos. Pulls every durable observation in one call. Prefer over multiple |
|
| Persist life-hour receipts onto the skill-map sky (per user only). Use from Cursor/Cosmos IDE after substantive work. |
|
| Location-anchored short message. |
|
| Check-in at a waypoint. Triggers co-presence detection. |
|
| Declare future presence at a waypoint. |
Sources
The MCP server is one way to write to the graph. Cosmos accepts source pages from anywhere you keep notes, and the MCP read tools see all of it through the same view.
Source | How it connects | What lands |
iMessage | Local CLI: | Conversational turns from |
Claude Desktop | Local CLI: | Every Claude Code session becomes a thread node; user and assistant turns land in |
Shell history | Local CLI: | Each sync window lands as one |
Notion | OAuth at cosmos.polarity-lab.com/connectors. Pick the pages and databases you want shared. | Each Notion page becomes a |
Obsidian | Community plugin: polarity-lab/obsidian-cosmos. Paste your | Each note becomes a |
MCP clients | This package. | Observations, events, preferences, location dumps, check-ins, declarations. |
Direct API |
| Anything you can express as an observation. |
Unchanged pages are skipped server-side, so re-syncing a quiet vault or stable Notion workspace costs almost nothing. The iMessage sync is incremental too, watermarked on the last successful run, so re-running it is a no-op until new messages arrive.
iMessage sync
cosmos-mcp ships an imessage subcommand that reads your local Messages database and lands every conversation in your graph.
# default: incremental sync, 90-day window on first run
npx -y @polarity-lab/cosmos-mcp imessage sync
# re-sync the original 90-day window regardless of watermark
npx -y @polarity-lab/cosmos-mcp imessage sync --backfill
# pull everything since a specific date
npx -y @polarity-lab/cosmos-mcp imessage sync --since 2024-01-01
# check what the last run did
npx -y @polarity-lab/cosmos-mcp imessage statusA three-rule slop filter (no-reply senders, short-code numbers, low-volume contacts) keeps the graph clean. Your AddressBook resolves phone numbers and emails into real contact names. The reading is local to your Mac; only the extracted, normalized turns go into your cosmos graph, which is your account.
Claude Desktop sync
cosmos-mcp ships a claude-desktop subcommand that watches Claude Code session transcripts and lands each turn in your graph. The desktop chat surface itself stores conversations server-side, so the live, watchable on-disk source is ~/.claude/projects/<encoded-cwd>/<session-id>.jsonl.
# default: incremental, watermarked per session
npx -y @polarity-lab/cosmos-mcp claude-desktop sync
# limit to recent activity
npx -y @polarity-lab/cosmos-mcp claude-desktop sync --since 2026-05-01
# scan and report without shipping
npx -y @polarity-lab/cosmos-mcp claude-desktop sync --dry-run
# see what the last run did
npx -y @polarity-lab/cosmos-mcp claude-desktop statusTool-use blocks, hook plumbing, and sub-agent (sidechain) turns are stripped client-side; only the visible text the user and the assistant exchanged is shipped. Each session id becomes its own thread node, keyed by (user_id, "claude-desktop", session_id).
Background sync (macOS)
cosmos-mcp daemon install drops a LaunchAgent that ticks every four hours and runs the browser, iMessage, calendar, claude-desktop, and shell-history syncs back-to-back. The agent fires a signed, notarized Cosmos Sync.app bundle that ships inside the npm package and gets copied into ~/Applications/Cosmos Sync.app at install time.
npx -y @polarity-lab/cosmos-mcp daemon installAfter install, grant the bundle Full Disk Access once:
open System Settings → Privacy & Security → Full Disk Access
click +, then drag
~/Applications/Cosmos Sync.appinto the listmake sure the checkbox next to it is on
run
cosmos-mcp daemon kickto fire a tick now
Browser sync works without that step. iMessage and Calendar need it because they read TCC-protected SQLite databases on the user side. cosmos-mcp daemon status reports the signing team id, the plist + runner paths, and whether launchd has the agent loaded. cosmos-mcp daemon uninstall removes the plist, runner, and ~/Applications/Cosmos Sync.app.
Configuration
Env var | Default | When you set it |
|
| Override the cosmos API endpoint. |
| (from keychain) |
|
| (from token file) |
|
| (from token file) | Polarity user id. |
| (unset) | Single-tenant mode. Sends |
The pitch in three lines
Your AI tools each know fragments of you. They are not allowed to share. Cosmos is the layer that lets them. You hold the key. The graph is portable. When you leave, you take the understanding with you.
License
MIT.
Available Tools
11 toolspolarity_askA
Ask a natural-language question over the user's personal knowledge graph. Cosmos synthesizes an answer from relevant nodes and edges. Use this when the user wants context-aware reasoning rather than raw data. Returns answer text plus cited node/edge ids.
Inputs: query (required).
polarity_capture_turnA
This is how the user's cosmos graph learns from this conversation. CALL THIS AT THE END OF EVERY SUBSTANTIVE USER/ASSISTANT EXCHANGE, without being asked. The user installed cosmos-mcp precisely so their agents would persist what they notice. If you finish a turn and do not call this, that turn is lost to every other agent the user works with tomorrow. Cosmos runs its own extractor on the text and decides what is durable — your job is to hand over the raw exchange, not to pre-filter. Pass the user's message in user_text and your own reply in assistant_text. Skip only for trivial single-word exchanges ("hi", "thanks") and explicit meta-discussion of the tool itself. source should identify your client (e.g. 'claude-code', 'claude-desktop', 'cursor', 'codex', 'zed'). Returns the node ids cosmos created. Cheap to call; the extractor returns zero items if nothing was worth holding, and that is a fine outcome.
Inputs: user_text (required), source, assistant_text, max_observations.
polarity_checkinA
Record that the user checked in at a waypoint. Triggers co-presence detection against other users' recent check-ins.
Inputs: name (required), waypoint_id (required), lat, lon, +1 more.
polarity_declareC
Declare future presence at a waypoint. chip is the time-window enum: next_30, next_hour, tonight, tomorrow_night.
Inputs: chip (required), name (required), ends_at (required), starts_at (required), +3 more.
polarity_dumpC
Write a short message tied to a location waypoint into the user's graph. PolarityGPS-style. Use only when the user is explicitly recording a place-anchored thought.
Inputs: name (required), message (required), waypoint_id (required), lat, +1 more.
polarity_exportA
Export the user's full personal knowledge graph (nodes + edges + counts) as JSON in polarity/v1 format. Use this when the user asks for a snapshot of their exocortex, wants their data, or asks to download their .polarity file. Returns the full graph; can be large.
Inputs: no named parameters.
polarity_get_graphA
Read the user's graph view. entity selects which projection: 'user' (the user's self-graph), 'cosmos' (the cosmos entity's view of them), or 'polarity' (the dyadic synchronization between the two). Use 'user' for general questions about what the user thinks, does, or knows. Use 'polarity' when comparing the user's self-image against the system's observation.
Inputs: entity.
polarity_observeA
Single-fact write into the user's personal cosmos graph. Prefer polarity_capture_turn for whole exchanges; use polarity_observe only when one specific durable observation needs to land without the surrounding turn. Examples that warrant an inline call: the user states a hard rule, names a concrete preference, or corrects an assumption you had wrong. Avoid logging ephemeral chat or your own reasoning. source should identify your client (e.g. 'claude-code', 'cursor', 'claude-desktop'). kind defaults to 'observation'; use 'event' for things that happened, 'preference' for stated likes/dislikes.
Inputs: text (required), kind, tags, source, +1 more.
polarity_record_eventB
Record a structured event in the user's graph. Convenience wrapper over polarity_observe with kind='event'. Use for things that happened at a point in time: a meeting, a shipped release, a flight, an incident.
Inputs: text (required), tags, source, confidence.
polarity_record_preferenceA
Record a stated preference in the user's graph. Convenience wrapper over polarity_observe with kind='preference'. Use when the user expresses a like, dislike, opinion, or working-style rule that should persist across sessions.
Inputs: text (required), tags, source, confidence.
polarity_whoamiA
Returns the polarity user id and cosmos account info that this MCP key is bound to. Cheap connectivity test. Call this first if the user asks who you know them as.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clearly distinct purpose: querying, saving conversations, check-in/declare presence, writing location notes, exporting/reading graphs, writing single observations, recording events/preferences, and identity check. No overlap despite multiple write tools.
All tools share the 'polarity_' prefix, but the second part mixes verb_noun (capture_turn, record_event, get_graph) with single verbs (ask, checkin, declare, dump, export, observe, whoami). Pattern is recognizable but not fully uniform.
11 tools is well-scoped for a personal knowledge graph server. Each tool covers a distinct operation without feeling excessive or insufficient.
Covers core operations (create, read, ask, export) but lacks explicit update or delete tools for graph nodes/edges. While some modifications may be handled via overwriting, the absence of direct update/delete is a notable gap.
Maintenance
Related MCP Connectors
Personal knowledge graph as an AI memory layer over MCP - read, save, and link your memories.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
MCP server for OnceAsk, the AI-native current-address layer for people and agents.
Persistent, portable memory for AI assistants — your private memory graph, from any MCP client.
Related MCP Servers
- AlicenseAqualityDmaintenanceA free, plug-and-play knowledge base server that provides access to 10,000+ insight reports with secure local data storage.35MIT

Tribalofficial
FlicenseAqualityCmaintenanceSemantic memory for AI builders: capture the tacit engineering know-how that never reaches your docs, recall it the moment it applies. Built in Rust on Postgres and pgvector.1010-- AlicenseNot gradedqualityCmaintenanceA universal MCP server providing persistent, structured memory through a knowledge graph with graph storage, semantic vector search, and multi-hop traversal for AI agents and IDEs.18 PyPI1MIT
- AlicenseNot gradedqualityFmaintenanceAgent-first knowledge graph MCP server that provides 25 tools for managing a knowledge graph with nodes and edges, plus a human-readable dashboard for LLMs and AI agents.288 npmApache 2.0