MCI Structure
This document explains the structural organization of MCI projects, including entry files, toolsets, MCP server caching, and basic templating patterns.Entry Files
MCI projects start with one or more entry files located in the root of your project directory. These are the main schema files that define your tool collections.Single Entry File
The simplest structure uses a single entry file:mci.json
Multiple Entry Files
You can have multiple entry files, each creating a specific set of tools for different purposes:- Each entry file is independent and creates its own set of tools
- Entry files can share toolsets from the
./mcidirectory - Use multiple entry files to organize tools by environment, team, or purpose
- No limit on the number of entry files (1, 3, 10, or more)
- Each entry file must be loaded separately by the client; multiple entry files are not automatically merged and each requires its own MCIClient instance.
Toolsets Directory
Toolsets are stored in the./mci directory by default. This can be customized using the libraryDir field.
Default Structure
Custom Library Directory
You can use a different directory name:Nested Toolset Organization
Organize toolsets in subdirectories:MCP Tools Cache
When you register MCP servers in your schema, MCI automatically caches the tools in a specialmcp subdirectory within your toolsets directory.
Cache Location
How It Works
- Register MCP Server in your entry file:
-
First Load: MCI connects to the MCP server, fetches all tools, and saves them to
./mci/mcp/filesystem.mci.json - Subsequent Loads: MCI uses the cached file instead of connecting to the server (much faster)
-
Cache File Example (
./mci/mcp/filesystem.mci.json):
Cache Management
Expiration: Caches expire after a configurable number of days (default: 30):.gitignore:
Basic Templating
MCI supports templating in all schema files using the{{}} syntax. This allows dynamic values from environment variables and provides default fallbacks.
Environment Variable Templating
Syntax:{{env.VARIABLE_NAME}}
Default Values with Pipe Operator
Syntax:{{env.VARIABLE_NAME|'default_value'}}
The pipe operator (|) allows you to specify a default value if the environment variable is not set:
{{env.DB_HOST|'localhost'}}→"localhost"{{env.DB_PORT|'5432'}}→"5432"{{env.DB_USER|'postgres'}}→"postgres"
{{env.DB_HOST|'localhost'}}→"production.db.example.com"{{env.DB_PORT|'5432'}}→"3306"
Note: This allows any amount of vars (but keep it under 5, please): {{env.DB_HOST|env.EXTERNAL_DB_HOST|'localhost'}}
MCI File Templating Examples
Example 1: API Configuration with Defaults
Example 2: CLI Tools with Environment Defaults
Example 3: MCP Server with Template Defaults
Example 4: Toolset Reference with Filtering
Template Usage in Different Contexts
1. Entry Files - Use templates in the main schema:libraryDir or top-level config, but can use templates in tool definitions:
Best Practices
1. Use Descriptive Entry File Names
2. Organize Toolsets by Domain
3. Use Environment Variables for Secrets
4. Provide Sensible Defaults
5. Document Your Entry Files
Summary
- Entry Files: Main schema files in your project root that define tool collections
- Multiple Entry Files: Use as many as needed for different environments or purposes
- Toolsets Directory: Default is
./mci, customizable vialibraryDir - MCP Cache: Auto-generated in
./mci/mcp/when MCP servers are registered - Templating: Use
{{env.VAR}}for environment variables,{{env.VAR|default}}for defaults - Organization: Group toolsets by domain, use descriptive names, and document your schemas
