npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@utcp/code-mode-cli

v0.1.1

Published

Shell CLI that lets ANY LLM agent call UTCP tools via code mode — discover tools, run TypeScript tool-chains in a sandbox, and complete interactive OAuth logins. No MCP required. Built for sandboxed agents (e.g. Claude Cowork).

Downloads

283

Readme

@utcp/code-mode-cli

Call any API by writing code — from any shell. No MCP required.

utcp lets an LLM agent discover UTCP tools, run TypeScript tool-chains in a sandbox, and complete interactive OAuth logins — using only shell commands and a local config file. Built for sandboxed agents (e.g. Claude Cowork) that have a shell but no MCP.

You don't run the CLI yourself

Hand an agent a description of the API you want used — any of:

  • a UTCP call template (paste it directly),
  • an OpenAPI / Swagger spec (a URL, or a file the agent reads),
  • or just a plain-English description of the API (endpoints, base URL, auth).

…and tell it to run:

npx -y @utcp/code-mode-cli prompt

That command prints the full self-configuration + usage guide; the agent reads it, writes a .utcp_config.json, and takes it from there. Everything else below is reference.


What the agent does

  1. Configure — turn your API description into a UTCP manual in .utcp_config.json:
    • call template / OpenAPI URL → an http (or mcp) manual,
    • OpenAPI file / plain-English description → write a UTCP manual JSON file and load it with a file manual.
  2. validate — check the config + manuals are well-formed and register.
  3. search — discover tools and their TypeScript interfaces.
  4. run — execute a tool-chain (tools are called as manual.tool({ args })).
  5. login — if a tool needs interactive sign-in, complete OAuth (it shows you the URL, you authorize, the token is saved to .env).

Every command prints JSON to stdout (login prints one JSON object per line); diagnostics go to stderr, so stdout pipes cleanly into jq.

Commands

| Command | Description | | --- | --- | | prompt | Print the full agent guide (read first). | | search <query> [--limit N] | Find tools; returns name + description + TS interface. | | list | List all registered tool names. | | info <tool...> | Print TypeScript interfaces for the named tools. | | keys <tool> | List required variables (e.g. tokens) for a tool. | | run [code] [-c <code>] [--file <p>] [--timeout <ms>] | Execute a tool-chain (also reads stdin). | | login <manual> [--paste] [--code <code\|url>] | Interactive OAuth sign-in; writes the token to .env. | | validate [--offline] | Validate .utcp_config.json + its manuals (registers each unless --offline). | | validate --manual <file...> | Validate standalone UTCP manual file(s). | | --help | Short usage. |

Global: --config <path> to use a specific config file (default ./.utcp_config.json).

Config example

{
  "load_variables_from": [
    { "variable_loader_type": "dotenv", "env_file_path": ".env" }
  ],
  "manual_call_templates": [
    {
      "name": "openlibrary",
      "call_template_type": "http",
      "http_method": "GET",
      "url": "https://openlibrary.org/static/openapi.json",
      "content_type": "application/json"
    }
  ]
}

Interactive OAuth (oauth2_user)

Declare an oauth2_user auth block; the token is provisioned by utcp login and injected on every call afterwards (UTCP never runs the flow itself).

  • Remote MCP server (e.g. Notion): minimal block — endpoints auto-discovered via the MCP SDK (discovery + dynamic client registration + PKCE):
    "auth": { "auth_type": "oauth2_user", "access_token": "${NOTION_TOKEN}" }
    utcp login notion prints a sign-in URL; the user authorizes and pastes the redirect URL back via --code.
  • HTTP API with a device-code flow: declare device_authorization_endpoint, token_endpoint, client_id, scope; utcp login <manual> prints a URL + code and polls until done.

Tokens are written to the dotenv file (default .env), keyed by the namespaced variable UTCP looks up (<manual>_<VAR>), so the dotenv loader block is required when using ${VAR} secrets or oauth2_user.

Security: the bundled @utcp/cli plugin lets a manual run arbitrary local commands. Only register manuals from sources you trust.

Prerequisites

  • Node.js ≥ 18.
  • isolated-vm is a native addon; on Windows it needs the Visual Studio C++ build tools / node-gyp toolchain.

Local development

Lives in the code-mode repo alongside typescript-library (the @utcp/code-mode engine) and code-mode-mcp (the MCP bridge). Depends on published @utcp/* (@utcp/sdk ≥ 1.1.1, @utcp/http ≥ 1.1.7, @utcp/mcp ≥ 1.1.3 — the ones carrying the oauth2_user variant).

npm install
npm run build
node dist/index.js --help