Personalbrain Mcp

io.github.lonniev由 GitHub 账号 lonniev 发布v1.18.0更新于 Oct 24, 2026

FastMCP server for TheBrain API — AI access to a personal knowledge graph, Tollbooth-monetized

已验证Streamable HTTP可网页运行数据库金融知识与记忆

概览

AI 生成的概览

远程 MCP 服务器,让 AI 助手读写个人 TheBrain 知识图谱,并按调用以比特币闪电网络小额付费。

可以做什么
  • 读取并搜索 TheBrain 知识图谱中的想法、笔记与链接
  • 创建、更新想法并建立链接,运行 BrainQuery(BQL)类 Cypher 图查询,支持完整增删改查
  • 管理会话与凭据:查看会话状态、开启 Secure Courier 通道、接收或清除凭据、列出并选择大脑
  • 处理身份:申请与接收 npub 证明、查询证明状态、列出已持有身份
  • 管理额度与支付:查询余额、账户对账单、恢复额度、购买额度与查询付款
  • 通过 Oracle 查询 DPYC 社区成员资格、税率与公告
适用场景
适合把笔记和想法存放在 TheBrain 中、希望助手在聊天客户端里检索、扩充或重组该图谱,并愿意为每次工具调用支付少量闪电网络费用的用户。
运行要求
远程端点 personal-brain.fastmcp.app,使用 streamable HTTP,需 OAuth 登录。需要 Nostr 密钥对(npub,nsec 保留在客户端)以及用于私信证明和凭据投递的 Nostr 客户端。需要 TheBrain API 密钥与 brain ID,通过 Secure Courier 而非环境变量提供。付费工具需预先充值闪电网络额度。
安装前请注意
每次工具调用都按比特币闪电网络 sats 计费(读取约 1 sat、写入约 5 sat、重型查询约 10 sat,价格由运营方动态设定),使用会花费真实资金,可通过 purchase_credits 充值。TheBrain API 密钥与 brain ID 经加密 Nostr 私信传输并存入 Postgres 数据库。工具可创建、更新和删除想法与链接。nsec 私钥须由用户自行保管,切勿外泄。receive_credentials 会破坏性清空中继,每次投递只能调用一次。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Personalbrain Mcp,将其添加到工作区。
  2. 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.lonniev%2Fpersonalbrain-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。 客户端会在首次连接时完成 OAuth 登录。

{
  "mcpServers": {
    "personalbrain": {
      "type": "http",
      "url": "https://personal-brain.fastmcp.app/mcp"
    }
  }
}

README

thebrain-mcp

The first city on the Lightning Turnpike.

[License] [Python] [Horizon]

[Claude connects to PersonalBrain through thebrain-mcp, powered by Lightning micropayments]

An MCP server that gives AI agents read-write access to a personal knowledge graph — and pays for itself with Bitcoin Lightning micropayments.

The metaphors in this project are drawn with admiration from The Phantom Tollbooth by Norton Juster, illustrated by Jules Feiffer (1961). Milo, Tock, the Tollbooth, Dictionopolis, and Digitopolis are creations of Mr. Juster's extraordinary imagination. We just built the payment infrastructure.


The First City

Every turnpike needs its first city. Before the booths can collect fares and the authority can stamp purchase orders, someone has to build a destination worth driving to.

thebrain-mcp is that city — a FastMCP service deployed on Horizon that bridges AI agents to TheBrain, a personal knowledge graph of 9,000+ interconnected thoughts built over a decade. Every thought, link, attachment, and note operation maps directly to TheBrain's cloud API at api.bra.in.

It's also the proving ground for Tollbooth DPYC™ — the first MCP server where every tool call is metered via Bitcoin Lightning micropayments. Pre-fund, use, top up. No subscriptions, no API keys tied to billing accounts, no fiat payment processors. The novel contribution: an MCP server architecture where the operator monetizes AI agent access through Lightning micropayments without ever pestering the client mid-conversation.

Getting Started

Connecting via Horizon MCP

Connect any MCP-compatible client (Claude Desktop, Cursor, your own agent) to the live endpoint:

https://personal-brain.fastmcp.app/mcp

No configuration needed. Your client connects with OAuth; the connection holds no npub until you prove one into it by answering a Nostr DM (request_npub_proof, then receive_npub_proof). A client that holds your nsec signs each request instead (NIP-98) and needs no DM. Tools then take only npub.

