feat: add User-Agent header to MCP HTTP requests#6988
Merged
Conversation
Adds a 'goose/{version}' User-Agent header to all HTTP requests sent to
MCP servers via streamable HTTP transport. This applies to both initial
connections and OAuth retry flows.
The header follows the standard format: goose/1.23.0 (or current version)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a User-Agent header to HTTP requests made to MCP servers, enabling server operators to identify client versions for analytics, debugging, and compatibility purposes.
Changes:
- Added
goose_user_agent()helper function that generates the User-Agent string from the package version - Added User-Agent header to HTTP clients in the initial connection flow
- Added User-Agent header to HTTP clients in the OAuth retry flow
katzdave
approved these changes
Feb 5, 2026
| reqwest::header::USER_AGENT, | ||
| goose_user_agent() | ||
| .parse() | ||
| .expect("valid user agent header value"), |
Collaborator
There was a problem hiding this comment.
Don't think we can to panic on this. Maybe have a regex check on the pkg version, and otherwise just send goose/?
| reqwest::header::USER_AGENT, | ||
| goose_user_agent() | ||
| .parse() | ||
| .expect("valid user agent header value"), |
DOsinga
approved these changes
Feb 5, 2026
| goose_user_agent() | ||
| .parse() | ||
| .expect("valid user agent header value"), | ||
| ); |
Collaborator
There was a problem hiding this comment.
this feels odd, goose_user_agent could be done at compile time I think and even though parse will never fail, it would kill the agent if it did.
can we something like:
const GOOSE_USER_AGENT = HeaderValue::from_static(concat!("goose/", env!("CARGO_PKG_VERSION")));
and then here insert that?
| reqwest::header::USER_AGENT, | ||
| goose_user_agent() | ||
| .parse() | ||
| .expect("valid user agent header value"), |
Replace runtime goose_user_agent() function with GOOSE_USER_AGENT const using HeaderValue::from_static(). This eliminates potential runtime panics from .expect() calls by validating the header value at compile time.
Collaborator
Author
zanesq
pushed a commit
that referenced
this pull request
Feb 6, 2026
katzdave
added a commit
that referenced
this pull request
Feb 6, 2026
…webtoken-10.3.0 * origin/main: (54 commits) Switch tetrate tool filtering back to supports_computer_use (#7024) feat(ui): add inline rename for chat sessions in sidebar (#6995) fix: handle toolnames without underscores (#7015) feat(claude-code): use stream-json protocol for persistent sessions (#7029) test(providers): add model listing to live provider suite (#7038) Agent added too much (#7036) fix(deps): bump tree-sitter to 0.26 and set sqlx default-features=false to fix RUSTSEC advisories (#7031) feat: add image support and improve error resilience for Codex (#7033) fix(providers): Azure OpenAI model listing 404 during configure (#7034) fix(deps): bump bat to 0.26.1 to resolve RUSTSEC-2026-0008 (#7021) Don't swallow Tetrate errors (#6998) docs: remove hardcoded_stuff links (#7016) fix(ui): keep Hub chat input from overlapping SessionInsights on paste (#6719) Clean up css (#6944) docs: aws bedrock bearer token auth (#6990) docs: extended custom provider headers support (#7012) feat(cli): add type-to-search filtering to select/multiselect dialogs (#6862) feat(ci): add cargo-audit workflow for scanning rust vulnerabilities (#6351) feat: add User-Agent header to MCP HTTP requests (#6988) chore(deps-dev): bump webpack from 5.102.1 to 5.105.0 in /ui/desktop (#6996) ... # Conflicts: # Cargo.lock
kuccello
pushed a commit
to kuccello/goose
that referenced
this pull request
Feb 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
goose/{version}User-Agent header to all HTTP requests sent to MCP servers via streamable HTTP transport.Why
MCP server operators need visibility into which clients are connecting to their servers. A User-Agent header enables:
This is standard practice for HTTP clients and aligns with how other MCP clients identify themselves.
Changes
goose_user_agent()helper function that returnsgoose/{CARGO_PKG_VERSION}create_streamable_http_client()Format
The header follows the standard format:
Testing
cargo clippypassescargo fmtapplied