ontoloji.orgOpen Reference Hub
MCP & Agent Architecture13 min read·Updated: 2026-12-05·Türkçe sürüm →

Production MCP Client Pitfalls Across Claude Mobile, Desktop Chat, Code, Cowork & OpenWebUI

Why MCP servers that pass local Inspector tests fail in enterprise production: Claude Mobile OAuth brokers, Supabase global signOut kills, silent structuredContent drops, and the OpenWebUI 5-tool cliff.

Executive Summary — Key Takeaways
  • 01Static Authorization: Bearer headers configured via local CLI/mcp-remote pipes fail completely on Claude Mobile and cloud connectors, requiring an IdP (Entra/Okta) ↔ MCP OAuth 2.1 Broker with deterministic session binding.
  • 02Calling supabase.auth.signOut() in a companion web app defaults to scope: 'global', silently killing users’ active Claude Desktop and Claude Code MCP sessions (signOut({ scope: 'local' }) is mandatory).
  • 03Returning tool data solely inside result.structuredContent works in Claude Code yet vanishes silently in Claude Desktop Chat unless mirrored into result.content text blocks.
  • 04OpenWebUI degrades sharply past 5–6 tools without a two-stage domain router; TOP 1000 guards trigger 11-page context explosions on 11,000-row queries; and 80K-char base64 uploads require 5-minute TTL presigned URLs with origin-pinned reads.

1. Cross-Client MCP Compatibility Matrix: One Spec, Five Divergent Runtimes

On paper, the Model Context Protocol (MCP) defines a unified JSON-RPC and Streamable HTTP contract. In enterprise production, however, no organization runs a single MCP host: executives check KPIs on Claude Mobile, operations analysts live in Claude Desktop Chat and Claude Cowork, engineers automate workflows in Claude Code, and air-gapped business units deploy OpenWebUI or LM Studio.

An MCP server validated solely against MCP Inspector or Claude Code on a developer laptop breaks silently across six operational dimensions the moment real multi-client traffic hits.

Production MCP Client Compatibility Matrix & Defensive Server Architecture
Capability / SurfaceClaude Desktop ChatClaude CodeClaude CoworkClaude MobileOpenWebUI / LM StudioDefensive Server Pattern
Custom Static Bearer HeadersOnly via local mcp-remote stdio bridgeFull support (--header & local config)Unsupported on cloud connectorsUnsupported; zero local process pipeSupported via server/user connector configRFC 9728 + OAuth 2.1 Broker + CLI PAT fallback
OAuth 2.1 Broker / DCR / CIMDRequired for remote HTTPS connectorsSupported with PKCE + localhost callbackRequired for cloud-synced workspacesMandatory; inherits synced OAuth connectorPartial / version-dependent; prefers BearerIdP (Entra/Okta) ↔ MCP OAuth Broker + token-bound session
structuredContent RenderingSilently dropped if content text omittedReads structuredContent JSON nativelyInconsistent unless mirrored in contentDepends on content text blocksForwards content[].text only to LLMDual-emit both structuredContent and content text
notifications/tools/list_changedFrequently cached until host restartSubscribes live and refreshes catalogDelayed refresh across cloud worker turnsDropped across stateless HTTP requestsIgnored in most builds; static tool cacheEmit post-auth notification + enforce hard RBAC per tools/call
Direct Upload vs Presigned URLsSandbox blocks remote file://; base64 bloats chatLocal FS access; remote MCP still needs HTTPCloud sandbox path invisible to remote MCPNo raw binary MCP argument transportBase64 arguments overflow context window5-min TTL Presigned PUT URL + origin-pinned read
Tool-Selector Scaling (5 vs 50+)Stable to ~25–40 tools before latency climbsScales to 50+ tools via deferred tool searchModerate (30+ tools benefit from grouping)Tight context budget; concise catalog neededSharp accuracy cliff past 5–6 toolsTwo-stage ontology domain router (<= 5 top-level tools)
Production Law: Test Against the Strictest Intersection of All Five Hosts

Validating an enterprise MCP server exclusively in Claude Code masks silent structuredContent drops in Claude Desktop Chat, OAuth broker requirements on Claude Mobile, and the 5-tool selector cliff in OpenWebUI.

2. Auth & Session Divergences: Claude Mobile OAuth Broker, Supabase Global signOut & Restart Leaks

