@jangmanj/mcp 0.12.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,18 +5,18 @@
5
5
  */
6
6
 
7
7
  import { createHash } from "node:crypto";
8
- import { McpClient } from "../../dist/index.js";
8
+ import { McpClient } from "@jangmanj/mcp/core";
9
9
  import {
10
10
  createOps,
11
11
  normalizeContent,
12
12
  type Ops,
13
13
  type ToolCallResult,
14
14
  type ToolEntry,
15
- } from "../../dist/ops/index.js";
16
- import { HttpTransport } from "../../dist/transport-http/index.js";
17
- import { StdioTransport } from "../../dist/transport-stdio/index.js";
18
- import { createTasksExtension } from "../../dist/mrtr-cache/index.js";
19
- import type { Outcome } from "../../dist/index.js";
15
+ } from "@jangmanj/mcp/ops";
16
+ import { HttpTransport } from "@jangmanj/mcp/transport-http";
17
+ import { StdioTransport } from "@jangmanj/mcp/transport-stdio";
18
+ import { createTasksExtension } from "@jangmanj/mcp/mrtr-cache";
19
+ import type { Outcome } from "@jangmanj/mcp/core";
20
20
  import type { Exposure, ResolvedServerConfig } from "./config.ts";
21
21
  import { convertBlocksOffloaded } from "./content-offloaded.ts";
22
22
  import { DiagnosticsLog } from "./diagnostics.ts";
@@ -1,6 +1,6 @@
1
1
  /** Async content conversion with built-in MCP's 20 KB middle-out truncation. */
2
2
 
3
- import type { ContentBlock } from "../../dist/ops/index.js";
3
+ import type { ContentBlock } from "@jangmanj/mcp/ops";
4
4
  import type { PiContent } from "./pi-api.ts";
5
5
  import { offloadBinary, offloadText } from "./result-files.ts";
6
6
 
@@ -7,7 +7,7 @@
7
7
  * text description so the model always sees something.
8
8
  */
9
9
 
10
- import type { ContentBlock } from "../../dist/ops/index.js";
10
+ import type { ContentBlock } from "@jangmanj/mcp/ops";
11
11
  import type { PiContent } from "./pi-api.ts";
12
12
 
13
13
  /** Per-text-block cap, matching Pi's generic tool-output limit of ~50 KB. */
@@ -1,10 +1,10 @@
1
1
  /** MRTR + elicitation support using the host's Pi UI. */
2
2
 
3
- import { openSystemBrowser } from "../../dist/auth/index.js";
4
- import type { Outcome } from "../../dist/index.js";
5
- import type { ConsentPort } from "../../dist/index.js";
6
- import { elicit, type FormRequest } from "../../dist/mrtr-cache/index.js";
7
- import { normalizeContent, type ToolCallResult } from "../../dist/ops/index.js";
3
+ import { openSystemBrowser } from "@jangmanj/mcp/auth";
4
+ import type { Outcome } from "@jangmanj/mcp/core";
5
+ import type { ConsentPort } from "@jangmanj/mcp/core";
6
+ import { elicit, type FormRequest } from "@jangmanj/mcp/mrtr-cache";
7
+ import { normalizeContent, type ToolCallResult } from "@jangmanj/mcp/ops";
8
8
  import type { ResourceServer } from "./resources.ts";
9
9
  import type { Ui } from "./pi-api.ts";
10
10
 
@@ -18,7 +18,7 @@ import {
18
18
  startLoopbackRedirect,
19
19
  type AuthorizationConsent,
20
20
  type ClientRegistration,
21
- } from "../../dist/auth/index.js";
21
+ } from "@jangmanj/mcp/auth";
22
22
  import type { ResolvedServerConfig } from "./config.ts";
23
23
 
