
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
概覽
遠端 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 而非環境變數提供。付費工具需預先儲值閃電網路額度。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Personalbrain Mcp,將其新增到工作區。
- 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
- 為需要使用其工具的對話啟用該服務。
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.
[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:
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
session_status— Check your current session state.- 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. - 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'snonce. - 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.
- Call
list_brains→set_active_brain— Select which brain to work with.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
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. Thensec(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.
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.
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
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:
Note:
THEBRAIN_API_KEYis 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):
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:
See the Three-Party Protocol diagram for the full architecture. The operator-side flow is also available.
Project Structure
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:
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
- tollbooth-dpyc — Python SDK (vault, auth, pricing, Lightning, Nostr identity)
- dpyc-community — Governance registry: membership, advisories, threat model
- dpyc-oracle — Community concierge (free onboarding + member lookup)
- tollbooth-authority — Certification backbone (Schnorr-signed certificates)
- tollbooth-sample — Sample Operator (canonical template)
- tollbooth-pricing-studio — iOS pricing-model editor / operator console
- cypher-mcp — Monetized graph answers: named Cypher templates over Neo4j/AuraDB
- schwab-mcp — Charles Schwab brokerage data
- thebrain-mcp — TheBrain personal knowledge graph
- excalibur-mcp — X/Twitter posting
- taxsort-mcp — Tax classification + Cloudflare Pages UI
- optionality-mcp — Options analytics (brokerage-data operator)
- tollbooth-oauth2-collector — OAuth2 callback handler (advocate service)
- tollbooth-shortlinks — URL shortener utility
- goodearth-mcp — Climate analytics for small specialty-crop farms
- beesknees-mcp — The Bee's Knees race game
- roastify-mcp — Roastify coffee catalog and packaging artwork
- ChartRemotely-mcp — Puts a security on a desktop chart, by voice or tool call
- tollbooth-web — Shared browser SDK for DPYC™ operator front ends
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版本歷史
2- v1.18.0最新Oct 21, 2026
- v1.17.6Sep 16, 2026
評分
已滿足適用檢查項的 85%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通必需25 分
- 已宣告認證方式必需10 分
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分