Skip to main content
@mcpjam/sdk/host-compat is the shared host-compatibility engine. It answers “does this MCP server work on host X?” by joining a server’s derived requirements against per-host capability profiles to produce works / degraded / blocked verdicts. The same engine powers the Inspector’s Compatibility destination, the CLI, and the public API.

Import


deriveServerRequirements()

Derives what a server demands of a host from its tools list, optional widget-usage scan, and optional connection facts.

Parameters

ParameterTypeDescription
toolsDataHostCompatToolsInput | nullTools list from ListToolsResult, plus optional per-tool _meta metadata.
widgetUsageWidgetUsageCapability needs derived from scanning widget HTML (from scanWidgetSource). Pass undefined when HTML hasn’t been fetched yet — the result will include an unknownDimensions entry.
connectionFactsConnectionFactsProtocol version negotiated at connect time.

HostCompatToolsInput

PropertyTypeDescription
toolsHostCompatTool[]Array of tools. Each tool needs at minimum a name and optional _meta.
toolsMetadataRecord<string, Record<string, unknown>>Per-tool _meta map keyed by tool name. When present, wins over inline tool._meta.

Returns: ServerRequirements

PropertyTypeDescription
widgets.mcpAppsOnlystring[]Tool names that declare only an MCP Apps widget template.
widgets.openaiAppsOnlystring[]Tool names that declare only an OpenAI Apps SDK template.
widgets.dualstring[]Tool names that declare both templates.
appOnlyWidgetsstring[]Widget tools with no text fallback (hidden from the model).
hasWidgetsbooleanWhether any widget tools were found.
widgetUsageWidgetUsage | undefinedThe passed-in widget usage scan, if any.
connectionFactsConnectionFacts | undefinedThe passed-in connection facts, if any.
unknownDimensionsstring[]Dimensions that couldn’t be determined (e.g. widget HTML not yet fetched). Non-empty means the verdict may be unknown.

Example


evaluateHostCompat()

Evaluates a server’s requirements against a single host profile and returns a HostCompatReport.

Parameters

ParameterTypeDescription
requirementsServerRequirementsOutput of deriveServerRequirements.
profileHostCompatProfileA host capability profile describing what the host supports.

Returns: HostCompatReport

PropertyTypeDescription
hostIdstringProfile identifier (e.g. "claude", "chatgpt").
hostLabelstringHuman-readable host name.
verdictCompatVerdict"works" | "degraded" | "blocked" | "unknown"
provenanceCompatProvenanceConfidence level of the overall report.
lanes.appsCompatLaneVerdictApps-lane verdict (widget rendering + capability gaps).
lanes.serverCompatLaneVerdictServer-lane verdict (protocol version compatibility).
findingsCompatFinding[]Individual findings, each with a lane, severity, title, detail, and optional remediation.

CompatVerdict

ValueMeaning
"works"No blockers or degraded findings.
"degraded"Functional but with capability gaps or text fallbacks.
"blocked"App-only tools are unusable on this host.
"unknown"A required dimension couldn’t be determined.

evaluateAllHosts()

Evaluates a server against multiple host profiles in one call.

Parameters

ParameterTypeDescription
toolsDataHostCompatToolsInput | nullTools list input.
profilesHostCompatProfile[]Array of host profiles to evaluate against.
options.widgetUsageWidgetUsageWidget capability scan results.
options.connectionFactsConnectionFactsProtocol version from connect time.

Returns: HostCompatEvaluation

PropertyTypeDescription
requirementsServerRequirementsDerived server requirements.
reportsHostCompatReport[]One report per profile, in the same order as profiles.

Example


scanWidgetSource()

Scans widget HTML source to detect which MCP Apps capabilities the widget uses.

Parameters

ParameterTypeDescription
htmlstringRaw HTML of the widget (fetched from the MCP resource URI).

Returns: WidgetUsage

A map from capability name to the list of tool names whose widgets use that capability. An empty object {} means the HTML was scanned and no capability usage was found — this is conclusive. undefined means the scan hasn’t run yet.

scanWidgetMeta()

Scans a tool’s _meta bag to detect widget bridge type and app-only status without fetching the HTML.

detectHostCompatBridgeFromMeta()

Detects which widget bridge protocol a tool uses from its _meta bag.

HostCompatBridge

ValueMeaning
NONETool has no widget template.
MCP_APPSTool declares an MCP Apps widget (_meta.ui.resourceUri).
OPENAI_SDKTool declares an OpenAI Apps SDK template (openai/outputTemplate).
OPENAI_SDK_AND_MCP_APPSTool declares both templates.

Types

HostCompatProfile

Describes a host’s capabilities for evaluation purposes. Supply your own profiles or use the Inspector’s built-in catalog.
PropertyTypeDescription
idstringUnique identifier (e.g. "claude").
labelstringHuman-readable name.
provenanceCompatProvenanceConfidence level of the profile data.
rendersMcpAppsbooleanWhether the host renders MCP Apps widgets.
rendersOpenAiAppsbooleanWhether the host renders OpenAI Apps SDK widgets.
supportedProtocolVersionsstring[]MCP protocol versions the host advertises.
capabilitiesPartial<Record<WidgetCapabilityNeed, boolean>>Which widget capabilities the host supports.

CompatProvenance

ValueMeaning
"probe"Captured from a real host via DevTools or the inspector.
"vendor-doc"Verified from vendor documentation.
"observed"Stamped by a live widget render run.
"assumed"Best-effort — unverified.

ConnectionFacts

PropertyTypeDescription
protocolVersionstringMCP protocol version negotiated at connect time (e.g. "2025-11-25").