Skip to main content

Server API

The MCP Web Server enables web applications to expose Model Context Protocol capabilities within a browser environment. The server uses @interopio/mcp-core internally to provide MCP capabilities without requiring traditional Node.js server infrastructure.

ServerFactory​

Factory function to create and start an MCP server instance.

Type Signature​

type IoIntelMCPWebServerFactoryFunction = (
io: IOConnectBrowser.API | IOConnectDesktop.API,
config: IoIntelMCPWeb.Server.Config,
) => Promise<void>;

Parameters​

ParameterTypeDescription
ioIOConnectBrowser.API | IOConnectDesktop.APIio.Connect Browser or Desktop API instance
configIoIntelMCPWeb.Server.ConfigServer configuration object including license key

Returns​

Promise<void> - Resolves when the server is successfully started and registered

Basic Usage​

import IOBrowser from "@interopio/browser";
import { ServerFactory } from "@interopio/mcp-web";

const io = await IOBrowser();

await ServerFactory(io, {
licenseKey: "your-license-key",
mcpCoreServer: {
tools: {
static: {
methods: [
{
name: "calculate",
description: "Perform calculation",
inputSchema: {
type: "object",
properties: {
operation: { type: "string" },
a: { type: "number" },
b: { type: "number" },
},
},
},
],
},
},
},
});

Server Configuration​

The server configuration interface defines all options for initializing the MCP server.

Interface Definition​

interface Config {
licenseKey: string;
mcpCoreServer?: Omit<IoIntelMCPCore.McpServerConfig, "name" | "title">;
mcpWorkingContext?: IoIntelMCPCore.WorkingContextConfig;
}

Properties​

licenseKey (required)​

  • Type: string
  • Description: Your io.Intelligence license key. This is mandatory for server operation.

mcpCoreServer (optional)​

  • Type: Omit<IoIntelMCPCore.McpServerConfig, "name" | "title">
  • Description: Configuration for the underlying @interopio/mcp-core server. Accepts any valid MCP Core configuration except name and title, which are automatically set to "iointel-mcp-web" and "IOIntel MCP Web" respectively.
  • Includes: Configuration for tools, resources, prompts, and other MCP capabilities.

mcpWorkingContext (optional)​

  • Type: IoIntelMCPCore.WorkingContextConfig
  • Description: Optional working context configuration for MCP Core, enabling context-aware MCP operations.
Automatic Field Configuration

The name and title fields are automatically set by the server and cannot be overridden:

  • name: "iointel-mcp-web"
  • title: "IOIntel MCP Web"

Configuration Options​

OptionTypeRequiredDefaultDescription
licenseKeystringYes-io.Intelligence license key
mcpCoreServerobjectNo{}MCP Core server configuration
mcpWorkingContextobjectNo-Working context configuration

Configuration Rules​

  • The licenseKey is mandatory and must be a valid io.Intelligence license
  • The mcpCoreServer configuration accepts any valid @interopio/mcp-core configuration options
  • Refer to the MCP Core documentation for detailed server configuration options
  • The server automatically registers the interop method io.mcp.web.server for client communication

Integration Options​

There are two primary approaches to integrating the MCP server into your io.Connect Browser environment.

The recommended approach for io.Connect Browser Platform administrators is to define the MCP server as a plugin. This provides centralized control over MCP capabilities across all connected applications.

Advantages​

  • Centralized configuration and management
  • Single server instance for all connected clients
  • Platform-level control over capabilities
  • Automatic lifecycle management
  • Configuration changes apply system-wide

Example​

import IOBrowserPlatform from "@interopio/browser-platform";
import { ServerFactory } from "@interopio/mcp-web";

const platformConfig = {
plugins: {
definitions: [
{
name: "io.MCPWeb",
start: ServerFactory,
critical: true,
config: {
licenseKey: "your-license-key",
mcpCoreServer: {
tools: {
static: {
methods: [
{
name: "getUserInfo",
description: "Get current user information",
inputSchema: {
type: "object",
properties: {},
},
},
],
intents: [
{
name: "CreateOrder",
description: "Create a new order",
},
],
},
},
},
},
},
],
},
};

await IOBrowserPlatform(platformConfig);

Server within Web Application​

Developers can also instantiate the MCP server directly within their web application, providing application-specific control over the server lifecycle and configuration.

Advantages​

  • Application-specific configuration
  • Full control over server lifecycle
  • Custom capability exposure
  • Independent deployment from platform

Example​

import IOBrowser from "@interopio/browser";
import { ServerFactory } from "@interopio/mcp-web";

async function startMCPServer() {
const io = await IOBrowser();

await ServerFactory(io, {
licenseKey: "your-license-key",
mcpCoreServer: {
tools: {
static: {
methods: [
{
name: "echo",
description: "Echo back the input message",
inputSchema: {
type: "object",
properties: {
message: { type: "string" },
},
required: ["message"],
},
},
],
},
},
resources: {
static: [
{
uri: "config://app-settings",
name: "Application Settings",
mimeType: "application/json",
},
],
},
},
});

console.log("MCP Server started successfully");
}

startMCPServer();

Complete Server Example​

A comprehensive example showing a server with multiple capabilities:

import IOBrowser from "@interopio/browser";
import { ServerFactory } from "@interopio/mcp-web";

async function startComprehensiveServer() {
const io = await IOBrowser({
application: "mcp-server-app",
});

await ServerFactory(io, {
licenseKey: process.env.IO_INTELLIGENCE_LICENSE_KEY,
mcpCoreServer: {
tools: {
static: {
methods: [
{
name: "getWeather",
description: "Get weather for a location",
inputSchema: {
type: "object",
properties: {
location: {
type: "string",
description: "City name",
},
},
required: ["location"],
},
},
],
intents: [
{
name: "OpenDocument",
description: "Open a document by ID",
},
],
},
},
resources: {
static: [
{
uri: "config://app-settings",
name: "Application Settings",
mimeType: "application/json",
},
],
},
prompts: {
static: [
{
name: "greeting",
description: "Generate a greeting message",
arguments: [
{
name: "name",
description: "Person's name",
required: true,
},
],
},
],
},
},
});

console.log("MCP Server with full capabilities is running");
}

startComprehensiveServer();