03. API Clients and MCP
What services/api/client.ts Shows
The client layer is not a trivial HTTP wrapper. It supports multiple provider paths and auth modes: direct API key access, subscriber OAuth flows, Bedrock, Foundry, Vertex, custom headers, proxy-aware fetch, session identifiers, and additional protection headers.
This is a useful lesson if you build local agents: provider abstraction gets messy quickly once you support enterprise auth, cloud variants, session analytics, and proxy routing.
What services/mcp/auth.ts Shows
MCP support here is treated as a serious protocol layer. The auth module covers metadata discovery, authorization server interaction, callback ports, token storage, secure storage, browser launch, lock files, error normalization, retries, and cross-app access support.
That means MCP is not bolted on. It is a platform-grade integration mechanism.
Practical Lesson
Where To Read Next
source/services/api/claude.ts: request assembly and model query flowsource/services/api/filesApi.ts: file upload and download pathsource/services/mcp/client.ts: MCP tool/resource plumbingsource/services/mcp/types.ts: shape of the MCP integration surface
Source Navigation
Recommended Source Files
source/services/api/client.tssource/services/api/claude.tssource/services/mcp/auth.tssource/services/mcp/client.tssource/services/oauth/client.ts
Next Files to Read
source/services/api/filesApi.tssource/services/api/withRetry.tssource/services/mcp/config.ts