First Connection Walkthrough

  1. session_status — Check your current session state.
  2. Get your patron npub from the dpyc-oracle's how_to_join() tool — this is the npub you registered as a DPYC™ Citizen, your identity for credit operations.
  3. Secure Courier onboarding:
    • Call request_credential_channel(sender_npub=<patron_npub>, service=<service>) — opens a Secure Courier channel, sends a welcome DM to your Nostr client, and returns the channel's nonce.
    • Reply via your Nostr client with your credentials in JSON: {"api_key": "...", "brain_id": "..."}
    • Call receive_credentials(sender_npub=<patron_npub>, service=<service>, nonce=<that nonce>) — vaults your credentials and activates the session.
  4. list_brains → set_active_brain — Select which brain to work with.
  5. brain_query — Start exploring your knowledge graph.

Returning users do not re-run this flow: the session restores from the vault on first use.

Secure Courier

Credentials are delivered via encrypted Nostr DMs — they never appear in the chat window. On first-time relay receipt, the service sends an ncred1... credential card back to the patron via DM for scan-and-paste reuse.

Human in the loop: The patron must consciously approve each credential delivery via their Nostr client. Never auto-poll or auto-retry receive_* calls — each receive_credentials drains the relay destructively (NIP-09 deletion after pickup). Call it exactly once per credential delivery.

Credits Model

CategoryPricing hintExamples
free0 satssession_status, check_balance, check_price
read1 satget_thought, search_thoughts, get_note
write5 satscreate_thought, create_link, update_thought
heavy10 satsbrain_query, get_modifications

Actual prices are set dynamically by the operator's pricing model in Neon via api_sats per tool. Auth and balance tools are always free.

Credits are issued as tranches with a tranche_lifetime (TTL). Tranches are consumed FIFO; expired tranches are pruned automatically. Use check_balance to see your balance, active tranches, and usage history. Top up via purchase_credits with Bitcoin Lightning.

Security

  • Identity is a Nostr keypair — users are identified by an npub (Nostr public key), not an email or username. The nsec (private key) stays with the patron — never shared, never sent to a service.
  • Identity is on the connection — a client that holds the nsec signs each HTTP request (NIP-98, kind 27235); an OAuth client proves the npub once into its connection by answering a Nostr DM (request_npub_proof → receive_npub_proof). Tools carry no proof argument.
  • Human in the loop — the patron approves each proof in their Nostr client and chooses how long it lasts, up to 30 days. When it lapses, a fresh request/receive cycle renews it.
  • Credentials via Secure Courier — TheBrain API keys and brain IDs are delivered via NIP-44 encrypted Nostr DMs, vaulted in Neon Postgres, and never exposed in the chat window.

BrainQuery (BQL)

A Cypher-subset query language purpose-built for TheBrain. Agents and humans express graph operations in the same formalism — full CRUD via MATCH, CREATE, SET, MERGE, and DELETE.

cypher
MATCH (n {name: "Projects"})-[:CHILD]->(m) RETURN mMATCH (n) WHERE n.name =~ "quarterly review" RETURN nMATCH (p {name: "Ideas"}) CREATE (p)-[:CHILD]->(n {name: "New Concept"})MATCH (root {name: "Company"})-[:CHILD*1..3]->(d) WHERE d.name CONTAINS "Budget" RETURN d

Variable-length paths, multi-hop chains, compound WHERE with AND/OR/NOT/XOR, similarity search, and property existence checks. Full grammar in BRAINQUERY.md.

Troubleshooting

When a tool call fails, read the response — it tells you what happened and what to do next. Credential lifecycle states are not errors; they are expected situations with clear guidance.

SituationWhat to do
proof is requiredCall request_npub_proof then receive_npub_proof — a fresh request/receive cycle. The proof lasts as long as the patron chose when approving it (up to 30 days).
Insufficient credit balanceCall purchase_credits to top up.
Cold start / session not readyRetry in 10-15 seconds.
Credentials not foundFollow the Secure Courier onboarding flow (step 3 above).
Upstream API errorOnly if the error explicitly mentions TheBrain API failure. Not a credential or billing issue.

Don't Pester Your Customer: Do NOT ask the patron to re-authenticate or re-do the Courier flow unless the error message specifically says credentials are missing or expired.

Self-Hosting

For local installation and setup, see INSTALL.md and QUICKSTART.md.

To run your own instance, set these environment variables:

Required
VariablePurpose
TOLLBOOTH_NOSTR_OPERATOR_NSECOperator's Nostr secret key -- the single bootstrap key for identity, Secure Courier DMs, and audit signing

This is the only env var the server reads. Certified operators bootstrap their Neon database URL from the Authority via encrypted Nostr DM -- NEON_DATABASE_URL is not read from the environment. The relay set comes from the shared dpyc-community registry, and tranche lifetime and constraints come from the operator's pricing model -- none of them is an env var.

Credentials via Secure Courier (NOT env vars)

All secrets flow through Secure Courier -- they never appear as environment variables:

CredentialDelivery
TheBrain API key + brain IDPatron delivers via encrypted Nostr DM
BTCPay credentials (btcpay_host, btcpay_api_key, btcpay_store_id)Operator delivers via Secure Courier

