Skip to content

Commit e42a936

Browse files
committed
Add guidance on user agents for client SDKs
1 parent 6e92d63 commit e42a936

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/specification/draft/basic/index.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,42 @@ may reserve particular names for purpose-specific metadata, as declared in those
147147

148148
- Unless empty, MUST begin and end with an alphanumeric character (`[a-z0-9A-Z]`).
149149
- MAY contain hyphens (`-`), underscores (`_`), dots (`.`), and alphanumerics in between.
150+
151+
## User Agents
152+
153+
Client SDK implementations **SHOULD** use the following format by default for their
154+
`User-Agent` header when sending HTTP requests:
155+
156+
```
157+
SDK_NAME[/SDK_VERSION] [os/PLATFORM[#PLATFORM_RELEASE]] [lang/LANG[#LANG_VERSION]] [md/KEY[#VALUE]]
158+
```
159+
160+
The first component of the user agent contains the SDK name and version, as published
161+
to package registries. SDK implementations **MAY** use a different product name if
162+
necessary, to be compliant with [RFC 9110](https://httpwg.org/specs/rfc9110.html#rfc.section.10.1.5).
163+
The optional `os` component contains the current platform and optional platform
164+
version. The optional `lang` component contains the SDK programming language and optional
165+
language version. The user agent **MAY** contain one or more `md` components for
166+
additional metadata, containing a key and an optional value.
167+
168+
For example, a version `v1.0.0` of `my-mcp-sdk` running on Windows, using Java `21.0.7`,
169+
might have the following user agent:
170+
171+
```
172+
my-mcp-sdk/1.0.0 os/win32#10.0.22000 lang/java#21.0.7
173+
```
174+
175+
As a more complex example, consider a version `v1.0.0` of `my-mcp-sdk` running on MacOS,
176+
using Node.js `v22.13.1`. In that scenario, the SDK might have the following user agent:
177+
178+
```
179+
my-mcp-sdk/1.0.0 os/darwin#24.5.0 lang/js md/nodejs#22.13.1
180+
```
181+
182+
Note that the language does not have a version component, as a version of JavaScript
183+
would be ambiguous; however, the runtime version is meaningful, and is included as
184+
an `md` component.
185+
186+
Server implementations **MUST NOT** make any assumptions or alter protocol behavior
187+
based on the user agent, as client implementations may diverge from this format in
188+
certain cases, such as when supporting overriding user agents with arbitrary values.

0 commit comments

Comments
 (0)