SessionStart agent hooks cannot use MCP tools (servers not ready)
Problem
SessionStart agent hooks cannot reliably use MCP server tools because MCP servers use lazy loading and aren't connected when the hook fires.
Setup
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "agent",
"prompt": "Send a message using mcp__plugin_telegram_telegram__reply tool...",
"timeout": 30
}
]
}
]
}
}
Expected behavior
The agent hook should be able to use MCP tools at session start.
Actual behavior
The MCP server isn't connected yet when the SessionStart hook runs. The agent hook fails silently because the MCP tool isn't available. MCP servers use lazy loading — they connect on first tool use, not at startup.
Why this matters
A key use case for SessionStart + MCP is verifying that an MCP channel (e.g., Telegram) is live and working end-to-end. Using curl as a workaround bypasses MCP entirely, which defeats the purpose of confirming the MCP connection works.
CLAUDE.md instructions are not a reliable alternative either, as they depend on Claude's compliance rather than being enforced by the harness.
Suggested solutions
Any of these would help:
- Wait-for-MCP option on hooks — e.g.,
"waitForMcp": trueor"dependsOn": ["telegram"]that delays hook execution until specified MCP servers are connected - Eager loading option for MCP servers — Allow marking specific MCP servers to connect at startup rather than lazily
- Retry/delay options on hooks — e.g.,
"retries": 3, "retryDelay": 5so the agent can retry if MCP isn't ready yet
Environment
- macOS (Darwin 25.3.0)
- Claude Code CLI
- Telegram plugin (
telegram@claude-plugins-official)
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