Skip to main content

Configuration

This page documents the configuration types used by IoAiWebFactory.


IoAiWeb.WebConfig​

Top-level configuration for AI Web.

interface WebConfig {
mcp?: MCPConfig;
agentServer: AgentServerConfig;
context?: WorkingContextConfig;
codeMode?: CodeModeConfig;
}
PropertyTypeRequiredDescription
agentServerAgentServerConfigYesConnection details for the backend implementing the io.Intelligence Agent Protocol
mcpMCPConfigNoMCP client and server connection settings
contextWorkingContextConfigNoWorking Context integration
codeModeCodeModeConfigNoCode Mode integration for model-facing tool virtualization

Minimal Configuration​

const config: IoAiWeb.WebConfig = {
agentServer: {
baseUrl: "http://localhost:4111",
},
};

AgentServerConfig​

Connection settings for the agent server.

interface AgentServerConfig {
baseUrl: string;
retries?: number;
backoffMs?: number;
maxBackoffMs?: number;
headers?: Record<string, string>;
abortSignal?: AbortSignal;
credentials?: "omit" | "same-origin" | "include";
}
PropertyTypeRequiredDescription
baseUrlstringYesBase URL for the backend that implements the io.Intelligence Agent Protocol
retriesnumberNoRetry count for server requests
backoffMsnumberNoInitial backoff delay in milliseconds
maxBackoffMsnumberNoMaximum backoff delay in milliseconds
headersRecord<string, string>NoAdditional request headers such as Authorization
abortSignalAbortSignalNoShared abort signal for requests
credentials"omit" | "same-origin" | "include"NoFetch credentials mode

See Agent Protocol for the route and streaming contract AI Web expects at this base URL.

Example​

agentServer: {
baseUrl: "https://agents.example.com",
retries: 3,
backoffMs: 1000,
maxBackoffMs: 10000,
headers: {
Authorization: "Bearer user-token",
},
credentials: "omit",
}

MCPConfig​

Controls MCP connections and MCP Apps behavior.

interface MCPConfig {
clientsConfig: MCPClientConfig;
ioIntel?: {
remote?: MCPRemoteServerConfig;
web?: {
enabled?: boolean;
hasPriority?: boolean;
};
};
remoteServers?: MCPRemoteServerConfig[];
mcpApps?: McpApps.Config;
}
PropertyTypeRequiredDescription
clientsConfigMCPClientConfigYesMCP client capabilities and behavior
ioIntel.remoteMCPRemoteServerConfigNoRemote Streamable HTTP connection to the io.Intelligence MCP server
ioIntel.web{ enabled?: boolean; hasPriority?: boolean }Noio.Connect web transport settings for the io.Intelligence MCP server
remoteServersMCPRemoteServerConfig[]NoAdditional remote MCP servers
mcpAppsIoAiWeb.McpApps.ConfigNoMCP Apps rendering settings

Notes​

  • Use ioIntel.web when the io.Intelligence MCP server is reachable through the io.Connect environment
  • Use ioIntel.remote when the same server is exposed over Streamable HTTP
  • Use remoteServers for third-party or additional MCP servers
  • Remote MCP server names must be unique

Example​

mcp: {
clientsConfig: {
capabilities: {},
},
ioIntel: {
web: {
hasPriority: false,
},
remote: {
streamableHttp: {
url: "http://localhost:8989/mcp",
name: "primary-remote-server",
},
},
},
remoteServers: [
{
streamableHttp: {
url: "http://localhost:8081/mcp",
name: "secondary-mcp-server",
},
},
],
}

MCPClientConfig​

Defines client capabilities advertised to MCP servers.

interface MCPClientConfig {
enforceStrictCapabilities?: boolean;
debouncedNotificationMethods?: string[];
capabilities: {
sampling?: {
handler?: (serverName: string, params: SamplingRequestParams) => Promise<SamplingSuccessResponse | SamplingErrorResponse>;
};
elicitation?: {
handler?: (serverName: string, params: ElicitationRequestParams) => Promise<ElicitationResponse>;
};
extensions?: {
"io.modelcontextprotocol/ui"?: {
mimeTypes: string[];
};
[key: string]: any;
};
experimental?: Record<string, any>;
};
}
PropertyTypeRequiredDescription
enforceStrictCapabilitiesbooleanNoEnables stricter capability validation
debouncedNotificationMethodsstring[]NoNotification methods to debounce
capabilities.sampling.handlerfunctionNoHandles sampling requests from MCP servers
capabilities.elicitation.handlerfunctionNoHandles elicitation requests from MCP servers
capabilities.extensionsobjectNoExtension capability metadata, including MCP App UI support
capabilities.experimentalobjectNoCustom experimental capability declarations

UI Extension Example​

To advertise MCP App UI support, expose the UI extension capability:

clientsConfig: {
capabilities: {
extensions: {
"io.modelcontextprotocol/ui": {
mimeTypes: ["text/html;profile=mcp-app"],
},
},
},
}

MCPRemoteServerConfig​

Streamable HTTP configuration for a remote MCP server.

interface MCPRemoteServerConfig {
streamableHttp: {
url: string;
name: string;
options?: StreamableHTTPClientTransportOptions;
};
}
PropertyTypeRequiredDescription
streamableHttp.urlstringYesFull MCP endpoint URL
streamableHttp.namestringYesUnique logical name for the server
streamableHttp.optionsStreamableHTTPClientTransportOptionsNoLow-level transport options

WorkingContextConfig​

Enables Working Context integration.

interface WorkingContextConfig {
factory: IoIntelWorkingContextFactoryFunction;
config?: IoIntelWorkingContext.Config;
}
PropertyTypeRequiredDescription
factoryIoIntelWorkingContextFactoryFunctionYesFactory used to initialize Working Context
configIoIntelWorkingContext.ConfigNoWorking Context schema and runtime options

Example​

import { IoIntelWorkingContextFactory } from "@interopio/working-context";

context: {
factory: IoIntelWorkingContextFactory,
config: {
schema: {
clientId: {
type: "string",
source: {
context: {
location: { workspace: { target: "my" } },
path: "clientId",
},
},
},
},
},
}

For the schema model itself, see Working Context Schema Configuration.


CodeModeConfig​

Enables Code Mode in AI Web. Configure this at the client when AI Web owns the LLM request or connects to multiple MCP servers. AI Web maintains a Code Mode session for the client and automatically declares capabilities.experimental.codeMode to connected @interopio/mcp-core servers.

The session belongs to the AI Web instance. Code Mode sessions are not scoped by resourceId and do not enforce user permissions. Enforce authorization in the underlying tools or MCP server. Tools retain their plain MCP names, and duplicate names across servers keep only the first occurrence. MCP tool-list change notifications refresh the catalog; the next agent stream rebuilds the session registry from enabled tools. See Tool Names, Refresh, and Sessions for lifecycle details.

interface CodeModeConfig {
factory: IoCodeModeFactoryFunction;
config: IoCodeMode.Config;
}
PropertyTypeRequiredDescription
factoryIoCodeModeFactoryFunctionYesThe browser Code Mode factory, imported from @interopio/code-mode/browser.
configIoCodeMode.ConfigYesQuickJS WASM location, resource limits, and optional tool policies.

Example​

import { IoCodeModeFactory } from "@interopio/code-mode/browser";

const config: IoAiWeb.WebConfig = {
agentServer: {
baseUrl: "http://localhost:4111",
},
codeMode: {
factory: IoCodeModeFactory,
config: {
wasmLocation: "/quickjs/emscripten-module.wasm",
},
},
};
One Owner per Client

When AI Web connects to multiple MCP servers, configure Code Mode in AI Web rather than on each server. This lets the client virtualize the combined tool catalog once and avoids duplicate getTools, getToolDefinition, and executeCode meta-tools in the model-facing tool list.

Caller Context​

AI Web passes the tool-call cancellation signal to Code Mode through ExecuteOptions.signal, but does not set ExecuteOptions.context. Consequently, config.interceptors.onToolCall receives callContext: undefined; it does not receive the user, role, resourceId, or thread ID. There is no public AI Web per-run option for injecting arbitrary Code Mode caller context.

For per-user role checks, authenticate the MCP request and resolve the role on the server from verified credentials. Supplying a role in tool arguments or Working Context does not establish authorization. If your host directly invokes the standalone Code Mode API, it can supply execute(args, { context }); this is not an AI Web stream option.

See MCP Core caller context for server-side request extras and a verified-role interceptor example.

See Code Mode Configuration for the IoCodeMode.Config options and Code Mode Overview for integration ownership guidance.


McpApps.Config​

Controls how MCP Apps are rendered.

interface Config {
sandboxProxyUrl: string;
displayMode?: "inline" | "workspace";
}
PropertyTypeRequiredDescription
sandboxProxyUrlstringYesURL of the sandbox proxy HTML page served by the host application
displayMode"inline" | "workspace"NoPreferred display mode. When omitted, AI Web resolves the mode at runtime

Practical Notes​

  • The sandbox proxy is required for MCP Apps
  • The proxy forwards messages between the host and a sandboxed guest iframe
  • Workspace mode depends on io.Connect Workspace support

Example​

mcp: {
clientsConfig: {
capabilities: {
extensions: {
"io.modelcontextprotocol/ui": {
mimeTypes: ["text/html;profile=mcp-app"],
},
},
},
},
mcpApps: {
sandboxProxyUrl: "http://localhost:5206/index.html",
displayMode: "workspace",
},
}