okfy-ai 0.1.4 → 0.2.0
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.
- package/README.md +73 -16
- package/assets/demo.gif +0 -0
- package/dist/{chunk-QE5W5AJS.js → chunk-7V2ZN6IS.js} +739 -55
- package/dist/cli.js +947 -14
- package/dist/index.d.ts +234 -24
- package/dist/index.js +35 -3
- package/docs/mcp-clients.md +167 -77
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,21 +4,24 @@ Turn docs into agent-readable Open Knowledge Format v0.1-conformant bundles, the
|
|
|
4
4
|
|
|
5
5
|
## Use With Agents
|
|
6
6
|
|
|
7
|
-
Create a
|
|
7
|
+
Create a registered source and print a client-ready setup preview:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx -y okfy-ai
|
|
11
|
-
npx -y okfy-ai validate ./stripe-checkout-okf
|
|
10
|
+
npx -y okfy-ai init stripe https://docs.stripe.com/checkout --client generic --max-pages 100 --max-depth 4
|
|
12
11
|
```
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
`init` prints the MCP launch command, client config, and a first prompt. It does not write client config files by default. The generated launch command will look like `npx -y okfy-ai serve stripe --mcp --auto-refresh`.
|
|
14
|
+
|
|
15
|
+
The MCP server uses the cached local bundle immediately. When the source is stale, `--auto-refresh` refreshes it according to the source policy while exposing freshness metadata through `bundle_summary`.
|
|
16
|
+
|
|
17
|
+
Add the source-backed server to an MCP client:
|
|
15
18
|
|
|
16
19
|
```json
|
|
17
20
|
{
|
|
18
21
|
"mcpServers": {
|
|
19
22
|
"stripe-okf": {
|
|
20
23
|
"command": "npx",
|
|
21
|
-
"args": ["-y", "okfy-ai", "serve", "
|
|
24
|
+
"args": ["-y", "okfy-ai", "serve", "stripe", "--mcp", "--auto-refresh"]
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -35,7 +38,8 @@ Use the stripe-okf MCP server. Search for Checkout Sessions, read the most relev
|
|
|
35
38
|
Claude Code:
|
|
36
39
|
|
|
37
40
|
```bash
|
|
38
|
-
|
|
41
|
+
npx -y okfy-ai init stripe https://docs.stripe.com/checkout --client claude-code
|
|
42
|
+
claude mcp add --transport stdio stripe-okf -- npx -y okfy-ai serve stripe --mcp --auto-refresh
|
|
39
43
|
```
|
|
40
44
|
|
|
41
45
|
Codex:
|
|
@@ -43,7 +47,7 @@ Codex:
|
|
|
43
47
|
```toml
|
|
44
48
|
[mcp_servers.stripe_okf]
|
|
45
49
|
command = "npx"
|
|
46
|
-
args = ["-y", "okfy-ai", "serve", "
|
|
50
|
+
args = ["-y", "okfy-ai", "serve", "stripe", "--mcp", "--auto-refresh"]
|
|
47
51
|
startup_timeout_sec = 20
|
|
48
52
|
tool_timeout_sec = 60
|
|
49
53
|
enabled = true
|
|
@@ -51,9 +55,47 @@ enabled = true
|
|
|
51
55
|
|
|
52
56
|
Claude Desktop, Cursor, and other `mcpServers` clients can use the JSON config above. More setup: https://github.com/0dust/OKFy/blob/main/docs/mcp-clients.md
|
|
53
57
|
|
|
58
|
+
If setup is not working, run:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx -y okfy-ai doctor stripe --client codex
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`doctor` checks the registered source, bundle validity, freshness, `npx` availability, generated command shape, MCP tool visibility, and JSON-RPC-clean stdout, then tells you the next repair command or config edit.
|
|
65
|
+
|
|
66
|
+
## Keep Sources Fresh
|
|
67
|
+
|
|
68
|
+
Registered sources are the local-first workflow for third-party docs sites that change over time:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx -y okfy-ai add stripe https://docs.stripe.com/checkout --max-pages 100 --max-depth 4
|
|
72
|
+
npx -y okfy-ai sources
|
|
73
|
+
npx -y okfy-ai check stripe
|
|
74
|
+
npx -y okfy-ai doctor stripe
|
|
75
|
+
npx -y okfy-ai update stripe
|
|
76
|
+
npx -y okfy-ai remove stripe
|
|
77
|
+
npx -y okfy-ai serve stripe --mcp --auto-refresh
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If you want registration plus client-specific setup artifacts, use `npx -y okfy-ai init stripe https://docs.stripe.com/checkout --client generic --max-pages 100 --max-depth 4`.
|
|
81
|
+
|
|
82
|
+
By default, okfy stores registered sources under `~/.okfy`. Set `OKFY_HOME` to use a different local cache for CI, tests, or per-project isolation.
|
|
83
|
+
|
|
84
|
+
Freshness is age-based. A registered bundle is fresh when it exists, validates, and was successfully refreshed within its configured max age. The default mode is `stale-while-refresh`: if the bundle is stale, MCP search and read tools keep serving the current cached bundle while a background refresh runs.
|
|
85
|
+
|
|
86
|
+
Use blocking mode when you want the server to refresh before answering tool calls:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx -y okfy-ai serve stripe --mcp --auto-refresh --refresh-mode blocking
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Use `--refresh-mode off` when MCP serving should never trigger network fetches; you can still run `npx -y okfy-ai update stripe` manually.
|
|
93
|
+
|
|
54
94
|
## Create Bundles
|
|
55
95
|
|
|
56
|
-
|
|
96
|
+
The original crawl/import path still works for one-off snapshots and project-local bundles.
|
|
97
|
+
|
|
98
|
+
Docs website snapshot:
|
|
57
99
|
|
|
58
100
|
```bash
|
|
59
101
|
npx -y okfy-ai crawl https://docs.stripe.com/checkout --out ./stripe-checkout-okf --max-pages 25
|
|
@@ -68,6 +110,14 @@ npx -y okfy-ai import ./docs --out ./docs-okf --source-name "Project docs" --for
|
|
|
68
110
|
npx -y okfy-ai validate ./docs-okf
|
|
69
111
|
```
|
|
70
112
|
|
|
113
|
+
Serve an existing bundle path when you already manage the bundle yourself:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx -y okfy-ai serve ./docs-okf --mcp
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Direct bundle paths do not use source auto-refresh.
|
|
120
|
+
|
|
71
121
|
## Optional CLI Install
|
|
72
122
|
|
|
73
123
|
You do not need global install for MCP configs. `npx -y okfy-ai ...` is usually better because the MCP client can launch okfy directly.
|
|
@@ -88,9 +138,9 @@ After installing, this MCP config is equivalent:
|
|
|
88
138
|
```json
|
|
89
139
|
{
|
|
90
140
|
"mcpServers": {
|
|
91
|
-
"
|
|
141
|
+
"stripe-okf": {
|
|
92
142
|
"command": "okfy",
|
|
93
|
-
"args": ["serve", "
|
|
143
|
+
"args": ["serve", "stripe", "--mcp", "--auto-refresh"]
|
|
94
144
|
}
|
|
95
145
|
}
|
|
96
146
|
}
|
|
@@ -107,9 +157,9 @@ npx -y okfy-ai demo
|
|
|
107
157
|
```json
|
|
108
158
|
{
|
|
109
159
|
"mcpServers": {
|
|
110
|
-
"
|
|
160
|
+
"stripe-okf": {
|
|
111
161
|
"command": "npx",
|
|
112
|
-
"args": ["-y", "okfy-ai", "serve", "
|
|
162
|
+
"args": ["-y", "okfy-ai", "serve", "stripe", "--mcp", "--auto-refresh"]
|
|
113
163
|
}
|
|
114
164
|
}
|
|
115
165
|
}
|
|
@@ -118,11 +168,18 @@ npx -y okfy-ai demo
|
|
|
118
168
|
## CLI Commands
|
|
119
169
|
|
|
120
170
|
```bash
|
|
171
|
+
okfy init <name> <url>
|
|
172
|
+
okfy doctor <name>
|
|
173
|
+
okfy add <name> <url>
|
|
174
|
+
okfy sources
|
|
175
|
+
okfy check <name-or-bundle>
|
|
176
|
+
okfy update <name>
|
|
177
|
+
okfy remove <name>
|
|
121
178
|
okfy crawl <url> --out <dir>
|
|
122
179
|
okfy import <path> --out <dir>
|
|
123
180
|
okfy validate <bundle>
|
|
124
181
|
okfy inspect <bundle>
|
|
125
|
-
okfy serve <bundle> --mcp
|
|
182
|
+
okfy serve <name-or-bundle> --mcp
|
|
126
183
|
okfy demo
|
|
127
184
|
```
|
|
128
185
|
|
|
@@ -130,7 +187,7 @@ okfy demo
|
|
|
130
187
|
|
|
131
188
|
| Tool | Purpose |
|
|
132
189
|
| --- | --- |
|
|
133
|
-
| `bundle_summary` | Show bundle stats and
|
|
190
|
+
| `bundle_summary` | Show bundle stats, validation status, and source freshness when available. |
|
|
134
191
|
| `search_concepts` | Search concept previews by query, type, or tags. |
|
|
135
192
|
| `read_concept` | Read one concept body, frontmatter, links, backlinks, and source. |
|
|
136
193
|
| `get_neighbors` | Traverse outbound links and backlinks around a concept. |
|
|
@@ -140,8 +197,8 @@ okfy demo
|
|
|
140
197
|
## What okfy Generates
|
|
141
198
|
|
|
142
199
|
```text
|
|
143
|
-
docs
|
|
144
|
-
-> OKF bundle: Markdown files + YAML frontmatter + links
|
|
200
|
+
registered docs source or Markdown folder
|
|
201
|
+
-> local OKF bundle: Markdown files + YAML frontmatter + links
|
|
145
202
|
-> MCP server: search_concepts, read_concept, get_neighbors
|
|
146
203
|
-> source-backed agent answers
|
|
147
204
|
```
|
package/assets/demo.gif
CHANGED
|
Binary file
|