Skip to content

feat: enhance thv mcp list to accept server names in addition to URLs #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2025

Conversation

JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Aug 19, 2025

Summary

This PR enhances the thv mcp list command to accept both server URLs and server names from running workloads via the --server flag.

Changes

  • Modified --server flag to accept both URLs and server names from running workloads
  • Added resolveServerURL function to look up running servers by name using the efficient GetWorkload method
  • Improved error messages for better user experience
  • Removed unnecessary logger calls that could corrupt JSON output
  • Updated flag documentation to reflect the new functionality

Benefits

This allows users to conveniently reference MCP servers by their friendly names instead of having to remember or look up their URLs, while maintaining backward compatibility with direct URL usage.

Examples

Using server name:

thv mcp list tools --server fetch

Using URL (backward compatible):

thv mcp list tools --server http://127.0.0.1:29104/mcp

Testing

  • ✅ Tested with server name: ./bin/thv mcp list tools --server fetch
  • ✅ Tested with URL: ./bin/thv mcp list tools --server http://127.0.0.1:29104/mcp
  • ✅ JSON output works correctly without corruption
  • ✅ Error handling works for non-existent servers

Fixes the issue discussed where users wanted to use server names instead of URLs for the --server flag.

@JAORMX JAORMX force-pushed the feat/mcp-list-server-names branch from 6e8b685 to a78c8b3 Compare August 19, 2025 10:02
- Modified --server flag to accept both URLs and server names from running workloads
- Added resolveServerURL function to look up running servers by name
- Uses efficient GetWorkload method instead of listing all workloads
- Improved error messages for better user experience
- Removed unnecessary logger calls that could corrupt JSON output

This allows users to conveniently reference MCP servers by their friendly names
(e.g., 'thv mcp list --server fetch') instead of having to remember or look up
their URLs, while maintaining backward compatibility with direct URL usage.

Signed-off-by: Juan Antonio Osorio <[email protected]>
@JAORMX JAORMX force-pushed the feat/mcp-list-server-names branch from a78c8b3 to 3723b3f Compare August 19, 2025 10:18
Copy link
Member

@rdimitrov rdimitrov left a comment

Choose a reason for hiding this comment

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

🚀

@JAORMX JAORMX merged commit 217bf2e into main Aug 19, 2025
31 of 32 checks passed
@JAORMX JAORMX deleted the feat/mcp-list-server-names branch August 19, 2025 10:37
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.

2 participants