▲reactivite
/packages/docs/courses/cli/skillpool/promaster/contact
all docs

$ npm view @ubuligan/shared

Utility

@ubuligan/shared

Shared, dependency-free types and utilities for the MCP Toolkit — logger, retry, and transport types reused across the packages.

npm versiondownloads
npm github
$ npm install @ubuligan/shared

Shared, dependency-free types and utilities for the MCP Toolkit. Browser-safe — no MCP SDK import — so it can be used from both Node and the browser.

It is the base layer that @ubuligan/client, @ubuligan/server and @ubuligan/react build on. You rarely install it directly — it comes in as a transitive dependency — but its types and helpers are useful on their own.

Install#

npm install @ubuligan/shared

What's inside#

ExportKindPurpose
createConsoleLogger(level)fnA leveled console logger (debug / info / warn / error).
noopLoggerconstA logger that discards everything (default when none is given).
Logger, LogLeveltypeThe logger interface and the level union.
withRetry(fn, opts, logger, label)fnRun an async fn with exponential-backoff + jitter retries.
RetryOptionstype{ retries, minDelayMs, maxDelayMs, shouldRetry }.
resolveAuthHeaders(auth)fnTurn an AuthConfig into HTTP headers (async).
AuthConfigtype{ type: "bearer" } or { type: "headers" } (values may be async getters).
TransportConfigtypeUnion of StdioTransportConfig and HttpTransportConfig.

Usage#

Logging#

import { createConsoleLogger } from "@ubuligan/shared";

const log = createConsoleLogger("info"); // logs info+ to the console
log.debug("hidden"); // below level → dropped
log.info("connecting", { url });
log.error("failed", err);

Retry#

import { withRetry, createConsoleLogger } from "@ubuligan/shared";

const data = await withRetry(
  () => fetch(url).then((r) => r.json()),
  { retries: 3, minDelayMs: 200, maxDelayMs: 5000 },
  createConsoleLogger("warn"),
  "fetch-data", // label shown in retry logs
);

Auth headers#

import { resolveAuthHeaders } from "@ubuligan/shared";

const headers = resolveAuthHeaders({ type: "bearer", token: process.env.TOKEN! });
// → { Authorization: "Bearer ..." }

License#

MIT

  • home
  • packages
  • skillpool
  • docs
  • cli
▲reactivite

// The fastest way to scaffold production-ready React apps. Built by developers, for developers.

$ npm create reactivite@latest

resources/

  • └─ documentation
  • └─ packages
  • └─ cli
  • └─ courses
  • └─ markdown
  • └─ diff
  • └─ run
  • └─ radio
  • └─ tv
  • └─ games
  • └─ about
  • └─ contact

community/

  • └─ github

© 2026 reactivite — all rights reserved