pi-dense-mem
Pi extension that exposes dense-mem MCP tools as native Pi tools. Replaces pi-mcp-adapter proxy for dense-mem only.
Package details
Install pi-dense-mem from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-dense-mem- Package
pi-dense-mem- Version
0.1.1- Published
- Aug 30, 2026
- Downloads
- 329/mo · 15/wk
- Author
- vectorfield4
- License
- MIT
- Types
- extension
- Size
- 83.8 KB
- Dependencies
- 1 dependency · 0 peers
Pi manifest JSON
{
"extensions": [
"./dist/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-dense-mem
Pi extension that exposes dense-mem
production MCP tools as native Pi tools. Replaces the pi-mcp-adapter proxy
for dense-mem with a direct JSON-RPC client and eliminates the per-call
discovery/formatting round-trip.
Status
v0.1.0 — production tool set (7 tools), 89 tests passing, strict TypeScript
with exactOptionalPropertyTypes and noUncheckedIndexedAccess.
Install
pi install npm:pi-dense-mem@0.1.1
(Published as pi-dense-mem on npm; can also be installed as a regular
npm package: npm install pi-dense-mem.)
Configure
Set PI_DENSE_MEM_URL (default http://127.0.0.1:8080/mcp) and any other
env vars you need.
Tools
| Pi name | Server method | Read/Write |
|---|---|---|
dense_mem_recall_memory |
recall_memory |
R |
dense_mem_remember |
remember |
W |
dense_mem_get_submission_status |
get_submission_status |
R |
dense_mem_retract_evidence |
retract_evidence |
W |
dense_mem_correct_relationship |
correct_relationship |
W |
dense_mem_trace_memory |
trace_memory |
R |
dense_mem_export_memory_pack |
export_memory_pack |
R |
Tool registration is dynamic: tools/list runs on session_start and
only the tools the server actually exposes are registered. The server
catalog is the source of truth.
Architecture
┌─────────────────────┐
│ Pi extension │
│ (this package) │
├─────────────────────┤
│ extension.ts │ ← factory + lifecycle, calls buildExtension
│ config/schema.ts │ ← TypeBox-validated env > file > defaults
│ log/logger.ts │ ← JSON to stderr, no deps
│ jsonrpc/client.ts │ ← JSON-RPC 2.0 over fetch, stdlib only
│ client/ │ ← high-level, retry, error translation
│ ready/wait.ts │ ← exponential backoff, abortable
│ tools/production.ts │ ← 7 production tools, TypeBox schemas
│ tools/create-tool.ts│ ← shared wrapper: validation + serialization
│ errors.ts │ ← DenseMemError taxonomy
│ retry.ts │ ← exponential backoff with jitter
└─────────────────────┘
│
│ HTTP POST /mcp (JSON-RPC 2.0)
▼
┌─────────────────────┐
│ dense-mem server │
│ (Docker, port 8080) │
└─────────────────────┘
Zero runtime dependencies beyond @sinclair/typebox (which is a pure
type-level library; the runtime cost is zero). All HTTP, retry, JSON-RPC,
and logging are implemented on top of Node 20+ stdlib.
Development
npm install
npm test # 89 tests, no network required
npm run typecheck # tsc --noEmit, strict
npm run build # tsc -p tsconfig.build.json → dist/
Tests use vitest. No real dense-mem server is needed — the JSON-RPC client
takes a fetch implementation that you can mock.
TDD
Every module was written test-first:
test/errors.test.ts → src/errors.ts
test/retry.test.ts → src/retry.ts
test/jsonrpc.test.ts → src/jsonrpc/client.ts
test/client.test.ts → src/client/dense-mem-client.ts
test/config.test.ts → src/config/schema.ts
test/logger.test.ts → src/log/logger.ts
test/ready.test.ts → src/ready/wait.ts
test/tools.test.ts → src/tools/create-tool.ts
test/production-tools.test.ts → src/tools/production.ts
test/extension.test.ts → src/extension.ts
License
MIT. See LICENSE.