-
Notifications
You must be signed in to change notification settings - Fork 113
Feature/http mcp server new #99
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
Feature/http mcp server new #99
Conversation
- Update mcp-go from v0.27.0 to v0.32.0 - Add StreamableHTTP server - Update API calls to use new request.GetString() methods - Maintain backward compatibility with stdio mode
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
|
Some tests are failing, but I think that's because the underlying error handling in the |
|
I forgot, I did made changes to the tfregistry since the bump the mcp-go, I will investigate the error |
|
tests are passing now: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the MCP server to support the new StreamableHTTP transport from mcp-go v0.32.0 while refactoring tool argument access and end-to-end test implementations. Key changes include:
- Migrating from manual map lookups (request.Params.Arguments) to using helper methods (RequireString/GetString) for tool arguments.
- Adding support for HTTP transport in the server and e2e tests, including new Docker commands and health check endpoints.
- Updating documentation, Makefile targets, and go.mod dependency versions to reflect the latest changes.
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/hashicorp/tfregistry/utils.go | Updated provider detail resolution to use the new request helpers. |
| pkg/hashicorp/tfregistry/handlers.go | Updated tool argument handling for serviceSlug, providerDocID, etc. |
| go.mod | Updated mcp-go dependency and Go version. |
| e2e/payloads.go | Added TestName field to test case struct and updated test payloads. |
| e2e/e2e_test.go | Refactored e2e tests to support both Stdio and HTTP transports. |
| cmd/terraform-mcp-server/main.go | Introduced the new http command and environment-based server launch. |
| cmd/terraform-mcp-server/init.go | Added HTTP command flags to support port and host configuration. |
| README.md | Expanded documentation for transport support and usage examples. |
| Makefile | Added new targets for running and testing the HTTP server and container cleanup. |
| Dockerfile | Updated CMD instructions to allow mode selection via environment. |
Comments suppressed due to low confidence (1)
pkg/hashicorp/tfregistry/utils.go:210
- [nitpick] When providerNamespace is empty, the log message prints an empty value. Consider updating the log message to include a fallback indicator or clarify that an empty providerNamespace is being replaced with "hashicorp".
providerNamespace := request.GetString("providerNamespace", "")
| output, err := cmd.Output() | ||
| require.NoError(t, err, "expected to start HTTP container successfully") | ||
|
|
||
| containerID := string(output)[:12] // First 12 chars of container ID |
Copilot
AI
Jun 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Truncating the container ID by taking the first 12 characters may lead to issues if the output contains extra whitespace or unexpected formatting. Consider trimming the output and verifying the container ID format before using it.
| containerID := string(output)[:12] // First 12 chars of container ID | |
| trimmedOutput := strings.TrimSpace(string(output)) // Remove leading/trailing whitespace | |
| matched, err := regexp.MatchString("^[a-f0-9]{64}$", trimmedOutput) // Validate container ID format | |
| require.NoError(t, err, "failed to validate container ID format") | |
| require.True(t, matched, "invalid container ID format") | |
| containerID := trimmedOutput[:12] // First 12 chars of validated container ID |
gautambaghel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the contribution
Updated to support the new StreamableHTTP transport from mcp-go v0.32.0.
Resolves #68
1. Library Update
github.com/mark3labs/mcp-gofrom v0.27.0 to v0.32.0server.NewStreamableHTTPServer()2. API Changes
The new mcp-go version changed how tool arguments are accessed:
Before (v0.27.0):
After (v0.32.0):
3. Transport Implementation
New StreamableHTTP Implementation:
4. Refactor e2e tests