Connect MCP clients

Choose two independent things: who calls the model, and how the client connects.

Model sourceUse whenTools
host: current client modelReuse the current model without a second keyintent_runtime_prepare / intent_runtime_accept / intent_runtime_cancel
executor: server-configured modelServer already has an API or gatewayintent_runtime_parse
ConnectionSupplyConnection owner
Standalone stdioTrusted .js/.mjs configurationClient starts intent-runtime-mcp as a subprocess
Standalone HTTPSame configuration, bind address and portStart the service; client connects to its /mcp URL
Existing MCP serverIntent, adapter, and SDK handlersYour SDK server

Both host and executor work over stdio or HTTP. Start with host below, then switch to a configured API if needed. Tool registration does not intercept every message.

Standalone stdio

Complete installation. Codex registration is not required. Save intent.host.config.js in an ESM project, or use .mjs for a standalone file. Record its actual absolute path.

export default {
  mode: 'host',
  instances: {orders: {language: 'en', schema: {
    type: 'object',
    properties: {orderId: {type: 'string', description: 'An order ID explicitly supplied by the user; preserve leading zeros; applies only to order intents'}},
  }}},
};

This trusted Node.js module imports no packages and can be saved independently. Choose the command for your installation location.

Global installation: run in a terminal to check startup, or have your MCP client start:

intent-runtime-mcp --config /absolute/path/intent.host.config.js

Project-local installation: run from the service project where you installed @devcodex/intent-runtime. This example uses a standalone .mjs configuration:

npx --no-install intent-runtime-mcp --config /absolute/path/my-service/intent.host.config.mjs

A local installation does not add the command to the system PATH. Install the package in the project first; --no-install prevents installing a missing package for this invocation, but you must still run from the correct service project.

Select STDIO in the client. With a global installation available on the client's PATH, clients supporting mcpServers can use:

{
  "mcpServers": {
    "intent-runtime": {
      "command": "intent-runtime-mcp",
      "args": ["--config", "/absolute/path/intent.host.config.js"]
    }
  }
}

With a project-local installation, use absolute paths to Node and the installed entry. This does not depend on the client's working directory or npm command PATH:

{
  "mcpServers": {
    "intent-runtime": {
      "command": "/absolute/path/to/node",
      "args": [
        "/absolute/path/my-service/node_modules/@devcodex/intent-runtime/dist/cli/mcp.js",
        "--config",
        "/absolute/path/my-service/intent.host.config.mjs"
      ]
    }
  }
}

Find Node with node -p "process.execPath" and replace every placeholder with its actual absolute path. Enter each args item separately in client forms. Windows paths can use C:/Program Files/nodejs/node.exe and D:/Worker/my-service/...; use / or escaped \\ in JSON. Spaces inside a JSON path string do not require extra shell quotes.

For global commands missing from PATH, use the executable's absolute path as well. On Windows use .cmd if supported; otherwise use Node with the installed entry as above. Codex users can use setup. stdout carries protocol only; inspect stderr for logs.

Service configurationType / defaultRule
modeexecutor or host / executorTrusted server configuration; tools cannot switch it
instancesRecord<string, IntentConfig> / requiredNonempty map; CLI creates and owns each Intent
toolPrefixstring / emptyOptional; added before the complete intent_runtime_* name, e.g. orders_intent_runtime_prepare; final names at most 128 characters

executor instances require a model executor; host does not. --help/--version are supported. Invalid arguments exit 2, loading/startup failures exit 1, normal EOF or SIGINT/SIGTERM exits 0. Keep stdout for MCP and logs on stderr.

HTTP and a custom port

Reuse the same configuration. For a global installation:

intent-runtime-mcp --config /absolute/path/intent.host.config.js --transport http --host 127.0.0.1 --port 3001 --path /mcp

For a project-local installation, run from the service project:

npx --no-install intent-runtime-mcp --config /absolute/path/my-service/intent.host.config.mjs --transport http --host 127.0.0.1 --port 3001 --path /mcp

The remote deployment examples below use the global command. For a project-local installation, prefix it with npx --no-install and run from the service project.

Expect Intent MCP listening at http://127.0.0.1:3001/mcp. Keep the process running and add a Streamable HTTP client connection:

{
  "mcpServers": {
    "intent-runtime": {
      "url": "http://127.0.0.1:3001/mcp"
    }
  }
}

If the client uses a form instead, enter the same URL. Three host tools should appear. If the port is occupied, choose another and update the client URL. Stop with Ctrl+C.

CLI optionDefaultPurpose
--configrequiredAbsolute trusted .js/.mjs path
--transportstdiostdio or http
--host127.0.0.1HTTP bind address
--port3001HTTP port, 1–65535
--path/mcpHTTP route without a query
--public-originunsetPublic HTTP/HTTPS origin including a nondefault port; no path, credentials, query, or fragment

