@takeokunn/gbrainx-mcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +39 -14
  2. package/dist/bin.cjs +1 -1
  3. package/package.json +7 -3
package/README.md CHANGED
@@ -1,26 +1,51 @@
1
1
  # @takeokunn/gbrainx-mcp
2
2
 
3
- GbrainX のローカル API を MCP クライアントから使うためのサーバーです。Node.js 20 以上が必要です。先に Node.js 22 以上でローカル版を起動してください。
3
+ A stdio [MCP](https://modelcontextprotocol.io) server that lets Claude Code search, buy and load GbrainX knowledge packs. It talks to the local app from [`@takeokunn/gbrainx`](https://www.npmjs.com/package/@takeokunn/gbrainx), so a pack is read as a short summary first and then one page at a time, and content you have loaded stays in a local cache.
4
4
 
5
- ```sh
6
- npx @takeokunn/gbrainx
7
- ```
5
+ ## Quick start
8
6
 
9
- Claude Code に登録します。
7
+ Requires Node.js 20 or later for this server, and Node.js 22.13 or later for the local app.
10
8
 
11
- ```sh
12
- claude mcp add gbrainx -- npx -y @takeokunn/gbrainx-mcp
13
- ```
9
+ 1. Start the local app. It listens on `127.0.0.1:4747`.
14
10
 
15
- 既定では `http://127.0.0.1:4747` に接続します。接続先を変える場合は、MCP サーバーを起動する環境に `GBRAINX_API_URL` を設定してください。
11
+ ```sh
12
+ npx -y @takeokunn/gbrainx
13
+ ```
16
14
 
17
- ## ツール
15
+ 2. Register the server in Claude Code.
18
16
 
19
- - `gbrainx.search` はパックを検索し、一致度と購入済みかどうかを返します。
20
- - `gbrainx.buy` は直前の検索結果を使って購入します。ローカル API が購入を拒否し HTTP 402 を返した場合、結果は `bought: false` と `needsApproval: true` になります。
21
- - `gbrainx.load` は購入済みパックの要約を返します。`page` を指定すると、そのページだけを返します。キャッシュに内容がなく未購入の場合、ローカル API は HTTP 402 を返し、MCP ツールはエラーを返します。
17
+ ```sh
18
+ claude mcp add gbrainx -- npx -y @takeokunn/gbrainx-mcp
19
+ ```
22
20
 
23
- 読み込んだ内容は `~/.gbrainx/cache/` に保存されます。キャッシュは `npx @takeokunn/gbrainx cache clear` で消せます。
21
+ The server connects to `http://127.0.0.1:4747`. To use another address, set `GBRAINX_API_URL` in the environment that starts the MCP server. If the app is not running, the tools return an error that asks you to start it.
22
+
23
+ ## Tools
24
+
25
+ | Tool | Input | Result |
26
+ | --- | --- | --- |
27
+ | `gbrainx.search` | `query` | Up to five matching packs with `id`, title, description, match score and whether you already own the pack. |
28
+ | `gbrainx.buy` | `packId` | `{ "bought": true }`, or `{ "bought": false, "needsApproval": true, "reason": … }` when the local app refuses (HTTP 402). Buying uses the score from the latest `gbrainx.search`, so search first. |
29
+ | `gbrainx.load` | `packId`, optional `page` | Without `page`, the pack summary and the list of page ids. With `page`, that one page. Errors when the pack is not purchased and not cached. |
30
+
31
+ `gbrainx.load` wraps the pack text in a `<gbrain-reference>` block and labels it as reference information, not as instructions.
32
+
33
+ ## Cache and data
34
+
35
+ - Loaded summaries and pages are saved under `~/.gbrainx/cache/<packId>@<version>/` with a sha256 checksum per file. A later `load` of the same content reads the cache and makes no request. An entry that fails its checksum is deleted and fetched again.
36
+ - `npx -y @takeokunn/gbrainx cache clear` deletes the cache.
37
+ - Packs, wallet and purchases live in the local app's store at `~/.gbrainx/store.json` (or `GBRAINX_STORE_DIR`), not in this package.
38
+
39
+ ## Limits
40
+
41
+ - Purchases move a balance inside the local app's store. No real payment is made. The app refuses a purchase when the match score is below 0.5, or when it exceeds the per-purchase or session cap, or the balance.
42
+ - The tools run one at a time, in the order Claude Code sends them.
43
+ - `--help` prints the usage and does not start the server.
44
+
45
+ ## Links
46
+
47
+ - Source and issues: <https://github.com/takeokunn/gbrainx>
48
+ - Local app and CLI: <https://www.npmjs.com/package/@takeokunn/gbrainx>
24
49
 
25
50
  ## License
26
51
 
package/dist/bin.cjs CHANGED
@@ -17051,7 +17051,7 @@ var base = (process.env.GBRAINX_API_URL || "http://127.0.0.1:4747").replace(/\/+
17051
17051
  var sessionId = (0, import_node_crypto.randomUUID)();
17052
17052
  var matches = /* @__PURE__ */ new Map();
17053
17053
  var pendingCall = Promise.resolve();
17054
- var server = new Server({ name: "gbrainx-mcp", version: "0.1.0" }, { capabilities: { tools: {} } });
17054
+ var server = new Server({ name: "gbrainx-mcp", version: "0.1.1" }, { capabilities: { tools: {} } });
17055
17055
  var tools = [
17056
17056
  { name: "gbrainx.search", description: "Search for matching knowledge packs.", inputSchema: { type: "object", properties: { query: { type: "string", minLength: 1 } }, required: ["query"] } },
17057
17057
  { name: "gbrainx.buy", description: "Buy a matching pack within the configured budget.", inputSchema: { type: "object", properties: { packId: { type: "string", minLength: 1 } }, required: ["packId"] } },
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@takeokunn/gbrainx-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
+ "description": "Stdio MCP server that lets Claude Code search, buy and load GBrain knowledge packs from a local GbrainX app: a short summary first, then one page at a time, with a local cache.",
5
+ "keywords": ["mcp", "model-context-protocol", "claude-code", "gbrain", "knowledge-pack", "memory"],
6
+ "homepage": "https://github.com/takeokunn/gbrainx#readme",
7
+ "bugs": { "url": "https://github.com/takeokunn/gbrainx/issues" },
4
8
  "license": "MIT",
5
- "repository": { "type": "git", "url": "https://github.com/takeokunn/gbrainx.git" },
9
+ "repository": { "type": "git", "url": "git+https://github.com/takeokunn/gbrainx.git", "directory": "packages/mcp" },
6
10
  "type": "module",
7
11
  "files": ["dist"],
8
12
  "bin": {
9
- "gbrainx-mcp": "./dist/bin.cjs"
13
+ "gbrainx-mcp": "dist/bin.cjs"
10
14
  },
11
15
  "scripts": {
12
16
  "build": "esbuild bin.js --bundle --platform=node --format=cjs --target=node20 --outfile=dist/bin.cjs",