feat: refactor HTTP transport to use dynamic port allocation#97
Conversation
|
@alejorrojas is attempting to deploy a commit to the basement Team on Vercel. A member of the Team first needs to authorize it. |
|
@valebearzotti This is my approach to solving the issue, let me know if there’s anything you’d like me to adjust |
|
Hey @alejorrojas ! Overall it's a good implementation, super clean 👏🏻 The only thing I'm concerned about is since we're changing the start method to be asynchronous if that should be handled when starting the transport. This means: transport.start();should be awaited (main function is already async) |
| startPort: number = 3002, | ||
| host: string = "127.0.0.1" | ||
| ): Promise<number> { | ||
| return new Promise((resolve, reject) => { |
There was a problem hiding this comment.
reject is unused, we can remove it
There was a problem hiding this comment.
totally right, I already removed it
|
Hi @valebearzotti! Thanks for your time and the feedback. About the Let me know if there’s anything else! |
|
Question, why did we changed the default port from 3001 to 3002? The default url for the mcp inspector is localhost:3001, that was the reason we used that port |
|
@matiasngf that was my mistake when copying the config from one of the examples, that was setting it up to 3002 instead of 1 |
feat: refactor HTTP transport to use dynamic port allocation
Summary
Refactors the HTTP transport to use dynamic port allocation, preventing port conflicts when multiple server instances are running. The implementation automatically finds the next available port when the default port is in use.
If the HTTP port is not explicitly configured, it searches for an available port starting from 3002 and incrementing upwards.
port-utils.tsfile to encapsulate port allocation logicstart()method asynchronous to support port discoveryType of Change
Affected Packages
xmcp(core framework)create-xmcp-appinit-xmcpScreenshots/Examples
Before (problematic behavior):
After (fixed behavior):
Related Issues
Resolves #89