-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Background
initializeRuntime to skillConnected takes approximately 7 seconds, and we need to identify the bottleneck. Currently, StdioClientTransport is created with stderr: "ignore", so base skill startup logs are not captured.
Target File
packages/runtime/src/skill-manager/mcp.ts - McpSkillManager._initStdio() method
Proposed Changes
1. Add timing logs to measure each step
async _initStdio(skill: McpStdioSkill) {
// ... env setup ...
const startTime = Date.now()
console.log(`[MCP] Starting skill ${skill.name}...`)
const { command, args } = this._getCommandArgs(skill)
const transport = new StdioClientTransport({ command, args, env, stderr: "pipe" })
const transportStartTime = Date.now()
await this._mcpClient.connect(transport)
const connectTime = Date.now()
console.log(`[MCP] Skill ${skill.name} connected in ${connectTime - transportStartTime}ms (total: ${connectTime - startTime}ms)`)
// ... rest of the method ...
}2. Change stderr from "ignore" to "pipe" and capture stderr output
const transport = new StdioClientTransport({
command,
args,
env,
stderr: "pipe" // Changed from "ignore"
})
// Capture stderr output
if (transport.stderr) {
transport.stderr.on("data", (chunk: Buffer) => {
console.log(`[MCP:${skill.name}:stderr] ${chunk.toString().trim()}`)
})
}Technical Considerations
- MCP SDK version:
^1.23.0 - Verify: Whether
transport.stderris a public API ofStdioClientTransport - Alternative: If
transport.stderris not accessible, consider other approaches to capture child process output
Expected Output
[MCP] Starting skill @perstack/base...
[MCP:@perstack/base:stderr] Running @repo/base-v1_0 version 1.0.0
[MCP] Skill @perstack/base connected in 150ms (total: 200ms)
Purpose
This change will help identify:
- Time from process spawn to log output (binary startup time)
connect()duration (MCP handshake time)- Total elapsed time
Notes
- This is for debugging purposes
- Consider adding a debug flag to enable/disable verbose logging in production
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels