@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
2.29.0-0.0.4- Published
- Sep 2, 2026
- Downloads
- 600/mo · 49/wk
- Author
- njuptlzf
- License
- MIT
- Types
- extension, skill
- Size
- 12.7 MB
- Dependencies
- 13 dependencies · 4 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
],
"skills": [
"./skills"
],
"video": "https://github.com/nicobailon/pi-mcp-adapter/raw/refs/heads/main/pi-mcp.mp4"
}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, currently2.29.0-0.0.4(tracks upstreamv2.29.0). - Pure upstream core —
index.ts,config.ts,agent-dir.ts, etc. run as upstream code; the fork's MCP SDK v1 → v2 migration is isolated in theadapters/host layer so upstream merges stay conflict-free. - 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