Note: THEBRAIN_API_KEY is not an environment variable. Patrons deliver their TheBrain API key and brain ID via Secure Courier (encrypted Nostr DM). Only the operator's nsec is configured as an env var.

Tool Surface

The server exposes the standard Tollbooth DPYC™ operator surface via register_standard_tools() from tollbooth-dpyc, plus its domain tools. Tools fall into three paths in the DPYC three-actor topology (Operator / Authority / Oracle):

PathToolsStatus
Hot (local ledger)check_balance, account_statement, account_statement_infographic, restore_credits, service_statusImplemented — delegates to server.py
Hot (Secure Courier)session_status, request_credential_channel, receive_credentials, forget_credentialsImplemented — Nostr credential delivery with credential card DM
Identityrequest_npub_proof, receive_npub_proof, check_proof_status, held_identitiesImplemented — proves an npub into an OAuth connection
Delegation (Authority)purchase_credits, check_paymentImplemented — auto-certifies via MCP-to-MCP
Delegation (Oracle)oracle_lookup_member, oracle_how_to_join, oracle_get_tax_rate, oracle_about, oracle_network_advisoryImplemented — MCP-to-MCP via OracleClient

Payment processing auto-certifies via the Authority (server-to-server OAuth). Secure Courier delivers encrypted credentials via Nostr DMs with automatic credential card (ncred1...) DM-back on first receipt. Oracle community tools route directly to the DPYC™ Oracle — free and unauthenticated.

Architecture

The Tollbooth DPYC™ ecosystem is a three-party protocol spanning three repositories:

RepoRole
tollbooth-authorityThe institution — tax collection, Schnorr signing, purchase order certification
tollbooth-dpycThe booth — operator-side credit ledger, BTCPay client, tool gating
dpyc-oracleThe concierge — community onboarding, tax rates, membership lookup
thebrain-mcp (this repo)The first city — reference MCP server powered by Tollbooth DPYC™

See the Three-Party Protocol diagram for the full architecture. The operator-side flow is also available.

Project Structure

thebrain-mcp/├── src/thebrain_mcp/        # Server source, BQL engine, Tollbooth├── tests/                   # Test suite (465+ tests)├── fastmcp.json             # Horizon deploy entrypoint (src/thebrain_mcp/server.py)├── pyproject.toml           # Package metadata and dependencies├── BRAINQUERY.md            # BQL grammar and reference├── INSTALL.md / QUICKSTART.md  # Local install and setup├── docs/diagrams/           # Architecture and protocol flow diagrams├── LICENSE                  # Apache License 2.0└── NOTICE                   # Attribution notice

Prior Art & Attribution

The methods, algorithms, and implementations contained in this repository may represent original work by Lonnie VanZandt, first published on February 16, 2026. This public disclosure establishes prior art under U.S. patent law (35 U.S.C. 102).

All use, reproduction, or derivative work must comply with the Apache License 2.0 included in this repository and must provide proper attribution to the original author per the NOTICE file.

How to Attribute

If you use or build upon this work, please include the following in your documentation or source:

Based on original work by Lonnie VanZandt and Claude.aiOriginally published: February 16, 2026Source: https://github.com/lonniev/thebrain-mcpLicensed under Apache License 2.0

Visit the technologist's virtual cafe for Bitcoin advocates and coffee aficionados at stablecoin.myshopify.com.

Patent Notice

The author reserves all rights to seek patent protection for the novel methods and systems described herein. Public disclosure of this work establishes a priority date of February 16, 2026. Under the America Invents Act, the author retains a one-year grace period from the date of first public disclosure to file patent applications.

Note to potential filers: This public repository and its full Git history serve as evidence of prior art. Any patent application covering substantially similar methods filed after the publication date of this repository may be subject to invalidation under 35 U.S.C. 102(a).

DPYC™ Ecosystem

Further Reading

The Phantom Tollbooth on the Lightning Turnpike — the full story of how we're monetizing the monetization of AI APIs, and then fading to the background.

Trademarks

DPYC™, Tollbooth DPYC™, and Don't Pester Your Customer™ are trademarks of Lonnie VanZandt. See the TRADEMARKS.md in the dpyc-community repository for usage guidelines.

License

Apache License 2.0 — see LICENSE and NOTICE for details.


Because in the end, the tollbooth was never the destination. It was always just the beginning of the journey.

来源:README.md,提交 79dffca

工具

0
该服务器需要登录,因此 SourceWeft 无法在没有账号的情况下读取其工具,也未收录。已连接账号所能看到的内容可能因账号及其权限而异。

版本历史

2
  1. v1.18.0最新Oct 21, 2026
  2. v1.17.6Sep 16, 2026

评分

已满足适用检查项的 85%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分