During prototyping, engineers routinely wire remote servers via npx mcp-remote https://mcp.corp.example/mcp --header "Authorization: Bearer <TOKEN>" inside claude_desktop_config.json or claude mcp add. That static header pipe works on laptops—and fails 100% of the time on Claude Mobile and cloud connectors, where no local stdio wrapper exists and RFC 9728 Protected Resource Metadata + OAuth 2.1 Authorization Code + PKCE (DCR / CIMD) is strictly mandatory.

Because enterprise Microsoft Entra ID and Okta tenants rarely allow arbitrary public Dynamic Client Registration out of the box, production deployments require an IdP (Entra/Okta) ↔ MCP OAuth 2.1 Broker that authenticates corporate SSO upstream and issues standards-compliant MCP OAuth tokens downstream. Once live, teams immediately hit three subtle session lifecycle bugs:

  • OAuth State / Mcp-Session-Id Mismatches Triggering Per-Message Re-Init Storms: If multi-replica load balancers fail to persist or deterministically bind Mcp-Session-Id to the OAuth principal across pods (returning mismatched state or 404 on follow-up turns), clients fall into a pathological recovery loop where every single chat message triggers a brand-new initialize + tools/list handshake, tripling turn latency.
  • The supabase.auth.signOut() Global Scope Kill-Switch: When a companion web dashboard shares Supabase Auth with your MCP OAuth broker and calls await supabase.auth.signOut(), the Supabase JS SDK defaults to scope: 'global'—revoking every refresh token for that user across all devices and silently killing their active Claude Desktop and Claude Code MCP sessions! Always call supabase.auth.signOut({ scope: 'local' }) on web logout.
  • Dangling Desktop Restart Sessions & Post-Auth RBAC notifications/tools/list_changed: Claude Desktop sleeps and restarts frequently abandon Streamable HTTP/SSE sessions without sending HTTP DELETE, requiring server-side idle TTL reapers. Furthermore, whenever post-auth RBAC narrows or expands a user’s permitted tools, emit notifications/tools/list_changed for live clients (Claude Code) while still enforcing strict per-call RBAC for clients that cache tools/list.
TypeScript: Local-Scoped Supabase Logout, Deterministic Session Binding & Post-Auth list_changed
import { createHash } from 'node:crypto';
import type { SupabaseClient } from '@supabase/supabase-js';

// 1. Companion Web Logout: MUST pass scope: 'local' so active Claude Desktop & Code MCP sessions survive!
export async function safeCompanionWebLogout(supabase: SupabaseClient) {
  const { error } = await supabase.auth.signOut({ scope: 'local' });
  if (error) throw error;
}

// 2. Prevent Per-Message Re-Initialization Storms Across Multi-Replica MCP Pods
export function resolveDeterministicMcpSession(
  incomingSessionId: string | undefined,
  verifiedJwtSub: string,
  oauthClientId: string,
): string {
  const bindingPrefix = createHash('sha256')
    .update(`${verifiedJwtSub}:${oauthClientId}`)
    .digest('hex')
    .slice(0, 24);
  // Preserve valid principal-bound session ID across replicas instead of forcing 404 re-init on every turn
  return incomingSessionId?.startsWith(`mcp_${bindingPrefix}_`)
    ? incomingSessionId
    : `mcp_${bindingPrefix}_v1`;
}

// 3. Notify Live Clients After Post-Auth RBAC Filtering (While Keeping Hard Enforcement on tools/call)
export async function notifyPostAuthRbacUpdate(
  mcpServer: { sendToolListChanged: () => Promise<void> },
  previousRole: string | null,
  resolvedRole: string,
) {
  if (previousRole !== resolvedRole) {
    await mcpServer.sendToolListChanged();
  }
}

3. Payload & Catalog Divergences: Silent structuredContent Drop, OpenWebUI 5-Tool Cliff & --read-only Leaks

Modern MCP specifications allow tools to return typed objects inside result.structuredContent alongside outputSchema. Engineers who populate result.structuredContent = { metrics, rows } while leaving result.content empty (or returning a terse "Success" label) encounter a baffling production failure: Claude Code ingests structuredContent cleanly, whereas Claude Desktop Chat silently drops it!

