DEV Community

Bharath B R
Bharath B R

Posted on

Why I Built a Pure-Rust Model Context Protocol Engine for Interlayer & Liteverse (<3.8MB RAM, 457k ops/s)


Anthropic's Model Context Protocol (MCP) is rapidly becoming the open standard for connecting autonomous AI agents to external tools, databases, and host systems.

However, if you have tried running several reference MCP servers concurrently, you have likely felt the resource bloat: each tool server spins up a heavy Node.js or Python runtime eating 100MB to 200MB of RAM each and adding 400ms+ cold-boot latency.

As the creator of Interlayer Blockchain and Liteverse Network, this overhead was a critical blocker. Here is why we built InterMCP (v0.2.1) from scratch in pure Rust, and why we are open-sourcing it for the entire community.

The Origin: Why Interlayer & Liteverse Needed a Rust MCP Engine

  1. Liteverse DePIN Edge & Watcher Nodes: Liteverse coordinates client-side compute across resource-constrained edge machines and watcher nodes. Requiring a 150MB+ Node.js runtime just to execute basic tool calls completely choked low-spec host nodes.

  2. Interlayer Blockchain Agent Latency: Autonomous agents executing on-chain transactions and interacting with multi-VM smart contracts require sub-millisecond tool dispatch. A 400ms+ cold-boot lag and 45ms per-dispatch overhead in JS/Python created unacceptable delays during block validation and agent coordination.

  3. Host Security & Prompt Injection: Autonomous agents can be manipulated via prompt injection to attempt directory traversal. We needed kernel-level path canonicalization (SafeFS) to enforce strict filesystem jail bounds before any tool execution occurs.

What InterMCP Delivers

  • Cold Boot Latency: 0.4 ms (1,000x faster than Node.js)
  • Memory Footprint: < 3.8 MB RSS (40x lighter than the 162MB reference SDK)
  • Dispatch Latency: 2.98 µs in-process dispatch (457,042 ops/s throughput)
  • SafeFS Sandboxing: Restricts file reading and searching to explicit allowlisted workspaces, rejecting symlink escapes and path traversal exploits
  • Zero Runtime Dependencies: Compiles into a single, lightweight static binary

1-Click Multi-IDE Setup

To make setup completely frictionless, running:

npx intermcp setup
Enter fullscreen mode Exit fullscreen mode

or with Cargo:

cargo install intermcp && intermcp setup
Enter fullscreen mode Exit fullscreen mode

automatically detects your active IDEs (Google Antigravity, Cursor, VS Code, Kilo Code, and Claude Desktop), creates atomic configuration backups, and merges the gateway instantly.

Open Source for the Community

While originally engineered to solve bottlenecks on Interlayer Blockchain and Liteverse Network, every developer building AI agents faces this exact same resource problem.

InterMCP is dual-licensed under MIT / Apache 2.0:

Benchmarks are reproducible locally via intermcp bench --iterations 5000. Feedback, stars, and PRs are warmly welcome!

Top comments (0)