Documentation
¶
Overview ¶
Package clientcompat applies per-client response compatibility profiles to MCP results. Most MCP clients ignore fields they do not understand, so the server ships its full surface (icons, content annotations, structured content) unconditionally. OpenAI Codex is the exception: the Codex builds bundled with ChatGPT.app (verified on codex-cli 0.148.0-alpha.9, rmcp 3.0.0) fail any result whose annotations carry a non-integer priority — the response degrades to rmcp's CustomResult and every affected call surfaces as "Unexpected response type". This package detects Codex from the session's initialize clientInfo and rounds the priority to the nearest spec-legal integer (0 or 1) for that session; audience, structuredContent, outputSchema, icons, and every other field are preserved, and every other client keeps the exact float values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
func Enabled() bool
Enabled reports whether the compatibility middleware should be installed. Any value other than "off" (default empty included) enables it.
func Middleware ¶
func Middleware() mcp.Middleware
Middleware returns a receiving middleware that rewrites results according to the session's client profile. Results are cloned before modification: list results return pointers shared with the server's registries, so in-place edits would leak into concurrent sessions of other clients.
Types ¶
type Profile ¶
type Profile int
Profile identifies the response compatibility profile negotiated for a client session.
const ( // ProfileDefault leaves responses untouched. ProfileDefault Profile = iota // ProfileCodex rounds the float priority on content and resource // annotations to 0 or 1 (the bundled rmcp parser rejects non-integer // priorities). // Everything else — audience, structuredContent, outputSchema, icons, // and the tool annotations Codex's approval policy depends on — is // preserved. ProfileCodex )