- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
Split toolhive_host into separate variables for API and workload communication #37
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
Conversation
…unication - Added `workload_host` config variable alongside `toolhive_host` - `toolhive_host` now used exclusively for ToolHive API communication - `workload_host` used for MCP workload URL rewriting (localhost replacement) - Both variables default to same value: `localhost` (local dev) and `host.docker.internal` (Docker) - Extracted URL replacement logic into reusable `replace_localhost_in_url()` method - Added 9 unit tests covering URL replacement edge cases (None, empty string, localhost, 127.0.0.1, regular hostnames, HTTPS, fragments) - Updated all ToolhiveClient instantiations across codebase and tests - All 293 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
          PR ReviewSummaryClean separation of concerns by splitting  👍 Strengths
 
 | 
    
| 
           @claude check the latest commit and see if the comments were addressed and if you don't find any new issue  | 
    
| 
           Claude finished @aponcedeleonch's task —— View job Review Complete ✅SummaryThe latest commit "review comments" (ba91198) successfully addresses all previous review feedback. No new issues found. What Was FixedThe  if hostname and hostname in ("localhost", "127.0.0.1"):
    # Replace hostname only in netloc, not in path/query/fragment
    new_netloc = parsed_url.netloc.replace(hostname, self.workload_host, 1)
    parsed = parsed_url._replace(netloc=new_netloc)
    # urlunparse returns str when input is from urlparse(str)
    return str(urlunparse(parsed))Key improvements: 
 This ensures that only the hostname portion is replaced, not occurrences of "localhost" or "127.0.0.1" in the path, query, or fragment. Test CoverageExcellent test coverage added in tests/test_toolhive_client.py:783-814: New critical test:  
 The test suite now includes 9 comprehensive tests covering all edge cases (None, empty string, localhost, 127.0.0.1, regular hostnames, HTTPS, fragments, paths, and the critical hostname+path combination). Verdict✅ Approved - All review comments successfully addressed No new issues found. The implementation is correct, well-tested, and ready to merge.  | 
    
| 
           The fix was needed with Podman + Windows but it didn't work as expected. Closing this for the time being. More details in the linked issue  | 
    
Related: #25
workload_hostconfig variable alongsidetoolhive_hosttoolhive_hostnow used exclusively for ToolHive API communicationworkload_hostused for MCP workload URL rewriting (localhost replacement)localhost(local dev) andhost.docker.internal(Docker)replace_localhost_in_url()method🤖 Generated with Claude Code