cli

module
v0.0.1-dev.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0

README

holon

CI Go Downloads Apache 2.0 License

holon provides type-safety for MCP servers, e.g. invoking an MCP server as a function call your type checker understands.

This is currently supported via the Python SDK, TypeScript SDK and Go SDK.

Install

curl -fsSL https://holon-labs.dev/install.sh | sh

Or with Go 1.27+:

go install github.com/holon-sh/cli/cmd/holon@latest

Create an app

holon init orders --lang py

--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 and Holon serves as a page. The view calls the tool through a typed client:

// orders/ui/main.ts
const { result } = await server.tools.greet({ name: name.value });

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.

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:

cd billing
holon init

Example

Declare dependencies under sh.holon.requires in your project's server.json (publisher-provided metadata). This example uses the public Context7 server.

{
  "name": "com.example/foo",
  "version": "0.1.0",
  "description": "Example Foo",
  "_meta": {
    "io.modelcontextprotocol.registry/publisher-provided": {
      "sh.holon": {
        "requires": {
          "context7": { "name": "io.github.upstash/context7", "version": "4.4.4" }
        }
      }
    }
  }
}

Generate the typed clients and type-check the calls to them.

holon types check

Or name the servers yourself. Any -s replaces the whole requires list, so server.json is not needed.

holon types check -s https://mcp.context7.com/mcp

Call the server. A wrong tool name or argument is a type error.

Python

from holon.apps import apps

await apps.context7.tools.resolve_library_id(libraryName="Next.js", query="app router")

await apps.context7.tools.resolve_library_id(libraryName=1, query="app router")
# error: Argument "libraryName" to "resolve_library_id" of "Context7Tools" has incompatible type "int"; expected "str"  [arg-type]

await apps.context7.tools.resolve_library(libraryName="Next.js", query="app router")
# error: "Context7Tools" has no attribute "resolve_library"; maybe "resolve_library_id"?  [attr-defined]

TypeScript

import { apps } from "#holon-sh";

const libraries = await apps.context7.tools["resolve-library-id"]({ libraryName: "Next.js", query: "app router" });
libraries.content; // Context7 declares no output schema, so the complete result is returned

await apps.context7.tools["resolve-library-id"]({ libraryName: 1, query: "app router" });
// error TS2322: Type 'number' is not assignable to type 'string'.

await apps.context7.tools["resolve-library-id"]({ libraryName: "Next.js" });
// error TS2741: Property '"query"' is missing in type '{ libraryName: string; }' but required in type '{ libraryName: string; query: string; }'.

await apps.context7.tools["resolve-library"]({ libraryName: "Next.js", query: "app router" });
// 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'?
Development Servers

Let's say you have a server that you're still developing, and it's not in any MCP Registry yet.

# bar/server.py
from mcp.server import MCPServer

server = MCPServer("com.example/bar", version="0.1.0", description="Example Bar")


@server.tool()
def greet(name: str) -> str:
    return f"hello {name}"

Pass its entry file with -s.

holon types check foo -s bar/server.py

Python

from holon.apps import apps

greeting = await apps.bar.tools.greet(name="world")
greeting["result"]

await apps.bar.tools.greet(name=1)
# error: Argument "name" to "greet" of "BarTools" has incompatible type "int"; expected "str"  [arg-type]

await apps.bar.tools.hello(name="world")
# error: "BarTools" has no attribute "hello"  [attr-defined]

greeting["text"]
# error: TypedDict "BarGreetOutput" has no key "text"  [typeddict-item]

TypeScript

import { apps } from "#holon-sh";

const greeting = await apps.bar.tools.greet({ name: "world" });
greeting.result;

await apps.bar.tools.greet({ name: 1 });
// error TS2322: Type 'number' is not assignable to type 'string'.

await apps.bar.tools.hello({ name: "world" });
// error TS2339: Property 'hello' does not exist on type '{ readonly greet: (input: { name: string; }, options?: CallOptions | undefined) => Promise<{ result: string; }>; }'.

greeting.text;
// error TS2339: Property 'text' does not exist on type '{ result: string; }'.

Dependencies

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.

A dependency is written in one of three ways.

Source code

An implementation of an MCP server, or its parent directory.

holon types check -s bar/server.py

Registry

A sh.holon.requires entry in server.json, or -s with a registry version URL. The record is fetched for its contract.

holon types check -s https://registry.modelcontextprotocol.io/v0.1/servers/io.github.upstash%2Fcontext7/versions/4.4.4

Server

An endpoint URL. The running server is asked for tools/list and resources/list.

holon types check -s https://mcp.context7.com/mcp

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.

export DOCS_MCP_TOKEN=...
holon types check -s docs=https://mcp.example.com/mcp

Reference

holon init
Create an app in DIR, or the working directory: an MCP server in Go, Python or TypeScript, and a
view it serves as an MCP App and as a page. The app is named after DIR.

