Overview
MCI (Model Context Interface) uses a JSON schema to define tools that AI agents can execute. Each tool specifies:- What it does (metadata and description)
- What inputs it accepts (JSON Schema)
- How to execute it (execution configuration)
1.0
Top-Level Schema Structure
The root MCI context file has three main fields:Field | Type | Required | Description |
---|---|---|---|
schemaVersion | string | Required | MCI schema version (e.g., "1.0" ) |
metadata | object | Optional | Descriptive metadata about the tool collection |
tools | array | Required | Array of tool definitions |
Example
Metadata
Optional metadata about the tool collection.Field | Type | Required | Description |
---|---|---|---|
name | string | Optional | Name of the tool collection |
description | string | Optional | Description of the tool collection |
version | string | Optional | Version of the tool collection (e.g., SemVer) |
license | string | Optional | License identifier (e.g., "MIT" , "Apache-2.0" ) |
authors | array | Optional | Array of author names |
Example
Tool Definition
Each tool in thetools
array represents a single executable operation.
Field | Type | Required | Description |
---|---|---|---|
name | string | Required | Unique identifier for the tool |
title | string | Optional | Human-readable title |
description | string | Optional | Description of what the tool does |
inputSchema | object | Optional | JSON Schema describing expected inputs |
execution | object | Required | Execution configuration (see Execution Types) |
Example
Execution Types
MCI supports four execution types:http
, cli
, file
, and text
. The type
field in the execution
object determines which executor is used.
HTTP Execution
Execute HTTP requests to external APIs. Type:"http"
Fields
Field | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Required | - | Must be "http" |
method | string | Optional | "GET" | HTTP method: GET , POST , PUT , PATCH , DELETE , HEAD , OPTIONS |
url | string | Required | - | Target URL (supports templating) |
headers | object | Optional | - | HTTP headers as key-value pairs (supports templating) |
auth | object | Optional | - | Authentication configuration (see Authentication) |
params | object | Optional | - | Query parameters as key-value pairs (supports templating) |
body | object | Optional | - | Request body configuration |
timeout_ms | integer | Optional | 30000 | Request timeout in milliseconds (must be ≥ 0) |
retries | object | Optional | - | Retry configuration |
Body Configuration
Thebody
field defines the request body:
Field | Type | Required | Description |
---|---|---|---|
type | string | Required | Body type: "json" , "form" , or "raw" |
content | object/string | Required | Body content (object for json/form, string for raw) |
Retry Configuration
Theretries
field configures retry behavior:
Field | Type | Required | Default | Description |
---|---|---|---|---|
attempts | integer | Optional | 1 | Number of retry attempts (must be ≥ 1) |
backoff_ms | integer | Optional | 500 | Backoff delay in milliseconds (must be ≥ 0) |
Examples
GET Request with Query ParametersCLI Execution
Execute command-line tools and scripts. Type:"cli"
Fields
Field | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Required | - | Must be "cli" |
command | string | Required | - | Command to execute |
args | array | Optional | - | Fixed positional arguments |
flags | object | Optional | - | Dynamic flags mapped from properties |
cwd | string | Optional | - | Working directory (supports templating) |
timeout_ms | integer | Optional | 30000 | Execution timeout in milliseconds (must be ≥ 0) |
Flag Configuration
Each flag in theflags
object has:
Field | Type | Required | Description |
---|---|---|---|
from | string | Required | Property path (e.g., "props.ignore_case" ) |
type | string | Required | Flag type: "boolean" or "value" |
boolean
: Flag is included only if the property is truthy (e.g.,-i
)value
: Flag is included with the property value (e.g.,--file=myfile.txt
)
Examples
Basic CLI CommandFile Execution
Read and parse file contents with optional templating. Type:"file"
Fields
Field | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Required | - | Must be "file" |
path | string | Required | - | File path (supports templating) |
enableTemplating | boolean | Optional | true | Whether to process templates in file content |
enableTemplating
is true
, the file contents are processed with the full templating engine (basic placeholders, loops, and conditionals).
Examples
Load Template FileText Execution
Return templated text directly. Type:"text"
Fields
Field | Type | Required | Description |
---|---|---|---|
type | string | Required | Must be "text" |
text | string | Required | Text template (supports templating) |
Examples
Simple MessageAuthentication
HTTP execution supports four authentication types: API Key, Bearer Token, Basic Auth, and OAuth2.API Key Authentication
Pass an API key in headers or query parameters. Type:"apiKey"
Fields
Field | Type | Required | Description |
---|---|---|---|
type | string | Required | Must be "apiKey" |
in | string | Required | Where to send the key: "header" or "query" |
name | string | Required | Header/query parameter name |
value | string | Required | API key value (supports templating, typically {{env.API_KEY}} ) |
Examples
API Key in HeaderBearer Token Authentication
Pass a bearer token in theAuthorization
header.
Type: "bearer"
Fields
Field | Type | Required | Description |
---|---|---|---|
type | string | Required | Must be "bearer" |
token | string | Required | Bearer token (supports templating, typically {{env.BEARER_TOKEN}} ) |
Example
Basic Authentication
Use HTTP Basic Authentication with username and password. Type:"basic"
Fields
Field | Type | Required | Description |
---|---|---|---|
type | string | Required | Must be "basic" |
username | string | Required | Username (supports templating, typically {{env.USERNAME}} ) |
password | string | Required | Password (supports templating, typically {{env.PASSWORD}} ) |
Example
OAuth2 Authentication
Authenticate using OAuth2 client credentials flow. Type:"oauth2"
Fields
Field | Type | Required | Description |
---|---|---|---|
type | string | Required | Must be "oauth2" |
flow | string | Required | OAuth2 flow type (e.g., "clientCredentials" ) |
tokenUrl | string | Required | Token endpoint URL |
clientId | string | Required | OAuth2 client ID (supports templating) |
clientSecret | string | Required | OAuth2 client secret (supports templating) |
scopes | array | Optional | Array of scope strings |
Example
Templating Syntax
The MCI templating engine supports placeholder substitution, loops, and conditional blocks. Templating is available in:- Execution configurations (URLs, headers, params, body, etc.)
- File contents (when
enableTemplating: true
) - Text execution
Context Structure
The templating engine has access to three contexts:props
: Properties passed toexecute()
methodenv
: Environment variables passed to the adapterinput
: Alias forprops
(for backward compatibility)
Basic Placeholders
Replace placeholders with values from the context. Syntax:{{path.to.value}}
Examples
For Loops
Iterate a fixed number of times using a range. Syntax:@for(variable in range(start, end))...@endfor
variable
: Loop variable namestart
: Starting value (inclusive)end
: Ending value (exclusive)
Example
Template:Foreach Loops
Iterate over arrays or objects from the context. Syntax:@foreach(variable in path.to.collection)...@endforeach
variable
: Loop variable namepath.to.collection
: Path to an array or object in the context
Array Example
Context:Object Example
Context:Conditional Blocks
Execute code conditionally based on values in the context. Syntax:Supported Conditions
- Truthy check:
@if(path.to.value)
- Equality:
@if(path.to.value == "expected")
- Inequality:
@if(path.to.value != "unexpected")
- Greater than:
@if(path.to.value > 10)
- Less than:
@if(path.to.value < 100)
Examples
Simple Conditional:Execution Result Format
All tool executions return a consistent result format.Field | Type | Description |
---|---|---|
isError | boolean | Whether an error occurred during execution |
content | any | Result content (if successful) |
error | string | Error message (if isError: true ) |
metadata | object | Optional metadata (e.g., HTTP status code, CLI exit code) |
Successful Result
Error Result
Complete Example
Here’s a complete MCI context file demonstrating all features:See Also
- API Reference - Python adapter API documentation
- Quickstart Guide - Getting started with MCI
- PRD.md - Product requirements and specifications
- PLAN.md - Implementation plan and architecture