# NOTICE

This package contains source ported from [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter)
by Nico Bailon, licensed under the MIT License:

- `src/npx-resolver.ts` — ported verbatim (import paths and cache-path helper
  adapted; cache file `mcp-npx-cache.json` v2 format is shared-compatible
  with upstream so a warm cache carries over on migration).
- `src/mcp-output-guard.ts` — ported verbatim (import paths adapted).
- `src/search-ranking.ts` — ported with the state adapter in
  `src/failure-backoff.ts` (upstream's `McpExtensionState` reduced to the
  search-facing `SearchState`).
- `src/prompts.ts` — ported with `PromptRuntime` replacing upstream's
  `McpExtensionState`, and `manager.clientFor()` replacing
  `lazyConnect`/`manager.getPrompt`.
- `src/commands.ts` — /mcp status/tools/prompts text and the
  `writeProjectServerDisabledOverride` semantics ported from upstream
  `commands.ts`/`config.ts`; the extension entry wires them to `ctx.ui`.
- `src/mcp-trace.ts` — protocol tracing ported verbatim (settings type moved
  to `types.ts`; socket transports cut).
- `src/menu.ts` — clean native Pi interactive management menu using standard
  dialogs (`ctx.ui.select`, `ctx.ui.editor`, `ctx.ui.input`, `ctx.ui.notify`),
  avoiding fragile custom terminal overlay diffing entirely.
- `src/proxy.ts` — list/search/describe/instructions output contracts ported
  from upstream `proxy-modes.ts` (cache-first discovery, Found-N search text
  with includeSchemas, Tool/Server describe header, truncateAtWord,
  regex length cap).
- `src/ts-shape.ts` — ported verbatim.
- `src/tool-naming.ts` — naming/prefix/pattern helpers ported verbatim from
  upstream `types.ts`, including the include/exclude selector functions
  (`isToolAllowed` family, glob matcher index).
- `src/metadata-cache.ts` — cache load/save/hash/validation and metadata
  reconstruction ported from upstream; UI-resource and selector-index surfaces
  removed.
- `src/server-manager.ts` — connection lifecycle follows upstream semantics
  (lazy connect with coalescing, idle disconnect, Streamable HTTP → SSE
  fallback on 404/405/406/415, full tools/prompts pagination, npx resolution
  wiring); OAuth/CA/trace surfaces removed.
- `src/abort.ts` — ported verbatim from upstream.
- Config layering (`src/config.ts`) follows upstream's source order and
  on-disk layout (`.mcp.json`, `~/.config/mcp/mcp.json`, `~/.agents/mcp.json`,
  `<agent dir>/mcp.json`, `.pi/mcp.json`) and reads the same
  `mcp-cache.json` metadata cache format (v1).

The upstream project's design of context management — one proxy tool,
disk-cached tool metadata, lazy connections, output guarding — is the core of
this package. Upstream MIT license text:
https://github.com/nicobailon/pi-mcp-adapter/blob/main/LICENSE