In an empty or absent DIR, holon init writes a new project. In a Go module (go.mod), a Python
project (pyproject.toml) or a Node.js project (package.json), it adds the server and the view beside
the project's own files: Go and Python dependencies through go get and uv, npm packages into
package.json, and lines to .gitignore. It leaves the project's scripts and tsconfig.json as written.

holon init pins the newest Holon SDK releases, on npm those that read the clients this holon writes,
installs the dependencies, generates the clients, and adds the app to the working directory's
holon.yaml when DIR is inside it, or else to DIR's.

Usage:
  holon init [DIR] [flags]

Examples:
  # A Go app in ./orders
  holon init orders --lang go

  # A Python app in ./orders
  holon init orders --lang py

  # A TypeScript app in the working directory, with its MCP server name
  holon init --lang ts --name io.github.acme/orders

  # Add an app to the Python project in the working directory
  holon init

Flags:
  -h, --help          help for init
      --lang string   The server's language: go, py or ts; detected in an existing project
      --name string   The MCP server name (default com.example/APP)
holon types generate
Generate typed clients for MCP servers.

Leverages sh.holon.requires in the publisher-provided metadata field
(https://modelcontextprotocol.io/registry/faq#can-i-add-custom-metadata-when-publishing) to
resolve dependencies, or the -s list for explicit dependencies.

Usage:
  holon types generate [DIR] [flags]

Examples:
  # Generate for the current project
  holon types generate

  # Another project
  holon types generate ../checkout

  # Name the project's own server to call it from outside the browser too, as apps.orders
  holon types generate -s orders=./server

  # Explicit dependencies: a server directory, a server entry, an MCP registry server, a remote
  #   MCP server named docs
  holon types generate -s ../orders
  holon types generate -s ../orders/server.py
  holon types generate -s https://registry.modelcontextprotocol.io/v0.1/servers/io.github.upstash%2Fcontext7/versions/4.4.4
  holon types generate -s docs=https://mcp.context7.com/mcp

  # A remote MCP server that requires a token: DOCS_MCP_TOKEN is sent to it as a bearer token
  DOCS_MCP_TOKEN=... holon types generate -s docs=https://mcp.example.com/mcp

  # Print one server's contract, or commit it beside its server.json
  holon types generate --contract ../orders
  holon types generate --contract ../orders -o ../orders/holon-contract.json

Flags:
      --contract string      Print one server's MCP contract instead of generating
  -h, --help                 help for generate
  -o, --output string        Write the --contract document to FILE, such as holon-contract.json
  -s, --server stringArray   A dependency, [ALIAS=]PATH or URL, paths relative to the working
                             directory
  -v, --verbose              Show generation details
holon types check
Generate typed clients for MCP servers, then type-check the project's calls to them.

Leverages sh.holon.requires in the publisher-provided metadata field
(https://modelcontextprotocol.io/registry/faq#can-i-add-custom-metadata-when-publishing) to
resolve dependencies, or the -s list for explicit dependencies.

Usage:
  holon types check [DIR] [flags]

Examples:
  # Generate, then type-check
  holon types check

  # Type-check the existing clients only (no network, no writes)
  holon types check --no-generate

  # Explicit dependencies, as for generate
  holon types check -s orders=../orders

Flags:
  -h, --help                 help for check
      --no-generate          Type-check the existing clients only: no network, no install, no
                             writes
  -s, --server stringArray   A dependency, [ALIAS=]PATH or URL, paths relative to the working
                             directory

Directories

Path Synopsis
cmd
holon command
internal
pkg
cli
Package cli provides the portable Holon commands for standalone and extended executables.
Package cli provides the portable Holon commands for standalone and extended executables.
mcpcontract
Package mcpcontract holds the typed-contract wire format Holon publishes in image metadata and helpers for generated files.
Package mcpcontract holds the typed-contract wire format Holon publishes in image metadata and helpers for generated files.
mcptype
Package mcptype compares MCP typed contracts and generates typed client packages.
Package mcptype compares MCP typed contracts and generates typed client packages.
scaffold
Package scaffold writes Holon apps: an MCP server and the view it serves, in Go, Python or TypeScript, into a new directory or beside an existing project in that language.
Package scaffold writes Holon apps: an MCP server and the view it serves, in Go, Python or TypeScript, into a new directory or beside an existing project in that language.
tooling
Package tooling embeds the public SDK extraction and checking tools.
Package tooling embeds the public SDK extraction and checking tools.
typegen
Package typegen turns MCP server sources into typed clients written into the projects that call them.
Package typegen turns MCP server sources into typed clients written into the projects that call them.
oauthscope module
tooling
python
Package python embeds the Python contract runner that pkg/tooling unpacks.
Package python embeds the Python contract runner that pkg/tooling unpacks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL