···6868└─────────────────────────────┘ └──────────────────────────────┘
6969```
70707171-The protocol is defined in `crates/ein-proto/proto/ein.proto`. The client streams `UserInput` messages; the server streams back `AgentEvent` messages (`SessionStarted`, `ContentDelta`, `ToolCallStart`, `ToolCallEnd`, `ToolOutputChunk`, `AgentFinished`, `AgentError`, `TokenUsage`).
7171+The protocol is defined in `crates/ein_proto/proto/ein.proto`. The client streams `UserInput` messages; the server streams back `AgentEvent` messages (`SessionStarted`, `ContentDelta`, `ToolCallStart`, `ToolCallEnd`, `ToolOutputChunk`, `AgentFinished`, `AgentError`, `TokenUsage`).
72727373### Session lifecycle
7474
···269269270270```
271271crates/
272272- ein-proto/ Protocol Buffer definitions (gRPC service + message types)
272272+ ein_proto/ Protocol Buffer definitions (gRPC service + message types)
273273ein/ Terminal UI client
274274eind/ gRPC server — agent loop, WASM plugin host, session persistence
275275packages/
···288288289289### Protocol
290290291291-The protocol (`crates/ein-proto/proto/ein.proto`) defines a bidirectional streaming RPC (`AgentSession`), a unary `ListSessions` RPC, and a unary `DeleteSession` RPC. Each session opens with a `SessionConfig` message (global sandbox constraints + per-plugin config map + optional `session_id` for resume), followed by `UserInput` prompt messages. The server streams back `AgentEvent` messages as the agent thinks, calls tools, and produces output — starting with a `SessionStarted` event carrying the session's UUID, a `resumed` boolean, and the prior conversation history when resuming.
291291+The protocol (`crates/ein_proto/proto/ein.proto`) defines a bidirectional streaming RPC (`AgentSession`), a unary `ListSessions` RPC, and a unary `DeleteSession` RPC. Each session opens with a `SessionConfig` message (global sandbox constraints + per-plugin config map + optional `session_id` for resume), followed by `UserInput` prompt messages. The server streams back `AgentEvent` messages as the agent thinks, calls tools, and produces output — starting with a `SessionStarted` event carrying the session's UUID, a `resumed` boolean, and the prior conversation history when resuming.
292292293293`UserInput` variants after `init`:
294294- `prompt` — a user message driving `run_agent`
···11-# `ein-agent` Architecture Fit for MCP Server Building
11+# `ein_agent` Architecture Fit for MCP Server Building
2233_Evaluation Date: 2026-04-20_
44···6677## Summary
8899-The `ein-agent` architecture maps well onto the *client* side of MCP but is missing the abstractions needed to be a proper MCP *server* framework. It is well-positioned to grow in that direction, but there are meaningful gaps.
99+The `ein_agent` architecture maps well onto the *client* side of MCP but is missing the abstractions needed to be a proper MCP *server* framework. It is well-positioned to grow in that direction, but there are meaningful gaps.
10101111---
12121313## What Maps Cleanly
14141515-### `Tool` / `ToolSet` traits (`crates/ein-agent/src/tools/mod.rs`)
1515+### `Tool` / `ToolSet` traits (`crates/ein_agent/src/tools/mod.rs`)
16161717The best fit. MCP's core concept is a server that exposes named tools with JSON schemas — that is exactly what `Tool` and `ToolSet` model. An MCP server implementation would be a new `ToolSet` adapter that routes calls to MCP rather than local functions.
18181919-### `ToolDef` / `ToolFunction` / `ToolFunctionParams` (`crates/ein-core/src/types.rs`)
1919+### `ToolDef` / `ToolFunction` / `ToolFunctionParams` (`crates/ein_core/src/types.rs`)
20202121Already serialize to OpenAI function-calling format, which is structurally identical to MCP's tool definition schema. Very little translation needed.
2222
+10-10
notes/mcp-server-roadmap.md
···11-# Roadmap: MCP Server Support for `ein-agent`
11+# Roadmap: MCP Server Support for `ein_agent`
2233_Date: 2026-04-20_
44···6677## Goal
8899-Make `ein-agent` a competitive Rust SDK for building MCP servers. The primary differentiator is WASM-sandboxed tool execution — deny-by-default filesystem and network access per tool, with explicit per-tool capability grants. The Vercel/Context.ai incident (April 2026) demonstrated that the current generation of MCP tools has no answer to a compromised server exfiltrating OAuth tokens. Ein's existing WASM runtime directly addresses this, and the timing is good.
99+Make `ein_agent` a competitive Rust SDK for building MCP servers. The primary differentiator is WASM-sandboxed tool execution — deny-by-default filesystem and network access per tool, with explicit per-tool capability grants. The Vercel/Context.ai incident (April 2026) demonstrated that the current generation of MCP tools has no answer to a compromised server exfiltrating OAuth tokens. Ein's existing WASM runtime directly addresses this, and the timing is good.
10101111The target bar is parity with the official `rmcp` SDK on protocol coverage and ergonomics, with WASM sandboxing as a clear security advantage over everything in the ecosystem.
1212···27272828## Phases
29293030-### Phase 1: `ein-agent` trait improvements (prerequisite)
3030+### Phase 1: `ein_agent` trait improvements (prerequisite)
31313232These changes are required before any MCP work begins. They unblock concurrent MCP calls and remove constraints that don't make sense for a server use case.
3333···8484- Error codes and error objects
8585- Notification types (`notifications/cancelled`, etc.)
86868787-Use `serde` for serialization. Keep these types in `ein-core` so they can be shared with a future MCP client.
8787+Use `serde` for serialization. Keep these types in `ein_core` so they can be shared with a future MCP client.
88888989**Capability negotiation**
9090···296296297297---
298298299299-### Phase 7: MCP client in `ein-agent`
299299+### Phase 7: MCP client in `ein_agent`
300300301301Close the loop: let Ein agents consume tools from any MCP server, not just tools registered locally. This makes Ein bidirectional.
302302···321321322322```
323323crates/
324324- ein-core/ existing — add MCP JSON-RPC types here
325325- ein-agent/ existing — Phase 1 trait improvements
326326- ein-mcp/ new — McpServer, transports, auth middleware
327327- ein-mcp-macros/ new — #[mcp_tool], #[mcp_server] proc macros
324324+ ein_core/ existing — add MCP JSON-RPC types here
325325+ ein_agent/ existing — Phase 1 trait improvements
326326+ ein_mcp/ new — McpServer, transports, auth middleware
327327+ ein_mcp_macros/ new — #[mcp_tool], #[mcp_server] proc macros
328328```
329329330330-`ein-mcp` depends on `ein-agent` (for `ToolSet`) and `ein-core` (for shared types). The macro crate is a separate proc-macro crate depended on by `ein-mcp`.
330330+`ein_mcp` depends on `ein-agent` (for `ToolSet`) and `ein_core` (for shared types). The macro crate is a separate proc-macro crate depended on by `ein_mcp`.
331331332332---
333333