Skip to main content
MCP Apps can run in both Claude and ChatGPT from a single codebase. The SDK auto-detects the host environment and uses the appropriate transport, though some platform-specific behaviors require attention.

How it works

Server side

Use registerAppTool() and registerAppResource() to register your tools and resources. These helper functions automatically generate platform-specific metadata, so you write the registration once and it works on both platforms.

Client side

Call App.connect() without an explicit transport parameter. The SDK detects whether it’s running in Claude or ChatGPT and uses the appropriate transport automatically.

Platform differences

While the SDK handles most cross-platform concerns automatically, some behaviors vary between hosts.

Domain handling

The Resource._meta.ui.domain field format and validation rules are determined by each host platform. For example, hosts may use hash-based subdomains, URL-derived patterns, or other formats. For Claude, compute the Resource._meta.ui.domain value by running this command, replacing https://example.com/mcp with your server URL:
node -e 'const yourServerUrl = "https://example.com/mcp"; console.log(require("crypto").createHash("sha256").update(yourServerUrl).digest("hex").slice(0,32) + ".claudemcpcontent.com")'
Example output for https://example.com/mcp:
c3d80a4ed901ee05b21755a88273b4a4.claudemcpcontent.com