Skip to content

Add: Skill lifecycle events for MCP startup debugging#51

Merged
FL4TLiN3 merged 1 commit intomainfrom
add-mcp-debug-logging
Dec 4, 2025
Merged

Add: Skill lifecycle events for MCP startup debugging#51
FL4TLiN3 merged 1 commit intomainfrom
add-mcp-debug-logging

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Dec 4, 2025

Summary

  • Add skillStarting event emitted when MCP skill initialization begins
  • Add skillStderr event to capture child process stderr output
  • Add connectDurationMs and totalDurationMs fields to skillConnected event

Background

initializeRuntime to skillConnected takes approximately 7 seconds. These structured events help identify the bottleneck (binary startup time vs MCP handshake time).

New Events

skillStarting

{
  skillName: string
  command: string
  args: string[]
}

skillStderr

{
  skillName: string
  message: string
}

skillConnected (updated)

{
  skillName: string
  serverInfo?: { name: string; version: string }
  connectDurationMs?: number  // NEW
  totalDurationMs?: number    // NEW
}

Test plan

  • TypeScript compiles without errors
  • All unit tests pass
  • Biome lint passes

Closes #49


Note

Introduce skillStarting and skillStderr events and add connection timing fields to skillConnected, wiring them into MCP stdio initialization.

  • Runtime observability:
    • packages/core/src/schemas/runtime.ts:
      • Add skillStarting and skillStderr runtime events.
      • Extend skillConnected with connectDurationMs and totalDurationMs.
    • packages/runtime/src/skill-manager/mcp.ts:
      • Emit skillStarting before launching MCP stdio skill (with command and args).
      • Pipe stderr to skillStderr events.
      • Emit skillConnected including connection timing metrics.
  • Changeset: Patch releases for @perstack/core and @perstack/runtime.

Written by Cursor Bugbot for commit ff9f6e2. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
perstack Ignored Ignored Preview Dec 4, 2025 10:59pm

this._eventListener(event)
}
})
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Stderr listener attached before process spawn fails silently

The transport.stderr listener is attached before calling connect(), but StdioClientTransport.stderr only becomes available after the child process is spawned during the start() method (called internally by connect()). At this point, transport.stderr is undefined, so the if (transport.stderr) check fails silently and the listener is never attached. The skillStderr events will never be emitted. The listener needs to be attached after connect() returns, though this may miss early stderr output.

Fix in Cursor Fix in Web

@FL4TLiN3 FL4TLiN3 force-pushed the add-mcp-debug-logging branch from 8d52d2e to ff9f6e2 Compare December 4, 2025 22:59
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/runtime/src/skill-manager/mcp.ts 0.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@FL4TLiN3 FL4TLiN3 merged commit 5497b47 into main Dec 4, 2025
8 of 9 checks passed
@github-actions github-actions bot mentioned this pull request Dec 4, 2025
@FL4TLiN3 FL4TLiN3 deleted the add-mcp-debug-logging branch December 8, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add debug logging for MCP skill startup time

1 participant