pi-web
pi-web copied to clipboard
bug: 当我使用pi-mcp-adapter时报错"MCP not initialized"
Describe the bug
When using pi-mcp-adapter with pi-web, it errors with "MCP not initialized".
To Reproduce
- Start a new pi-web session with
pi-mcp-adapterextension installed - Trigger a tool call or command that depends on the MCP adapter
- Observe the error:
"MCP not initialized"
Expected behavior
pi-mcp-adapter should initialize correctly when a session starts.
Root Cause
pi-web's AgentSessionWrapper only called extensionRunner.setUIContext() during session creation, but never invoked AgentSession.bindExtensions(). Since createAgentSession() does not auto-emit session_start, extensions that rely on the session_start event (like pi-mcp-adapter) never initialized.
Fix
Fixed in https://github.com/lclichen/pi-web/pull/2 by dispatching session_start to the extension runtime after session creation.
#104