24
24
  export {
@@ -1,8 +1,8 @@
1
1
  /** Built-in MCP resource tools: list_mcp_resources, list_mcp_resource_templates, read_mcp_resource. */
2
2
 
3
- import type { Outcome } from "../../dist/index.js";
4
- import type { McpClient } from "../../dist/index.js";
5
- import type { Ops } from "../../dist/ops/index.js";
3
+ import type { Outcome } from "@jangmanj/mcp/core";
4
+ import type { McpClient } from "@jangmanj/mcp/core";
5
+ import type { Ops } from "@jangmanj/mcp/ops";
6
6
  import type { Exposure } from "./config.ts";
7
7
  import { offloadBinary, offloadText } from "./result-files.ts";
8
8
  import type { ExtensionAPI, ToolResult } from "./pi-api.ts";
@@ -1,9 +1,9 @@
1
1
  /** Task-based tool-call results and /mcp task helpers. */
2
2
 
3
- import type { Outcome } from "../../dist/index.js";
4
- import type { McpClient } from "../../dist/index.js";
5
- import { TasksRuntime, type TaskState } from "../../dist/mrtr-cache/index.js";
6
- import type { ToolCallResult } from "../../dist/ops/index.js";
3
+ import type { Outcome } from "@jangmanj/mcp/core";
4
+ import type { McpClient } from "@jangmanj/mcp/core";
5
+ import { TasksRuntime, type TaskState } from "@jangmanj/mcp/mrtr-cache";
6
+ import type { ToolCallResult } from "@jangmanj/mcp/ops";
7
7
  import type { ResourceServer } from "./resources.ts";
8
8
  import type { ToolResult } from "./pi-api.ts";
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jangmanj/mcp",
3
- "version": "0.12.3",
3
+ "version": "0.13.0",
4
4
  "description": "MCP 2026-07-28 client and server library: push events/subscriptions, core, transports, auth, ops, MRTR/cache, OTEL telemetry, and extensions.",
5
5
  "license": "MIT",
6
6
  "author": "JangMan-J",
@@ -1,65 +0,0 @@
1
- # Host touchpoints: pi-coding-agent vs other Pi modules
2
-
3
- This adapter is written against a structural `ExtensionAPI` (`pi-api.ts`), not
4
- imported Pi packages (the repo's `check-forbidden` rule forbids them). The
5
- following touchpoints are **pi-coding-agent-specific** and cannot be moved to
6
- `pi-ai`, `pi-codemode`, or `pi-durable` without a host adapter:
7
-
8
- | Touchpoint | Where | Why it is host-specific |
9
- |---|---|---|
10
- | `pi.registerTool` / `pi.registerCommand` | `bridge.ts`, `index.ts` | Tool/command ownership and `/mcp` replacement semantics belong to pi-coding-agent's extension runner. |
11
- | `exposure`, `namespace`, `annotations` | `bridge.ts` | These are pi-coding-agent's codemode/tool_search exposure model, not MCP concepts. |
12
- | `pi.getActiveTools` / `setActiveTools` / `getAllTools` | `bridge.ts` (`ensureReachTools`) | Activating `codemode` / `tool_search` is a pi-coding-agent tool-loadout operation. |
13
- | `before_agent_start` + `systemPromptOptions.sections` | `index.ts` | pi-coding-agent's system-prompt section model (`mcp_servers`). |
14
- | `tool_call` waits for late registration | `index.ts` | pi-coding-agent's tool pipeline and `reachesTools` behavior. |
15
- | `session_start` / `session_shutdown` / `mcp_servers_change` | `index.ts` | pi-coding-agent session lifecycle and `pi.registerMcpServer` registry. |
16
- | `ctx.ui.notify/confirm/input/select` | `index.ts`, `oauth.ts`, `elicitation.ts` | pi-coding-agent TUI prompts. |
17
- | `pi.getSettings().autoEnableCodemode` | `bridge.ts` | pi-coding-agent settings shape. |
18
-
19
- Portable as-is:
20
-
21
- - `PiContent` text/image blocks are structurally identical to `pi-ai`'s
22
- `TextContent` / `ImageContent`.
23
- - `config.ts` (mcp.json discovery/merge/interpolation) is host-neutral except
24
- for the `PI_CODING_AGENT_DIR` convention, which other hosts may mirror.
25
- - `bridge.ts`'s connection, OAuth, MRTR, resource, and result-conversion logic
26
- only needs the small `ExtensionAPI` surface above; a durable host can wrap it
27
- with its own `defineExtension`/`defineTool` adapter.
28
-
29
- `pi-durable` (cellar) uses `defineExtension`/`defineTool` with a different
30
- `execute(args, api, context)` signature and its own event delivery, so there is
31
- no drop-in move into durable; it needs the thin wrapper described above.
32
- Cellar also provides its own command registerer, so the `/mcp` command surface
33
- (`index.ts`) is portable there directly; the remaining durable-specific work is
34
- tool execution signatures, UI prompts, and session/event delivery.
35
-
36
- ## Cellar equivalents (graph: home-jangmanj-Projects-cellar, 2026-11-25)
37
-
38
- Mapped against `src/daemon/pi-extensions.ts` (indexed, no recorded coverage
39
- issue). Most of this adapter's pi-coding-agent surface has a direct durable
40
- equivalent:
41
-
42
- | Adapter touchpoint | Cellar equivalent |
43
- |---|---|
44
- | `pi.registerTool` | `PiExtensionApi.registerTool` / `PiTool` (same execute shape) |
45
- | `pi.registerCommand` | `pi-extensions.registerCommand` (UI doc commands) |
46
- | `exposure` | `PiTool.exposure` (string) |
47
- | `annotations` | `PiTool.annotations` |
48
- | `namespace` | **No equivalent** — `PiTool` has no namespace field; codemode grouping must be rethought or added. |
49
- | `getActiveTools` / `setActiveTools` / `getAllTools` | `pi-extensions.getActiveTools` / `setActiveTools` / `getAllTools` |
50
- | `before_agent_start` | `pi-extensions.beforeAgentStart` (systemPrompt override supported) |
51
- | `systemPromptOptions.sections` | **No equivalent** — `systemPromptOptions: {}` is passed empty; use `systemPrompt` override instead of an `mcp_servers` section. |
52
- | `tool_call` | `pi-extensions.beforeTool` (mutable input, block, gate prompts) |
53
- | `session_start` / `session_shutdown` | `pi-extensions.start` / `close` |
54
- | `mcp_servers_change` | **No event found** — `registerMcpServer` / `unregisterMcpServer` / `getMcpServers` exist, but no change event; re-read on demand. |
55
- | `ctx.ui.notify/confirm/input/select` | `pi-extensions.notify` / `confirm` / `input` / `select` |
56
- | `ctx.cwd` / `hasUI` / `isProjectTrusted` | `ExtensionContext.cwd` / `hasUI` / `isProjectTrusted` |
57
- | `pi.getSettings()` | `pi-extensions.getSettings` (merged settings; no `autoEnableCodemode` reference found) |
58
- | `pi.registerMcpServer` | `PiExtensionApi.registerMcpServer` |
59
-
60
- Net: a durable adapter can reuse nearly all of `bridge.ts` unchanged. The
61
- adapter-specific deltas are (1) no `namespace`, (2) system-prompt override
62
- instead of sections, (3) no `mcp_servers_change` event, and (4) no
63
- `autoEnableCodemode` setting lookup. `mcp-host.ts` / `mcp-events.ts` were not
64
- present in this moderate index generation; earlier full-index evidence had
65
- `startMcpHost` called by `src.cli.mcp` and `src.daemon.main.globalMcp` / `mcp`.