No error banner appears in Claude Desktop Chat—the model simply sees an empty tool response, either hallucinating that zero database records exist or entering a retry loop. Defensive MCP servers must always mirror structured payloads into result.content text blocks.

Meanwhile, self-hosted OpenWebUI and LM Studio deployments expose two catalog pitfalls: attaching more than 5–6 MCP tools causes tool-selection accuracy on mid-sized models to fall off a cliff due to schema prompt crowding. Worse, wrapping a child SQL MCP server with --read-only blocks mutations at execution time yet still leaks the child server’s hardcoded "Executes raw SQL" description in tools/list, causing safety-tuned models either to refuse benign read queries or waste turns attempting writes.

  • Mandatory Dual-Channel Serialization (structuredContent + content): Emit typed JSON in structuredContent for Claude Code and programmatic UI consumers while serializing deterministic summary + JSON/Markdown blocks inside result.content: [{ type: "text", text }] for Claude Desktop Chat, Claude Mobile, and OpenWebUI.
  • Two-Stage Ontology Domain Router for OpenWebUI: Collapse 50 granular table tools behind 4 top-level tools (discover_domains, inspect_ontology_entity, run_governed_query, stage_action) so tool-selector accuracy stays above 95%.
  • Sanitizing --read-only Child Wrapper Metadata: When proxying an upstream SQL MCP server in --read-only mode, explicitly override tool.description and stamp annotations: { readOnlyHint: true, destructiveHint: false } before returning tools/list.
TypeScript: Defensive Dual-Channel Serializer & --read-only Child MCP Description Override
interface CrossClientToolResult<T extends Record<string, unknown>> {
  content: Array<{ type: 'text'; text: string }>;
  structuredContent: T;
  isError?: boolean;
}

// Prevents silent data loss in Claude Desktop Chat & OpenWebUI while preserving typed data for Claude Code
export function serializeCrossClientToolResult<T extends Record<string, unknown>>(
  summaryHeader: string,
  payload: T,
): CrossClientToolResult<T> {
  const canonicalJson = JSON.stringify(payload, null, 2);
  return {
    structuredContent: payload,
    content: [
      {
        type: 'text',
        text: `${summaryHeader}\n\n\`\`\`json\n${canonicalJson}\n\`\`\``,
      },
    ],
  };
}

// Overrides misleading "executes raw SQL" descriptions leaked by --read-only child MCP servers
export function sanitizeReadOnlyChildTools<
  T extends { name: string; description?: string; annotations?: Record<string, unknown> },
>(childTools: T[]): T[] {
  return childTools
    .filter((t) => !/^(insert|update|delete|drop|alter)_/i.test(t.name))
    .map((tool) => ({
      ...tool,
      description:
        'Executes governed READ-ONLY analytical queries. All write/DDL statements (INSERT, UPDATE, DELETE, DROP) are strictly disabled.',
      annotations: {
        ...tool.annotations,
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
      },
    }));
}

4. 11,000-Row TOP 1000 Pagination Loops & 80,000-Char Base64 Upload Bloat (Presigned URLs + Origin Reads)

Adding SELECT TOP 1000 (or LIMIT 1000) plus a next_cursor token looks like responsible MCP engineering—until an executive asks an ambiguous prompt ("How did steel coil shipments perform this quarter?") over an 11,000-row ledger. Conscientious agents in Claude Code and Claude Cowork refuse to summarize partial slices, autonomously looping across all 11 pages (11 x 1,000 rows) until 200K+ tokens blow up the context window!

A parallel context disaster strikes binary file ingestion. Because Claude Chat sandboxes block remote MCP servers from reading local attachment paths, naive workflows instruct the model to base64-encode PDFs, spreadsheets, or CAD drawings into tool arguments—injecting 80,000+ characters of base64 tokens into chat history, burning token quotas, and truncating bytes mid-stream.

