MCI - MCP Servers
MCP (Model Context Protocol) servers provide external tools that can be integrated into your MCI projects. MCI’s MCP integration offers automatic caching, filtering, and significantly better performance than direct MCP connections.What are MCP Servers?
MCP Servers are external services that expose tools via the Model Context Protocol. They can run:- Locally via STDIO (command-line processes like
npx,uvx) - Remotely via HTTP/SSE (web-based endpoints)
- Filesystem operations (read, write, list files)
- Memory/storage services
- GitHub integration
- Slack integration
- Database access
- Custom business logic
Why Use MCI’s MCP Integration?
Direct MCP Connection (Traditional Approach)
MCI MCP Integration (Better Approach)
Key Benefits
- 20x Faster Tool Discovery: Reading from JSON cache vs. connecting to MCP server
- Connection Pooling: Reuse connections during execution
- Filtering: Only register needed tools, not all available tools
- Splitting & Combining: Mix tools from different MCP servers in different MCI files
- No Runtime MCP Dependency: Agent doesn’t need MCP connection to discover tools
- Offline Discovery: List and inspect tools without server access
How It Works
1. Registration
Register MCP servers in your MCI schema:2. First Load (Auto-Caching)
When you first load the schema:- MCI connects to the MCP server (
npx @modelcontextprotocol/server-filesystem /workspace) - Fetches all available tools from the server
- Converts them to MCI tool definitions
- Saves them to
./mci/mcp/filesystem.mci.json - Adds expiration timestamp (default: 30 days)
./mci/mcp/filesystem.mci.json example):
3. Subsequent Loads (Fast!)
On subsequent loads:- MCI checks for cached file:
./mci/mcp/filesystem.mci.json - Checks if expired (compares current date with
expiresAt) - If valid, loads tools from cache (no MCP connection needed)
- If expired, re-fetches from server and updates cache
| Operation | Direct MCP | MCI Cached |
|---|---|---|
| Tool Discovery | 500ms | 25ms |
| Tool Execution | 200ms | 200ms |
| Total (1st time) | 700ms | 525ms |
| Total (cached) | N/A (no caching) | 225ms |
Note: Direct MCP does not cache tool definitions, so its performance is always 700ms. The “cached” value is not applicable for Direct MCP.
Note: Examples here are average for NPX-based MCPs. HTTP-based performance hardly vary, but generally is slower than local servers.
4. Tool Execution
When you execute an MCP tool:- MCI reads the cached tool definition
- Connects to the registered MCP server
- Calls the tool via MCP protocol
- Returns result in standard MCI format
Note: MCI currently supports only Tools from MCP, since it is the most requested (And useful TBH) feature. Resources & Prompts can be added using MCI’stextandfileexecution types.
Registering MCP Servers
STDIO Server (Local)
npx Example:HTTP Server (Remote)
Multiple Servers
Filtering MCP Tools
One of the most powerful features is the ability to filter which tools are loaded from MCP servers.Basic Filtering
Include Only Specific Tools:read_file, write_file, and list_directory tools are registered.
Exclude Dangerous Tools:
delete_file and move_file are registered.
Filter by Tags:
"read" or "search" are registered.
Splitting & Combining MCP Tools
You can split tools from a single MCP server across multiple MCI files, or combine tools from different MCP servers into one MCI file.Splitting: One MCP Server → Multiple MCI Files
Production Tools (prod-tools.mci.json):Combining: Multiple MCP Servers → One MCI File
Cache Management
Cache Location
Default location:./mci/mcp/{serverName}.mci.json
Expiration Configuration
Set custom expiration in days:- Frequently changing APIs: 1-7 days
- Stable services: 30-90 days
- Development: 1 day
Manual Cache Refresh
Delete specific cache:Git Ignore
Add to.gitignore:
Performance Benefits
1. Faster Tool Discovery
Scenario: Agent wants to see all available tools| Method | Time | Notes |
|---|---|---|
| Direct MCP | 500ms | Connect to server, fetch tools |
| MCI Cached | 25ms | Read from JSON file |
| Speedup | 20x faster |
2. Offline Tool Inspection
3. Reduced Server Load
- Tools are fetched once per cache period (e.g., 30 days)
- Thousands of agents can use the same cache
- Server is only contacted during tool execution
4. Faster Multi-Agent Systems
Without MCI Caching:- 10 agents × 500ms discovery = 5 seconds total
- 10 agents × 25ms discovery = 250ms total
- 20x faster startup
Best Practices
1. Set Appropriate Expiration
2. Filter Aggressively
Only load tools you actually need:3. Use Environment Variables
Note: MCIClient object supports env_vars as well as when registering with uvx mcix run in any MCP client (For example, cursor or vscode) you can pass env variables, which will be resolved in whole “mci.json” file, as well as in “mcp_servers” part
4. Add to .gitignore
5. Document Server Requirements
Troubleshooting
Cache is Stale
Solution: Delete and re-fetchServer Not Available
Error:Failed to connect to MCP server: filesystem
Solutions:
- Check server command is correct
- Verify
npxoruvxis installed - Check network connectivity for HTTP servers
- Verify credentials (API tokens)
Tools Not Appearing
Solutions:- Check cache expiration
- Verify filter configuration
- Delete cache and reload
- Check server is providing tools
Summary
- MCP Integration: Connect to external MCP servers for additional tools
- Automatic Caching: Tools cached in
./mci/mcp/for fast access - 20x Faster Discovery: Read from JSON vs. connecting to server
- Filtering: Control which tools are registered
- Splitting & Combining: Mix MCP tools across different MCI files
- No Runtime Dependency: Agents don’t need MCP connection to discover tools
- Performance: Significantly faster than direct npx-based MCP
