@openeryc/pi-coding-agent 0.75.32 → 0.75.33

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.
@@ -2016,6 +2016,11 @@ export class InteractiveMode {
2016
2016
  this.editor.setText("");
2017
2017
  return;
2018
2018
  }
2019
+ if (text === "/mcp") {
2020
+ this.handleMcpCommand();
2021
+ this.editor.setText("");
2022
+ return;
2023
+ }
2019
2024
  if (text === "/usage") {
2020
2025
  this.editor.setText("");
2021
2026
  await this.handleUsageCommand();
@@ -4392,6 +4397,59 @@ export class InteractiveMode {
4392
4397
  this.chatContainer.addChild(new Text(info, 1, 0));
4393
4398
  this.ui.requestRender();
4394
4399
  }
4400
+ handleMcpCommand() {
4401
+ const configuredServers = this.settingsManager.getMcpServers();
4402
+ const allTools = this.session.getAllTools();
4403
+ // Group MCP tools by server name
4404
+ const mcpTools = allTools.filter((t) => t.name.startsWith("mcp_"));
4405
+ const toolsByServer = new Map();
4406
+ for (const tool of mcpTools) {
4407
+ // mcp_<server>_<tool> - server name is everything between the first two underscores
4408
+ const prefix = "mcp_";
4409
+ const rest = tool.name.slice(prefix.length);
4410
+ const secondUnderscore = rest.indexOf("_");
4411
+ const serverName = secondUnderscore === -1 ? rest : rest.slice(0, secondUnderscore);
4412
+ const existing = toolsByServer.get(serverName);
4413
+ if (existing) {
4414
+ existing.push(tool);
4415
+ }
4416
+ else {
4417
+ toolsByServer.set(serverName, [tool]);
4418
+ }
4419
+ }
4420
+ this.chatContainer.addChild(new Spacer(1));
4421
+ if (!configuredServers || Object.keys(configuredServers).length === 0) {
4422
+ this.chatContainer.addChild(new Text(`${theme.bold("MCP Servers")}\n\n${theme.fg("dim", "No MCP servers configured. Add 'mcpServers' to settings.json.")}`, 1, 0));
4423
+ this.ui.requestRender();
4424
+ return;
4425
+ }
4426
+ let info = `${theme.bold("MCP Servers")}\n\n`;
4427
+ for (const [serverName, config] of Object.entries(configuredServers)) {
4428
+ const tools = toolsByServer.get(serverName) ?? [];
4429
+ const connected = tools.length > 0;
4430
+ const status = connected ? theme.fg("success", "connected") : theme.fg("warning", "disconnected");
4431
+ const transport = config.url ? (config.transport ?? "sse") : config.command ? "stdio" : "unknown";
4432
+ info += `${theme.bold(serverName)} ${status}\n`;
4433
+ info += `${theme.fg("dim", ` Transport: ${transport}`)}\n`;
4434
+ if (config.command) {
4435
+ const cmd = config.args ? `${config.command} ${config.args.join(" ")}` : config.command;
4436
+ info += `${theme.fg("dim", ` Command: ${cmd}`)}\n`;
4437
+ }
4438
+ if (config.url) {
4439
+ info += `${theme.fg("dim", ` URL: ${config.url}`)}\n`;
4440
+ }
4441
+ if (connected) {
4442
+ info += `${theme.fg("dim", ` Tools: ${tools.length}`)}\n`;
4443
+ for (const tool of tools) {
4444
+ const desc = tool.description ? ` - ${tool.description.split("\n")[0].slice(0, 80)}` : "";
4445
+ info += `${theme.fg("dim", ` ${tool.name}${desc}`)}\n`;
4446
+ }
4447
+ }
4448
+ info += "\n";
4449
+ }
4450
+ this.chatContainer.addChild(new Text(info, 1, 0));
4451
+ this.ui.requestRender();
4452
+ }
4395
4453
  async handleUsageCommand() {
4396
4454
  this.showStatus("Loading usage stats...");
4397
4455
  this.ui.requestRender();