holon-types 0.0.1-dev.19 → 0.0.1-dev.21

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 (2) hide show
  1. package/README.md +31 -208
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,13 +1,12 @@
1
1
  # holon
2
2
 
3
3
  [![CI](https://github.com/holon-sh/cli/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/holon-sh/cli/actions/workflows/ci.yml)
4
+ [![Docs](https://img.shields.io/badge/docs-holon--labs.dev-blue)](https://holon-labs.dev/docs/)
4
5
  [![Go](https://img.shields.io/badge/Go-1.27%2B-00ADD8?logo=go)](https://go.dev/doc/install)
5
- [![Downloads](https://img.shields.io/badge/releases-download-blue)](https://github.com/holon-sh/cli/releases/latest)
6
6
  [![Apache 2.0 License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)
7
+ [![Discord](https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white)](https://discord.gg/jXExyBdy)
7
8
 
8
- `holon` provides type-safety for MCP servers, e.g. invoking an MCP server as a function call your type checker understands.
9
-
10
- This is currently supported via the [Python SDK](https://github.com/holon-sh/sdk-py), [TypeScript SDK](https://github.com/holon-sh/sdk-ts) and [Go SDK](https://github.com/holon-sh/sdk-go).
9
+ `holon` is a framework for [type-safe](https://holon-labs.dev/docs/#types) [MCP servers](https://modelcontextprotocol.io/docs/learn/server-concepts).
11
10
 
12
11
  ## Install
13
12
 
@@ -15,37 +14,18 @@ This is currently supported via the [Python SDK](https://github.com/holon-sh/sdk
15
14
  curl -fsSL https://holon-labs.dev/install.sh | sh
16
15
  ```
17
16
 
18
- Or with [Go](https://go.dev/doc/install) 1.27+:
19
-
20
- ```sh
21
- go install github.com/holon-sh/cli/cmd/holon@latest
22
- ```
23
-
24
- ## Create an app
25
-
26
- ```sh
27
- holon init orders --lang py
28
- ```
29
-
30
- `--lang ts` writes the server in TypeScript instead, and `--lang go` in Go. Each app has an MCP server with one tool, `greet`, and a view the server returns as an [MCP App](https://modelcontextprotocol.io/extensions/apps/overview) and Holon serves as a page. The view calls the tool through a typed client:
31
-
32
- ```ts
33
- // orders/ui/main.ts
34
- const { result } = await server.tools.greet({ name: name.value });
35
- ```
36
-
37
- `holon init` pins the newest Holon SDK releases (on npm, those that read the clients it writes), installs the dependencies (`uv` for Python, `go get` for Go, the project's package manager for Node.js), generates the clients, and adds the app to `holon.yaml`. `holon types check` then type-checks the server and the view. A Go server's contract isn't read from its source, so its view calls `greet` untyped, and `go build` type-checks the server. Run the app with [`holon dev`](https://holon-labs.dev/docs/).
17
+ ## Example
38
18
 
39
- In an existing Go module, Python project or Node.js project, `holon init` adds the server and the view beside the project's files, and the dependencies to its `go.mod`, `pyproject.toml` or `package.json`:
19
+ ### Create an app
40
20
 
41
21
  ```sh
42
- cd billing
43
- holon init
22
+ holon init foo --lang py # python
23
+ holon init foo --lang ts # typescript
44
24
  ```
45
25
 
46
- ## Example
26
+ ### Dependencies
47
27
 
48
- Declare dependencies under `sh.holon.requires` in your project's [`server.json`](https://modelcontextprotocol.io/registry/quickstart#step-4-create-server-json) ([publisher-provided metadata](https://modelcontextprotocol.io/registry/faq#can-i-add-custom-metadata-when-publishing)). This example uses the public [Context7](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.upstash%2Fcontext7/versions/4.4.4) server.
28
+ Declare dependencies under `sh.holon.requires` in a [`server.json`](https://modelcontextprotocol.io/registry/quickstart#step-4-create-server-json) beside the server ([publisher-provided metadata](https://modelcontextprotocol.io/registry/faq#can-i-add-custom-metadata-when-publishing)). This example uses the public [Hugging Face](https://huggingface.co/docs/hub/en/hf-mcp-server) MCP server.
49
29
 
50
30
  ```json
51
31
  {
@@ -56,7 +36,7 @@ Declare dependencies under `sh.holon.requires` in your project's [`server.json`]
56
36
  "io.modelcontextprotocol.registry/publisher-provided": {
57
37
  "sh.holon": {
58
38
  "requires": {
59
- "context7": { "name": "io.github.upstash/context7", "version": "4.4.4" }
39
+ "huggingface": { "url": "https://huggingface.co/mcp" }
60
40
  }
61
41
  }
62
42
  }
@@ -64,6 +44,8 @@ Declare dependencies under `sh.holon.requires` in your project's [`server.json`]
64
44
  }
65
45
  ```
66
46
 
47
+ ### Types
48
+
67
49
  Generate the typed clients and type-check the calls to them.
68
50
 
69
51
  ```sh
@@ -73,7 +55,7 @@ holon types check
73
55
  Or name the servers yourself. Any `-s` replaces the whole `requires` list, so `server.json` is not needed.
74
56
 
75
57
  ```sh
76
- holon types check -s https://mcp.context7.com/mcp
58
+ holon types check -s huggingface=https://huggingface.co/mcp
77
59
  ```
78
60
 
79
61
  Call the server. A wrong tool name or argument is a type error.
@@ -84,13 +66,16 @@ Call the server. A wrong tool name or argument is a type error.
84
66
  ```python
85
67
  from holon.apps import apps
86
68
 
87
- await apps.context7.tools.resolve_library_id(libraryName="Next.js", query="app router")
69
+ await apps.huggingface.tools.hub_repo_search(query="llama")
70
+
71
+ await apps.huggingface.tools.hub_repo_search(limit="3")
72
+ # error: Argument "limit" to "hub_repo_search" of "HuggingfaceTools" has incompatible type "str"; expected "float" [arg-type]
88
73
 
89
- await apps.context7.tools.resolve_library_id(libraryName=1, query="app router")
90
- # error: Argument "libraryName" to "resolve_library_id" of "Context7Tools" has incompatible type "int"; expected "str" [arg-type]
74
+ await apps.huggingface.tools.hub_repo_details()
75
+ # error: Missing named argument "repo_ids" for "hub_repo_details" of "HuggingfaceTools" [call-arg]
91
76
 
92
- await apps.context7.tools.resolve_library(libraryName="Next.js", query="app router")
93
- # error: "Context7Tools" has no attribute "resolve_library"; maybe "resolve_library_id"? [attr-defined]
77
+ await apps.huggingface.tools.hub_search(query="llama")
78
+ # error: "HuggingfaceTools" has no attribute "hub_search"; maybe "hub_repo_search"? [attr-defined]
94
79
  ```
95
80
 
96
81
  </details>
@@ -101,17 +86,16 @@ await apps.context7.tools.resolve_library(libraryName="Next.js", query="app rout
101
86
  ```ts
102
87
  import { apps } from "#holon-sh";
103
88
 
104
- const libraries = await apps.context7.tools["resolve-library-id"]({ libraryName: "Next.js", query: "app router" });
105
- libraries.content; // Context7 declares no output schema, so the complete result is returned
89
+ await apps.huggingface.tools.hub_repo_search({ query: "llama" });
106
90
 
107
- await apps.context7.tools["resolve-library-id"]({ libraryName: 1, query: "app router" });
108
- // error TS2322: Type 'number' is not assignable to type 'string'.
91
+ await apps.huggingface.tools.hub_repo_search({ limit: "3" });
92
+ // error TS2322: Type 'string' is not assignable to type 'number'.
109
93
 
110
- await apps.context7.tools["resolve-library-id"]({ libraryName: "Next.js" });
111
- // error TS2741: Property '"query"' is missing in type '{ libraryName: string; }' but required in type '{ libraryName: string; query: string; }'.
94
+ await apps.huggingface.tools.hub_repo_details({});
95
+ // error TS2741: Property '"repo_ids"' is missing in type '{}' but required in type '{ config?: string | undefined; limit?: number | undefined; offset?: number | undefined; operations?: ("dataset_preview" | "dataset_structure" | "overview")[] | undefined; repo_ids: string[]; repo_type?: "dataset" | ... 2 more ... | undefined; split?: string | undefined; }'.
112
96
 
113
- await apps.context7.tools["resolve-library"]({ libraryName: "Next.js", query: "app router" });
114
- // error TS2551: Property 'resolve-library' does not exist on type '{ readonly "query-docs": (input: { language?: string | undefined; libraryId: string; query: string; }, options?: CallOptions | undefined) => Promise<CompleteResult<unknown>>; readonly "resolve-library-id": (input: { ...; }, options?: CallOptions | undefined) => Promise<...>; }'. Did you mean 'resolve-library-id'?
97
+ await apps.huggingface.tools.hub_search({ query: "llama" });
98
+ // error TS2339: Property 'hub_search' does not exist on type '{ readonly hf_fs: (input: { operations: { args: string[]; cmd: "attach" | "cat" | "find" | "ls" | "search" | "stat"; }[]; }, options?: ToolCallOptions | undefined) => Promise<{ results: ({ ...; } | { ...; })[]; truncated?: boolean | undefined; truncation_reason?: "output_budget" | undefined; }>; readonly hf_whoami: ...'.
115
99
  ```
116
100
 
117
101
  </details>
@@ -180,171 +164,10 @@ greeting.text;
180
164
 
181
165
  </details>
182
166
 
183
- ## Dependencies
184
-
185
- A dependency is an MCP server your project calls. For each one `holon` obtains a contract—the JSON Schemas of the server's tools and resources—and writes a typed client `apps.<alias>` into your project, for the SDK it declares: `generated/holon-sh/` for `holon-sh`, `generated/holon-ui/` for `holon-ui`, `holon/apps/` for Python and `holon/` for Go. TypeScript imports them as `#holon-sh` or `#holon-ui`, names `holon` adds to the `imports` of your `package.json`. A package that publishes code calling its clients lists `generated/holon-sh` in its `files`, so the projects that install it need not generate. `holon types check` then runs the language's type checker over your code against those clients. A TypeScript project needs a `tsconfig.json`, found as `tsc` finds it.
186
-
187
- A dependency is written in one of three ways.
188
-
189
- <details open>
190
- <summary><h3>Source code</h3></summary>
191
-
192
- An implementation of an MCP server, or its parent directory.
193
-
194
- ```sh
195
- holon types check -s bar/server.py
196
- ```
197
-
198
- </details>
199
-
200
- <details open>
201
- <summary><h3>Registry</h3></summary>
202
-
203
- A `sh.holon.requires` entry in [`server.json`](https://modelcontextprotocol.io/registry/quickstart#step-4-create-server-json), or `-s` with a registry version URL. The record is fetched for its contract.
204
-
205
- ```sh
206
- holon types check -s https://registry.modelcontextprotocol.io/v0.1/servers/io.github.upstash%2Fcontext7/versions/4.4.4
207
- ```
208
-
209
- </details>
210
-
211
- <details open>
212
- <summary><h3>Server</h3></summary>
167
+ ## Community
213
168
 
214
- An endpoint URL. The running server is asked for `tools/list` and `resources/list`.
215
-
216
- ```sh
217
- holon types check -s https://mcp.context7.com/mcp
218
- ```
219
-
220
- If the server requires a token, name it and set `<ALIAS>_MCP_TOKEN`. The token is sent only to that URL's origin, as a bearer token, and is not written anywhere.
221
-
222
- ```sh
223
- export DOCS_MCP_TOKEN=...
224
- holon types check -s docs=https://mcp.example.com/mcp
225
- ```
226
-
227
- </details>
169
+ Ask questions and share what you're building on the [Holon Discord](https://discord.gg/jXExyBdy).
228
170
 
229
171
  ## Reference
230
172
 
231
- <details open>
232
- <summary><code>holon init</code></summary>
233
-
234
- ```text
235
- Create an app in DIR, or the working directory: an MCP server in Go, Python or TypeScript, and a
236
- view it serves as an MCP App and as a page. The app is named after DIR.
237
-
238
- In an empty or absent DIR, holon init writes a new project. In a Go module (go.mod), a Python
239
- project (pyproject.toml) or a Node.js project (package.json), it adds the server and the view beside
240
- the project's own files: Go and Python dependencies through go get and uv, npm packages into
241
- package.json, and lines to .gitignore. It leaves the project's scripts and tsconfig.json as written.
242
-
243
- holon init pins the newest Holon SDK releases, on npm those that read the clients this holon writes,
244
- installs the dependencies, generates the clients, and adds the app to the working directory's
245
- holon.yaml when DIR is inside it, or else to DIR's.
246
-
247
- Usage:
248
- holon init [DIR] [flags]
249
-
250
- Examples:
251
- # A Go app in ./orders
252
- holon init orders --lang go
253
-
254
- # A Python app in ./orders
255
- holon init orders --lang py
256
-
257
- # A TypeScript app in the working directory, with its MCP server name
258
- holon init --lang ts --name io.github.acme/orders
259
-
260
- # Add an app to the Python project in the working directory
261
- holon init
262
-
263
- Flags:
264
- -h, --help help for init
265
- --lang string The server's language: go, py or ts; detected in an existing project
266
- --name string The MCP server name (default com.example/APP)
267
- ```
268
-
269
- </details>
270
-
271
- <details open>
272
- <summary><code>holon types generate</code></summary>
273
-
274
- ```text
275
- Generate typed clients for MCP servers.
276
-
277
- Leverages sh.holon.requires in the publisher-provided metadata field
278
- (https://modelcontextprotocol.io/registry/faq#can-i-add-custom-metadata-when-publishing) to
279
- resolve dependencies, or the -s list for explicit dependencies.
280
-
281
- Usage:
282
- holon types generate [DIR] [flags]
283
-
284
- Examples:
285
- # Generate for the current project
286
- holon types generate
287
-
288
- # Another project
289
- holon types generate ../checkout
290
-
291
- # Name the project's own server to call it from outside the browser too, as apps.orders
292
- holon types generate -s orders=./server
293
-
294
- # Explicit dependencies: a server directory, a server entry, an MCP registry server, a remote
295
- # MCP server named docs
296
- holon types generate -s ../orders
297
- holon types generate -s ../orders/server.py
298
- holon types generate -s https://registry.modelcontextprotocol.io/v0.1/servers/io.github.upstash%2Fcontext7/versions/4.4.4
299
- holon types generate -s docs=https://mcp.context7.com/mcp
300
-
301
- # A remote MCP server that requires a token: DOCS_MCP_TOKEN is sent to it as a bearer token
302
- DOCS_MCP_TOKEN=... holon types generate -s docs=https://mcp.example.com/mcp
303
-
304
- # Print one server's contract, or commit it beside its server.json
305
- holon types generate --contract ../orders
306
- holon types generate --contract ../orders -o ../orders/holon-contract.json
307
-
308
- Flags:
309
- --contract string Print one server's MCP contract instead of generating
310
- -h, --help help for generate
311
- -o, --output string Write the --contract document to FILE, such as holon-contract.json
312
- -s, --server stringArray A dependency, [ALIAS=]PATH or URL, paths relative to the working
313
- directory
314
- -v, --verbose Show generation details
315
- ```
316
-
317
- </details>
318
-
319
- <details open>
320
- <summary><code>holon types check</code></summary>
321
-
322
- ```text
323
- Generate typed clients for MCP servers, then type-check the project's calls to them.
324
-
325
- Leverages sh.holon.requires in the publisher-provided metadata field
326
- (https://modelcontextprotocol.io/registry/faq#can-i-add-custom-metadata-when-publishing) to
327
- resolve dependencies, or the -s list for explicit dependencies.
328
-
329
- Usage:
330
- holon types check [DIR] [flags]
331
-
332
- Examples:
333
- # Generate, then type-check
334
- holon types check
335
-
336
- # Type-check the existing clients only (no network, no writes)
337
- holon types check --no-generate
338
-
339
- # Explicit dependencies, as for generate
340
- holon types check -s orders=../orders
341
-
342
- Flags:
343
- -h, --help help for check
344
- --no-generate Type-check the existing clients only: no network, no install, no
345
- writes
346
- -s, --server stringArray A dependency, [ALIAS=]PATH or URL, paths relative to the working
347
- directory
348
- ```
349
-
350
- </details>
173
+ See the [CLI reference](https://holon-labs.dev/docs/#cli-reference).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holon-types",
3
- "version": "0.0.1-dev.19",
3
+ "version": "0.0.1-dev.21",
4
4
  "description": "The holon CLI: typed clients for MCP servers, generated and type-checked",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,9 +15,9 @@
15
15
  "node": ">=22"
16
16
  },
17
17
  "optionalDependencies": {
18
- "holon-types-darwin-x64": "0.0.1-dev.19",
19
- "holon-types-darwin-arm64": "0.0.1-dev.19",
20
- "holon-types-linux-x64": "0.0.1-dev.19",
21
- "holon-types-linux-arm64": "0.0.1-dev.19"
18
+ "holon-types-darwin-x64": "0.0.1-dev.21",
19
+ "holon-types-darwin-arm64": "0.0.1-dev.21",
20
+ "holon-types-linux-x64": "0.0.1-dev.21",
21
+ "holon-types-linux-arm64": "0.0.1-dev.21"
22
22
  }
23
23
  }