Skip to main content
Glama
People Graph MCP
by Yargf0

People Graph MCP

People Graph MCP builds an offline people directory and interaction graph from Telegram Desktop JSON, WhatsApp .txt, email mbox archives, or JSONL. Find senders and message excerpts, inspect connections and the messages that support them, open a person's activity portrait through four read-only MCP tools, explore the graph in a local loopback viewer, or export Markdown (Obsidian), GraphML, GEXF, JGF, or JSON.

Install and try the demo

Use Python 3.10+ with SQLite FTS5 (zero external runtime dependencies). From the repository root, install the package and import a synthetic export into a database outside the checkout.

python -m pip install .
people-graph-import fixtures/telegram-demo.json --db "<absolute-path-to-demo-db>"
people-graph-mcp --db "<absolute-path-to-demo-db>"

people-graph-mcp --db ... starts a stdio server. It waits for JSON-RPC requests on stdin and writes replies to stdout. Launch it through an MCP client using the setup examples under Connect over MCP.

The importer detects the input format from the filename by default. To override it, pass --format telegram|jsonl|whatsapp|mbox. Use --chat-title to name a WhatsApp chat.

people-graph-import fixtures/universal-demo.jsonl --db "<absolute-path-to-jsonl-db>"
people-graph-import fixtures/whatsapp-demo.txt --db "<absolute-path-to-wa-db>" --chat-title "Astronomy Club"
people-graph-import fixtures/email-demo.mbox --db "<absolute-path-to-mail-db>"

Each JSONL line is a message object. The required fields are chat_id, sender_id, and date.

{"chat_id":"saturn","sender_id":"alice","date":"2026-08-14T21:00:00Z","text":"I aligned the telescope with Vega."}

Export the database to Obsidian-ready Markdown cards, GraphML (Gephi / yEd / Cytoscape), GEXF 1.2 (Gephi), JSON Graph Format v2 (JGF), or JSON with portraits. The exporter opens the database read-only.

people-graph-export --db "<absolute-path-to-demo-db>" --format markdown --out "<absolute-path-to-obsidian-dir>"
people-graph-export --db "<absolute-path-to-demo-db>" --format graphml --out "<absolute-path-to-graph.graphml>"
people-graph-export --db "<absolute-path-to-demo-db>" --format gexf --out "<absolute-path-to-graph.gexf>"
people-graph-export --db "<absolute-path-to-demo-db>" --format jgf --out "<absolute-path-to-graph.jgf>"
people-graph-export --db "<absolute-path-to-demo-db>" --format json --out -

JSON Graph Format v2 schema · GEXF 1.2 schema

Use python -B server.py --db "<absolute-path-to-demo-db>" to run it without installation. Use an absolute path to server.py when launching it from another working directory. All four package commands (people-graph-import, people-graph-export, people-graph-mcp, people-graph-viewer) and root launchers support --version. Pass repeatable --allow-chat <chat_key> to people-graph-mcp, people-graph-viewer, or people-graph-export to restrict access to specific chats without leaking hidden chats.

Related MCP server: tg-recall-mcp

Import a Telegram Desktop export

The importer accepts a JSON result.json with chats.list or a single chat. It reads personal chats (personal_chat), private groups (private_group) and private and public supergroups (private_supergroup, public_supergroup). It skips channels, bot chats, Saved Messages and other unsupported types. It prints counts for people, chats and messages as JSON on stdout. Progress and counts of skipped types go to stderr. Use --quiet to suppress progress and warnings. Exit codes are 0 for success, 1 for import or database errors, and 2 for invalid command-line arguments.

People come from typed sender IDs. The importer skips deleted, service, forwarded and via-bot messages. It uses the current text and original send time for edited messages. Each eligible excerpt contains up to 280 characters and carries its chat key and message ID. Direct chats with two observed senders and group replies with a visible source message create graph edges. Scores weight interaction counts by recency relative to the newest indexed message.

Use one database per archive. Every successful import atomically replaces that database's snapshot and search index. Use a separate database to keep a subset alongside the full archive. To remove an imported snapshot, stop any importer and MCP server using the database, then delete the database and any adjacent -wal, -shm or -journal files for that database. Reimport to recreate it.

Import an mbox archive

The importer skips mail with an invalid or missing From or Date. It derives sender IDs from lowercase addresses and extracts up to 280 characters of plain-text body, skipping attachments.

