@pi-unipi/mcp 0.1.15 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/mcp",
3
- "version": "0.1.15",
3
+ "version": "2.0.0",
4
4
  "description": "MCP server management extension for Pi coding agent — browse, add, configure, and use MCP servers",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Registers commands, handles session lifecycle, wires up MCP server management.
5
5
  */
6
6
 
7
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
7
+ import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
8
8
  import {
9
9
  UNIPI_EVENTS,
10
10
  MODULES,
@@ -27,8 +27,7 @@ let registry: ServerRegistry | null = null;
27
27
 
28
28
  /** Get info registry from global */
29
29
  function getInfoRegistry() {
30
- const g = globalThis as any;
31
- return g.__unipi_info_registry;
30
+ return globalThis.__unipi_info_registry;
32
31
  }
33
32
 
34
33
  /** Get the server registry (for commands) */
@@ -178,7 +177,7 @@ export default function (pi: ExtensionAPI) {
178
177
  // /unipi:mcp-status — text summary of all servers
179
178
  pi.registerCommand(`unipi:${MCP_COMMANDS.STATUS}`, {
180
179
  description: "Show status of all configured MCP servers",
181
- handler: async (_args: string, ctx: any) => {
180
+ handler: async (_args: string, ctx: ExtensionCommandContext) => {
182
181
  const reg = getRegistry();
183
182
  if (!reg) {
184
183
  ctx.ui.notify("MCP extension not initialized", "warning");
@@ -226,7 +225,7 @@ export default function (pi: ExtensionAPI) {
226
225
  // /unipi:mcp-sync — force catalog sync
227
226
  pi.registerCommand(`unipi:${MCP_COMMANDS.SYNC}`, {
228
227
  description: "Sync MCP server catalog from GitHub",
229
- handler: async (_args: string, ctx: any) => {
228
+ handler: async (_args: string, ctx: ExtensionCommandContext) => {
230
229
  try {
231
230
  ctx.ui.notify("Syncing MCP catalog from GitHub...", "info");
232
231
  const catalog = await syncCatalog();
@@ -250,7 +249,7 @@ export default function (pi: ExtensionAPI) {
250
249
  // /unipi:mcp-add — add server overlay
251
250
  pi.registerCommand(`unipi:${MCP_COMMANDS.ADD}`, {
252
251
  description: "Add an MCP server (browse catalog or custom config)",
253
- handler: async (_args: string, ctx: any) => {
252
+ handler: async (_args: string, ctx: ExtensionCommandContext) => {
254
253
  if (!ctx.hasUI) {
255
254
  ctx.ui.notify("MCP Add requires an interactive UI.", "warning");
256
255
  return;
@@ -278,7 +277,7 @@ export default function (pi: ExtensionAPI) {
278
277
  // /unipi:mcp-settings — settings overlay
279
278
  pi.registerCommand(`unipi:${MCP_COMMANDS.SETTINGS}`, {
280
279
  description: "Manage MCP server settings",
281
- handler: async (_args: string, ctx: any) => {
280
+ handler: async (_args: string, ctx: ExtensionCommandContext) => {
282
281
  if (!ctx.hasUI) {
283
282
  ctx.ui.notify("MCP Settings requires an interactive UI.", "warning");
284
283
  return;
@@ -312,7 +311,7 @@ export default function (pi: ExtensionAPI) {
312
311
  // /unipi:mcp-reload — restart all MCP servers
313
312
  pi.registerCommand(`unipi:${MCP_COMMANDS.RELOAD}`, {
314
313
  description: "Reload all MCP servers (restart with current config)",
315
- handler: async (_args: string, ctx: any) => {
314
+ handler: async (_args: string, ctx: ExtensionCommandContext) => {
316
315
  const reg = getRegistry();
317
316
  if (!reg) {
318
317
  ctx.ui.notify("MCP extension not initialized", "warning");
@@ -16,8 +16,10 @@ import {
16
16
  Key,
17
17
  matchesKey,
18
18
  truncateToWidth,
19
+ type TUI,
19
20
  visibleWidth,
20
21
  } from "@mariozechner/pi-tui";
22
+ import type { Theme, KeybindingsManager } from "@mariozechner/pi-coding-agent";
21
23
  import type { CatalogEntry, CatalogData, McpConfig, McpMetadata } from "../types.js";
22
24
  import { loadCatalog } from "../config/sync.js";
23
25
  import {
@@ -106,9 +108,9 @@ export function renderMcpAddOverlay(params?: {
106
108
  onComplete?: () => void;
107
109
  }) {
108
110
  return (
109
- tui: any,
110
- theme: any,
111
- _kb: any,
111
+ tui: TUI,
112
+ theme: Theme,
113
+ _kb: KeybindingsManager,
112
114
  done: (result: { saved: boolean } | null) => void,
113
115
  ) => {
114
116
  const scope = params?.scope ?? "global";
@@ -141,13 +143,13 @@ export function renderMcpAddOverlay(params?: {
141
143
  }
142
144
 
143
145
  const editorTheme: EditorTheme = {
144
- borderColor: (s: any) => theme.fg("accent", s),
146
+ borderColor: (s: string) => theme.fg("accent", s),
145
147
  selectList: {
146
- selectedPrefix: (t: any) => theme.fg("accent", t),
147
- selectedText: (t: any) => theme.fg("accent", t),
148
- description: (t: any) => theme.fg("muted", t),
149
- scrollInfo: (t: any) => theme.fg("dim", t),
150
- noMatch: (t: any) => theme.fg("warning", t),
148
+ selectedPrefix: (t: string) => theme.fg("accent", t),
149
+ selectedText: (t: string) => theme.fg("accent", t),
150
+ description: (t: string) => theme.fg("muted", t),
151
+ scrollInfo: (t: string) => theme.fg("dim", t),
152
+ noMatch: (t: string) => theme.fg("warning", t),
151
153
  },
152
154
  };
153
155
  const editor = new Editor(tui, editorTheme);
@@ -5,7 +5,8 @@
5
5
  * edit, delete, scope switching, and sync trigger.
6
6
  */
7
7
 
8
- import { Key, matchesKey, truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
8
+ import { Key, matchesKey, truncateToWidth, type TUI, visibleWidth } from "@mariozechner/pi-tui";
9
+ import type { Theme, KeybindingsManager } from "@mariozechner/pi-coding-agent";
9
10
  import type { ServerState } from "../types.js";
10
11
  import {
11
12
  loadMcpConfig,
@@ -49,9 +50,9 @@ export function renderMcpSettingsOverlay(params?: {
49
50
  onComplete?: () => void;
50
51
  }) {
51
52
  return (
52
- tui: any,
53
- theme: any,
54
- _kb: any,
53
+ tui: TUI,
54
+ theme: Theme,
55
+ _kb: KeybindingsManager,
55
56
  done: (result: { action?: string } | null) => void,
56
57
  ) => {
57
58
  const registry = params?.registry;