Production MCP servers eliminate both failure modes via Aggregate-First Ontology Guards for high-cardinality queries and 5-Minute TTL Presigned Upload URLs paired with Origin-Pinned Reads to defeat 60-second CDN stale-read races.

  • Aggregate-First Ontology Cardinality Guard: When matched row count exceeds max_detail_rows (e.g., 200) on a broad prompt, suppress next_cursor paging completely—return server-computed ontology dimensional rollups (SUM, COUNT, GROUP BY) alongside narrow filter hints.
  • 5-Minute TTL Presigned Upload URLs: Expose a lightweight request_upload_url tool returning a short-lived (300s TTL) S3/R2/MinIO PUT link so the user uploads binary files out-of-band with zero base64 tokens entering LLM context.
  • Origin-Pinned Reads Beating 60s CDN Stale-Read Races: If a user uploads a file and immediately messages "Done, parse it," reading via a CDN-fronted URL frequently serves a cached 404 or stale negative-cache hit for up to 60 seconds. Always read uploaded objects directly from the storage origin (Cache-Control: no-store / direct S3 API) using versioned keys.
TypeScript: Aggregate-First Ontology Pagination Guard & Origin-Pinned Presigned Artifact Read
// 1. Aggregate-First Guard: Stops 11-Page x TOP 1000 Agent Loops Before Context Explodes
export async function executeCardinalityGuardedQuery(
  totalMatchingRows: number,
  fetchRollupSummary: () => Promise<Record<string, unknown>>,
  fetchDetailRows: (limit: number) => Promise<Record<string, unknown>[]>,
) {
  const MAX_DETAIL_ROWS = 200;
  if (totalMatchingRows > MAX_DETAIL_ROWS) {
    const rollup = await fetchRollupSummary();
    return serializeCrossClientToolResult(
      `Query matched ${totalMatchingRows} rows (> ${MAX_DETAIL_ROWS} detail cap). Raw cursor paging disabled to protect context; returning verified ontology dimensional rollup. Supply narrower date/plant/status filters for line-item rows.`,
      { mode: 'AGGREGATED_ROLLUP', totalMatchingRows, rollup, nextCursor: null },
    );
  }
  const rows = await fetchDetailRows(MAX_DETAIL_ROWS);
  return serializeCrossClientToolResult(`Returned ${rows.length} detail rows.`, {
    mode: 'DETAIL_ROWS',
    totalMatchingRows,
    rows,
  });
}

// 2. Origin-Pinned Storage Read: Beats 60-Second Edge CDN Negative/Stale Cache Races After Presigned Upload
export async function readUploadedArtifactFromOrigin(
  s3OriginClient: { send: (cmd: unknown) => Promise<{ Body?: { transformToByteArray(): Promise<Uint8Array> } }> },
  buildGetObjectCommand: (input: { Bucket: string; Key: string; ResponseCacheControl: string }) => unknown,
  bucket: string,
  objectKey: string,
): Promise<Uint8Array> {
  // NEVER fetch() via public CDN hostname right after a 5-min TTL presigned PUT (60s stale 404 race).
  // Read directly against origin bucket endpoint with no-store headers:
  const response = await s3OriginClient.send(
    buildGetObjectCommand({
      Bucket: bucket,
      Key: objectKey,
      ResponseCacheControl: 'no-store, no-cache, max-age=0',
    }),
  );
  if (!response.Body) {
    throw new Error('Upload object not yet committed at origin; confirm presigned PUT completed.');
  }
  return response.Body.transformToByteArray();
}
Data-Plane vs. Control-Plane Separation in MCP

Never use the LLM context window as an ETL cursor buffer or binary file transport. Aggregate >200-row analytical sets inside SQL via ontology rollups, and route binary payloads out-of-band via 5-minute presigned URLs backed by origin-pinned reads.

Frequently Asked Technical Questions

Why does an MCP server configured with static Bearer headers work on Claude Desktop CLI pipes yet fail on Claude Mobile?

Local claude_desktop_config.json bridges like mcp-remote spawn a local Node.js subprocess on your laptop to inject static Authorization: Bearer headers. Claude Mobile and cloud connectors execute remotely with zero access to your laptop’s local config or stdio pipes—they strictly require an HTTPS MCP endpoint implementing RFC 9728 Protected Resource Metadata and OAuth 2.1 + PKCE.

Why does signing out of our companion web portal abruptly disconnect users from Claude Desktop and Claude Code?

In @supabase/supabase-js, calling supabase.auth.signOut() with no arguments defaults to scope: 'global', which revokes every active refresh token for that user across all devices and OAuth clients. Switching your web portal’s sign-out handler to supabase.auth.signOut({ scope: 'local' }) terminates only the browser session while keeping Desktop and CLI MCP tokens alive.

