@njuptlzf/mcp-adapter
Universal MCP (Model Context Protocol) adapter — Pi as a first-class host, plus any MCP-compatible coding agent via the universal mcp-server entry
Package details
Install @njuptlzf/mcp-adapter from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@njuptlzf/mcp-adapter- Package
@njuptlzf/mcp-adapter- Version
5.2.0-0.0.6- Published
- Oct 12, 2026
- Downloads
- 526/mo · 358/wk
- Author
- njuptlzf
- License
- MIT
- Types
- extension, skill
- Size
- 10.7 MB
- Dependencies
- 16 dependencies · 4 peers
Pi manifest JSON
{
"video": "https://github.com/nicobailon/pi-mcp-adapter/raw/refs/heads/main/pi-mcp.mp4",
"skills": [
"./skills"
],
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@njuptlzf/mcp-adapter
Universal MCP (Model Context Protocol) adapter — Pi as a first-class host (native extension), plus any MCP-compatible coding agent via the universal mcp-server stdio entry point.
Fork of
nicobailon/pi-mcp-adapter. The full upstream documentation is preserved in README-src.md.
Use MCP servers without burning your context window: one ~200-token proxy tool instead of hundreds of tool definitions. Servers start lazily on first use, and tool metadata is cached so search/describe work with no live connection.
What this fork changes
- Repackaged as
@njuptlzf/mcp-adapter— org-scoped npm package, currently5.2.0-0.0.6(tracks upstreamv5.2.0). - Config-watch self-heal for the stdio entry (issue #34) —
mcp-serverfingerprints every config file it loaded and re-checks them on a timer; a manifest written after startup no longer leaves the process stuck with stale servers. On drift the adapter logs the truth and exits(0) so a supervising client respawns it with the fresh config;mcp({ action: "reload" })forces the same restart manually, andMCP_CONFIG_WATCH=0downgrades to warn-only.mcp({})status and tool-not-found results report the config paths and whether they changed since process start. - Pure upstream core —
index.ts,config.ts,agent-dir.ts, etc. run as upstream code; the fork's host layer lives inadapters/(andinterfaces/) so upstream merges stay surgical. - Universal host —
adapters/universal-host.tsimpersonates Pi'sExtensionAPI, so the same engine runs unchanged behind themcp-serverstdio layer for any MCP-compatible agent. - Prebuilt subpath exports —
@njuptlzf/mcp-adapter/types,/config, and/metadata-cacheship compiled.js+.d.tsfromdist/.
Install
Pi (recommended)
pi install npm:@njuptlzf/mcp-adapter
Restart Pi. Standard MCP files (.mcp.json, ~/.config/mcp/mcp.json) are discovered automatically.
Any other MCP-compatible agent
{
"mcpServers": {
"mcp-adapter": { "command": "mcp-server" }
}
}
Entry points
| Bin | File | Purpose |
|---|---|---|
pi-mcp-adapter |
cli.js |
CLI — init (detect host configs → Pi imports), token (bearer auth) |
mcp-adapter / mcp-server |
mcp-server.mjs |
Universal stdio MCP server (self-contained esbuild bundle) |
Programmatic Pi entry point (backward-compatible):
import { mcpAdapter } from "@njuptlzf/mcp-adapter";
export default mcpAdapter(pi);
Development
npm install
npm test # prebuild visualizer + full vitest suite
npm run typecheck # tsc --noEmit
npm run build:public # tsc -> dist/ (subpath exports)
npm run build:mcp-server # esbuild -> self-contained mcp-server.mjs
Docs
- README-src.md — full upstream documentation (config options, agent skills, OAuth, MCP UI, direct tools, verification).
- MAPPING.md — host-surface contract for the universal host.
- CHANGELOG.md — release history.
License
MIT