References and In-Reply-To keep messages in the same thread, even when the parent appears later in the archive. Without those headers, the importer groups messages by normalized subject and the set of From, To, and Cc addresses. Threads with two observed senders, two participants and no Cc create direct edges. Other threads create reply edges when the referenced parent is present. RFC 4155 · RFC 5322

Connect over MCP

Replace each path placeholder with an absolute path on your machine, including the executable extension where needed.

Claude Desktop

Add the server to claude_desktop_config.json. Claude Desktop setup

{
  "mcpServers": {
    "people-graph": {
      "command": "<absolute-path-to-people-graph-mcp>",
      "args": ["--db", "<absolute-path-to-demo-db>"]
    }
  }
}

Cursor

Add the server to .cursor/mcp.json in the project or ~/.cursor/mcp.json for all projects. This example launches directly from a checkout. Cursor setup

{
  "mcpServers": {
    "people-graph": {
      "command": "<absolute-path-to-python>",
      "args": ["-B", "<absolute-path-to-server.py>", "--db", "<absolute-path-to-demo-db>"]
    }
  }
}

Hermes Agent

Add the server under mcp_servers in ~/.hermes/config.yaml. Hermes MCP setup

mcp_servers:
  people-graph:
    command: "<absolute-path-to-people-graph-mcp>"
    args: ["--db", "<absolute-path-to-demo-db>"]

Tool

Inputs

Limits & Result

people_search

query (1–200 chars), optional person_id, chat_key, since, until, cursor, limit (1–50, default 20)

Matching sender names, excerpts with chat_key and msg, and next_cursor

people_graph

Optional person_id and limit (1–50, default 30)

Observed edges (up to 200) and endpoint people

people_portrait

person_id

Identity, up to 10 active chats, and up to 10 recent cited excerpts

people_edge_evidence

source, target, chat_key, optional kind (direct | reply) and limit (1–50)

Messages behind the connection (direct messages or reply pairs)

Try searching for telescope, then use a returned person ID in the graph, edge evidence, and portrait tools. The server negotiates 2025-06-18, 2025-03-26 and 2024-11-05 (newer client revisions fall back to 2025-06-18). Batch requests are accepted for 2025-03-26. Tool annotations are available with the two 2025 revisions. Unknown tools or invalid arguments/cursors return JSON-RPC -32602; calls before notifications/initialized return -32002. MCP stdio specification

Optional local graph viewer

Inspect the same read-only database in a browser on loopback (127.0.0.1, localhost, or ::1 only, zero external dependencies or network requests):

people-graph-viewer --db "<absolute-path-to-demo-db>" --open

Or without installation: python -B viewer.py --db "<absolute-path-to-demo-db>" --open. Clicking a node opens that person's portrait. Clicking an edge shows the messages behind the connection. Search supports chat_key, since, until, and cursor pagination. Chat content is rendered strictly as plain text.

Run the synthetic tests

The tests use fictional senders and create databases in memory or in temporary directories. They exercise the stdio contract, offline socket isolation, universal importers/exporters, chat allowlists, and loopback viewer locally.

python -B -m unittest discover -s tests -p "test_*.py" -v
python -B -m unittest tests.test_mcp tests.test_queries tests.test_import tests.test_universal_io tests.test_viewer -v

Data and privacy

The importer and server use local files and SQLite with no network calls or model dependencies. Import ignores the export's address book, profile section, attachments, and service messages. The database contains author names, selected chat titles, interaction metadata, and excerpts from eligible messages. Store real exports and databases outside the repository and give them the same access controls as the source chats. The server opens one database in read-only mode. A connected client may pass its tool results to the client's model or logs.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Search your data exports from Google, Telegram, Spotify, and Instagram in one place. Everything runs on your own computer. Hybrid search and MCP, built in .NET 10
      5
      5
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Local-first, read-only MCP server for searching and retrieving cited evidence from archived Telegram chats, including transcripts and media metadata.
      5
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Reads and searches local email archives (.mbox or .eml) with full MIME parsing, enabling queries about senders, subjects, dates, and bodies while keeping all data on your machine.
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables privacy-aware, deterministic, read-only chat analysis through tools for briefs, aggregate interaction signals, evidence-aware claim audits, and canonical resource discovery.
      16
      4
      2
      MIT