These HTTP options belong to process startup, not Intent configuration. stdio rejects them. HTTP uses stateful Streamable HTTP with protocols 2025-06-18 / 2025-11-25; stdio also supports 2026-07-28. The client must support the selected protocol.

Retain the negotiated Mcp-Session-Id; prepare and accept need the same logical session. HTTP allows at most 128 sessions, reclaims sessions after 30 minutes without new requests, and limits bodies to 4 MiB. This is not durable business conversation storage. Default binding is local. Configure authentication, HTTPS, and public access in your deployment layer; the command does not manage OAuth or proxies.

Remote addresses and HTTPS proxies

--host binds the process; --public-origin identifies the origin the client actually accesses. They may differ. Binding 0.0.0.0 or :: requires a public origin; a wildcard bind address is not a client URL.

For a controlled LAN:

intent-runtime-mcp --config /absolute/path/intent.host.config.js --transport http --host 0.0.0.0 --port 3001 --public-origin http://192.168.1.10:3001

Replace the IP and connect to http://192.168.1.10:3001/mcp. This does not add encryption or authentication. Public deployment belongs behind configured TLS and access controls.

For https://mcp.example.com/mcp, with local process binding:

intent-runtime-mcp --config /absolute/path/intent.host.config.js --transport http --host 127.0.0.1 --port 3001 --public-origin https://mcp.example.com

This Nginx route belongs inside an existing TLS/access-controlled server block. Your deployment supplies certificates, authentication, and the domain:

location = /mcp {
    proxy_pass http://127.0.0.1:3001;
    proxy_http_version 1.1;
    proxy_set_header Host $http_host;
    proxy_buffering off;
    proxy_read_timeout 3600s;
}

Clients use https://mcp.example.com/mcp. Preserve public Host, original Origin, MCP session/protocol headers, and streaming responses. Nondefault ports must match in public-origin and Host. Arbitrary X-Forwarded-* headers do not expand trust; do not rewrite an invalid Origin to bypass checks. Public Host must match the configured origin's Host; supplied Origin must match scheme, host, and port. Local diagnostic addresses remain available.

Validate connection, tool discovery, and prepare/accept in one session. Mismatching Host/Origin should return 403. Request-boundary tests do not replace validation of your actual proxy, certificates, authentication, and client.

Complete API-backed configuration

Use this instead of host configuration. Save in a project with Intent Runtime installed, set INTENT_API_KEY and INTENT_MODEL, and start with its absolute path. It selects no business fields by default.

import {createApiExecutor} from '@devcodex/intent-runtime/adapters/api';
const apiKey = process.env.INTENT_API_KEY, model = process.env.INTENT_MODEL;
if (!apiKey || !model) throw new Error('Set INTENT_API_KEY and INTENT_MODEL.');
export default {mode: 'executor', instances: {main: {language: 'en', executor: createApiExecutor({provider: 'openai', apiKey, model})}}};

Complete the first recognition

In a tool-capable AI client, ask: “Use intent-runtime to recognize 'Look up order 000123. Do not cancel the order.' Extract the order ID, show the goal and prohibition, and do not perform order operations.”

Host mode lists intent_runtime_prepare, intent_runtime_accept, intent_runtime_cancel and needs the client model to complete the handoff. A client that only lists tools does not finish recognition. See Host handoff. Codex setup installs the corresponding Skill.

Executor mode can call:

{
  "name": "intent_runtime_parse",
  "arguments": {"input": "Look up order 000123. Do not cancel the order."}
}

Without a Schema, do not select business fields. structuredContent should preserve the lookup and prohibition; read the result. Host makes no additional API call; executor uses the configured model.

SymptomNext step
Startup fails or no toolsAbsolute .js/.mjs, ESM configuration, local imports, client stderr
HTTP cannot connectBind address, port, /mcp path, running process
HTTP 403Public URL and --public-origin; preserve public Host/original Origin including nondefault port
Unexpected tool listCheck mode and reconnect
prepare without a final resultComplete accept in the same session using outputSchema; HostTask is not a result
isError=trueRead the error summary and follow recovery

Add tools to an existing service

Keep your SDK, transport, and tools; start with the four integration points. Existing HTTP services use the same adapter while retaining listener, authentication, and logical connections. Do not rebuild a host session for every HTTP request.

Parameter and protocol reference

See Adapter API, tool input, envelopes, protocols, and complete replies.

Structured replies

Send the Native clarification request to executor parse or host prepare and omit input. Executor returns the local IntentResult. Host returns {kind: 'local_result', result} without a lease. For text, host prepare returns a model task for accept. Both shapes use the same CLI configuration and tool names.