Skip to main content

Module extension

Module extension 

Source
Expand description

The built-in MCP extension: connects the servers in mcp.json and those extensions register with pi.registerMcpServer when a session starts, and servers registered later right away. A server in mcp.json takes precedence over a registered one of the same name. The extension registers tools as mcp__<server>__<tool>. Port of extensions/mcp/index.ts in pi v1.0.0.

Connections run in the background. The first prompt waits only for servers with direct tools. tool_search and the resource tools wait for the servers they need when they run. Servers whose tools are not declared are listed in the mcp_servers system prompt section. In the TUI /mcp opens a manager to sign in, reconnect, enable or disable servers and change their exposure, saved to the mcp.json that defines the server or, for servers extensions registered, kept for the session. Elsewhere it reports the status, and /mcp login signs in to OAuth servers.

Structs§

McpExtension
The MCP extension. Each session has its own.
McpMenu
pi’s McpMenu: a menu of the /mcp manager.

Enums§

McpScreen
pi’s McpUi: a screen of the /mcp manager.

Constants§

SERVERS_SECTION
The system prompt section that lists servers whose tools are not declared.