Problem
All 44 tools are local Lex CLI commands. There is no way to connect external APIs, CI systems, databases, package registries, or other MCP-compatible servers as tools available to agents.
Design
New module: src/tools/mcp.lex
type McpTool = { name: Str, description: Str, schema: JsonSchema, endpoint: Str }
fn load_mcp_tools(server_url: Str) -> [net] List[t.Tool]
fn call_mcp_tool(tool: McpTool, args: Json) -> [net] Json
Integration points:
all_tools() in index.lex should optionally append MCP tools loaded from .lex/mcp.toml
- Permission rules need an
mcp_tool(name) predicate in rules.lex so MCP tools go through the same gate
- The TUI should accept
--mcp <url> to load tools from an MCP server at startup
Configuration (.lex/mcp.toml)
[[servers]]
url = "http://localhost:3000"
allow = ["search_issues", "create_pr"]
Acceptance
- MCP tools appear in
all_tools() and are filterable via permission specs
lex check --strict src/ passes
- Smoke test with a local MCP server stub
Problem
All 44 tools are local Lex CLI commands. There is no way to connect external APIs, CI systems, databases, package registries, or other MCP-compatible servers as tools available to agents.
Design
New module:
src/tools/mcp.lexIntegration points:
all_tools()inindex.lexshould optionally append MCP tools loaded from.lex/mcp.tomlmcp_tool(name)predicate inrules.lexso MCP tools go through the same gate--mcp <url>to load tools from an MCP server at startupConfiguration (
.lex/mcp.toml)Acceptance
all_tools()and are filterable via permission specslex check --strict src/passes