Why does Claude Desktop Chat act as if my tool returned empty output when Claude Code reads structuredContent fine?

Host handling of CallToolResult.structuredContent varies sharply: Claude Code feeds structuredContent into model context, whereas Claude Desktop Chat and OpenWebUI rely on result.content text blocks ({ type: 'text', text: '...' }). Always dual-emit both structuredContent and a serialized text block inside result.content.

How do we expose 40+ enterprise workflows to OpenWebUI without hitting the 5–6 tool-selector accuracy cliff?

OpenWebUI injects every attached tool’s JSON Schema into the prompt on each turn, crowding model attention past 5–6 tools. Replace flat tool catalogs with a two-stage ontology router exposing only 3–4 top-level tools (discover_ontology_domains, inspect_domain_schema, execute_governed_query, stage_action) that load domain parameters dynamically.

Glossary Concepts Referenced in This Guide

Open License (CC BY 4.0) · Cite This Page

Free to reference in engineering docs, ADRs, articles, and course syllabi with attribution.

[Production MCP Client Pitfalls Across Claude Mobile, Desktop Chat, Code, Cowork & OpenWebUI — Ontoloji.org](https://ontoloji.org/en/guides/claude-mobile-desktop-code-and-openwebui-mcp-client-bugs)

More Guides in This Series

Core Architecture
How AI Uses an Ontology
9 min read
Agent Engineering
Agent Harness vs. Ontology
8 min read
Data Engineering
ERP, CRM & MES Patterns
10 min read
Strategy & Governance
30-Day Ontology Strategy
7 min read
ERP Integration
ERP Ontology Integration Guide
11 min read
ERP Data Engineering
Logo Tiger, Nebim V3 & Turkish Unicode Traps
14 min read
Agent Governance
Adversarial Verification, Permissions & Compaction
13 min read
Verification Engineering
Absence-Aware Gates & Ratio Reconstruction
13 min read
Provenance & Governance
Draft vs. Normative Provenance Hygiene
12 min read
SAP & Protocol Architecture
SAP BTP, Cloud Connector & ORD Ontology
11 min read
ERP Write-Safety
Logo REST, Nebim Integrator & UBL-TR Safety
12 min read
Platform Architecture Comparison
Cortex, Genie, dbt & Cube vs. Ontology
12 min read
Systems Engineering & Forensics
ERP Integrator Anti-Patterns & Forensics
13 min read
Platform Architecture Comparison
Fabric IQ, D365 MCP & SAP Joule vs. Ontology
12 min read
Retrieval & RAG Architecture
PageIndex Vectorless Tree RAG vs. Vector DBs
11 min read
Platform Architecture Comparison
Atlan, Stardog & Neo4j vs. Ontology
12 min read
Statutory & Financial Governance
GİB UBL-TR, VUK/TMS 29 & KVKK Ontology
13 min read
Agent Memory & Ontology Architecture
Cognee & Zep Graphiti vs. Ontology
11 min read
Protocol & Multi-Agent Architecture
MCP vs. OpenAPI & Specialist Agents
12 min read
Protocols & Standards
MCP 2026-07-28: Tasks, Events & Apps
13 min read
Agent Architecture & Governance
Agent Harness Engineering Rubric
12 min read
Agent Architecture & Governance
Multi-Agent Task Boards & Mailboxes
12 min read
Verification & Security
Generate-Evaluate-Repair & Observers
12 min read
Verification & Security
NSA MCP Security & CIMD vs. DCR
13 min read
Agent Architecture & Governance
OpenTelemetry for AI Agents & MCP
11 min read
Agent Architecture & Governance
MCP Gateway vs. Enterprise AI Ontology
12 min read
MCP & Agent Security
MCP Apps Nonces, Elicitation & Refusal Traps
13 min read
ERP & SQL Ontology
Logo Tiger STLINE, Karmakoli & UINFO1 SQL Traps
14 min read
Manufacturing, MES & OEE Ontology
TRUMPF OPC UA & Siemens Energy SQL OEE Fix
13 min read
ERP & SQL Ontology
AI on ABAP, TROIA, Delphi & Stored Procedures
13 min read
MCP & Agent Security
Enterprise MCP Gateway & RFC 8693 Security
14 min read
Core Ontology Specification
Operational Ontology: Action Types, Links & Interfaces
15 min read