okfy-ai 0.1.3 → 0.1.5
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 +65 -19
- package/assets/demo.gif +0 -0
- package/dist/chunk-JA6B2QIM.js +1900 -0
- package/dist/cli.js +369 -13
- package/dist/index.d.ts +241 -24
- package/dist/index.js +33 -3
- package/docs/mcp-clients.md +139 -78
- package/examples/README.md +3 -3
- package/examples/bundles/okfy-docs/concepts/index.md +3 -13
- package/examples/bundles/okfy-docs/guides/index.md +3 -13
- package/examples/bundles/okfy-docs/home.md +22 -0
- package/examples/bundles/okfy-docs/index.md +8 -22
- package/examples/bundles/okfy-docs/okfy-example.json +2 -2
- package/examples/bundles/okfy-docs/reference/index.md +2 -12
- package/examples/bundles/stripe-checkout-small/home.md +21 -0
- package/examples/bundles/stripe-checkout-small/index.md +4 -19
- package/examples/bundles/stripe-checkout-small/okfy-example.json +1 -2
- package/examples/local-markdown/okfy-example.json +1 -1
- package/package.json +1 -1
- package/dist/chunk-6AP7LVJG.js +0 -1028
package/README.md
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
# okfy-ai
|
|
2
2
|
|
|
3
|
-
Turn docs into agent-readable Open Knowledge Format bundles, then serve them to Claude, Codex, Cursor, or any MCP client.
|
|
3
|
+
Turn docs into agent-readable Open Knowledge Format v0.1-conformant bundles, then serve them to Claude, Codex, Cursor, or any MCP client.
|
|
4
4
|
|
|
5
5
|
## Use With Agents
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Register a third-party docs source and serve it by name:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx -y okfy-ai
|
|
11
|
-
npx -y okfy-ai
|
|
10
|
+
npx -y okfy-ai add stripe https://docs.stripe.com/checkout --max-pages 100 --max-depth 4
|
|
11
|
+
npx -y okfy-ai serve stripe --mcp --auto-refresh
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
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`.
|
|
15
|
+
|
|
16
|
+
Add the source-backed server to an MCP client:
|
|
15
17
|
|
|
16
18
|
```json
|
|
17
19
|
{
|
|
18
20
|
"mcpServers": {
|
|
19
21
|
"stripe-okf": {
|
|
20
22
|
"command": "npx",
|
|
21
|
-
"args": ["-y", "okfy-ai", "serve", "
|
|
23
|
+
"args": ["-y", "okfy-ai", "serve", "stripe", "--mcp", "--auto-refresh"]
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
}
|
|
@@ -35,7 +37,7 @@ Use the stripe-okf MCP server. Search for Checkout Sessions, read the most relev
|
|
|
35
37
|
Claude Code:
|
|
36
38
|
|
|
37
39
|
```bash
|
|
38
|
-
claude mcp add --transport stdio stripe-okf -- npx -y okfy-ai serve
|
|
40
|
+
claude mcp add --transport stdio stripe-okf -- npx -y okfy-ai serve stripe --mcp --auto-refresh
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
Codex:
|
|
@@ -43,7 +45,7 @@ Codex:
|
|
|
43
45
|
```toml
|
|
44
46
|
[mcp_servers.stripe_okf]
|
|
45
47
|
command = "npx"
|
|
46
|
-
args = ["-y", "okfy-ai", "serve", "
|
|
48
|
+
args = ["-y", "okfy-ai", "serve", "stripe", "--mcp", "--auto-refresh"]
|
|
47
49
|
startup_timeout_sec = 20
|
|
48
50
|
tool_timeout_sec = 60
|
|
49
51
|
enabled = true
|
|
@@ -51,9 +53,36 @@ enabled = true
|
|
|
51
53
|
|
|
52
54
|
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
55
|
|
|
56
|
+
## Keep Sources Fresh
|
|
57
|
+
|
|
58
|
+
Registered sources are the local-first workflow for third-party docs sites that change over time:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx -y okfy-ai add stripe https://docs.stripe.com/checkout --max-pages 100 --max-depth 4
|
|
62
|
+
npx -y okfy-ai sources
|
|
63
|
+
npx -y okfy-ai check stripe
|
|
64
|
+
npx -y okfy-ai update stripe
|
|
65
|
+
npx -y okfy-ai remove stripe
|
|
66
|
+
npx -y okfy-ai serve stripe --mcp --auto-refresh
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
By default, okfy stores registered sources under `~/.okfy`. Set `OKFY_HOME` to use a different local cache for CI, tests, or per-project isolation.
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
Use blocking mode when you want the server to refresh before answering tool calls:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx -y okfy-ai serve stripe --mcp --auto-refresh --refresh-mode blocking
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Use `--refresh-mode off` when MCP serving should never trigger network fetches; you can still run `npx -y okfy-ai update stripe` manually.
|
|
80
|
+
|
|
54
81
|
## Create Bundles
|
|
55
82
|
|
|
56
|
-
|
|
83
|
+
The original crawl/import path still works for one-off snapshots and project-local bundles.
|
|
84
|
+
|
|
85
|
+
Docs website snapshot:
|
|
57
86
|
|
|
58
87
|
```bash
|
|
59
88
|
npx -y okfy-ai crawl https://docs.stripe.com/checkout --out ./stripe-checkout-okf --max-pages 25
|
|
@@ -68,6 +97,14 @@ npx -y okfy-ai import ./docs --out ./docs-okf --source-name "Project docs" --for
|
|
|
68
97
|
npx -y okfy-ai validate ./docs-okf
|
|
69
98
|
```
|
|
70
99
|
|
|
100
|
+
Serve an existing bundle path when you already manage the bundle yourself:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx -y okfy-ai serve ./docs-okf --mcp
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Direct bundle paths do not use source auto-refresh.
|
|
107
|
+
|
|
71
108
|
## Optional CLI Install
|
|
72
109
|
|
|
73
110
|
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 +125,9 @@ After installing, this MCP config is equivalent:
|
|
|
88
125
|
```json
|
|
89
126
|
{
|
|
90
127
|
"mcpServers": {
|
|
91
|
-
"
|
|
128
|
+
"stripe-okf": {
|
|
92
129
|
"command": "okfy",
|
|
93
|
-
"args": ["serve", "
|
|
130
|
+
"args": ["serve", "stripe", "--mcp", "--auto-refresh"]
|
|
94
131
|
}
|
|
95
132
|
}
|
|
96
133
|
}
|
|
@@ -107,9 +144,9 @@ npx -y okfy-ai demo
|
|
|
107
144
|
```json
|
|
108
145
|
{
|
|
109
146
|
"mcpServers": {
|
|
110
|
-
"
|
|
147
|
+
"stripe-okf": {
|
|
111
148
|
"command": "npx",
|
|
112
|
-
"args": ["-y", "okfy-ai", "serve", "
|
|
149
|
+
"args": ["-y", "okfy-ai", "serve", "stripe", "--mcp", "--auto-refresh"]
|
|
113
150
|
}
|
|
114
151
|
}
|
|
115
152
|
}
|
|
@@ -118,11 +155,16 @@ npx -y okfy-ai demo
|
|
|
118
155
|
## CLI Commands
|
|
119
156
|
|
|
120
157
|
```bash
|
|
158
|
+
okfy add <name> <url>
|
|
159
|
+
okfy sources
|
|
160
|
+
okfy check <name-or-bundle>
|
|
161
|
+
okfy update <name>
|
|
162
|
+
okfy remove <name>
|
|
121
163
|
okfy crawl <url> --out <dir>
|
|
122
164
|
okfy import <path> --out <dir>
|
|
123
165
|
okfy validate <bundle>
|
|
124
166
|
okfy inspect <bundle>
|
|
125
|
-
okfy serve <bundle> --mcp
|
|
167
|
+
okfy serve <name-or-bundle> --mcp
|
|
126
168
|
okfy demo
|
|
127
169
|
```
|
|
128
170
|
|
|
@@ -130,7 +172,7 @@ okfy demo
|
|
|
130
172
|
|
|
131
173
|
| Tool | Purpose |
|
|
132
174
|
| --- | --- |
|
|
133
|
-
| `bundle_summary` | Show bundle stats and
|
|
175
|
+
| `bundle_summary` | Show bundle stats, validation status, and source freshness when available. |
|
|
134
176
|
| `search_concepts` | Search concept previews by query, type, or tags. |
|
|
135
177
|
| `read_concept` | Read one concept body, frontmatter, links, backlinks, and source. |
|
|
136
178
|
| `get_neighbors` | Traverse outbound links and backlinks around a concept. |
|
|
@@ -140,20 +182,24 @@ okfy demo
|
|
|
140
182
|
## What okfy Generates
|
|
141
183
|
|
|
142
184
|
```text
|
|
143
|
-
docs
|
|
144
|
-
-> OKF bundle: Markdown files + YAML frontmatter + links
|
|
185
|
+
registered docs source or Markdown folder
|
|
186
|
+
-> local OKF bundle: Markdown files + YAML frontmatter + links
|
|
145
187
|
-> MCP server: search_concepts, read_concept, get_neighbors
|
|
146
188
|
-> source-backed agent answers
|
|
147
189
|
```
|
|
148
190
|
|
|
149
|
-
Each source page or Markdown file becomes one OKF concept in v0.1.
|
|
191
|
+
Each non-reserved source page or Markdown file becomes one OKF concept in v0.1. `index.md` and `log.md` are reserved files, not concepts, and generated indexes are plain Markdown. Concept counts, search, graph links, types, tags, and `read_concept` exclude reserved files.
|
|
192
|
+
|
|
193
|
+
Validation errors are limited to OKF conformance: malformed or missing concept frontmatter, missing `type`, or invalid reserved-file structure. Broken internal links and missing indexes are warnings.
|
|
150
194
|
|
|
151
195
|
## Security Defaults
|
|
152
196
|
|
|
153
197
|
- Crawls respect `robots.txt` by default.
|
|
154
198
|
- Crawls stay same-origin by default.
|
|
155
199
|
- Page count, depth, response size, and concurrency are capped.
|
|
156
|
-
- Private network targets are rejected by default for URL crawls.
|
|
200
|
+
- Private network URL literals and redirects to private targets are rejected by default for URL crawls.
|
|
201
|
+
- Preflight DNS-resolved private targets are rejected before fetch; fetch-time DNS is not IP-pinned.
|
|
202
|
+
- `--force` refuses unsafe output directories such as `.`, `/`, the home dir, repo root, input path, input parent, and symlink output dirs unless an explicit dangerous override is provided.
|
|
157
203
|
- HTML and Markdown are treated as text. Scripts are not executed.
|
|
158
204
|
- MCP tools are read-only in v0.1.
|
|
159
205
|
|
package/assets/demo.gif
CHANGED
|
Binary file
|