Define "MCP Sandbox Interface" and implement limactl mcp serve
#3744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows AI agents such as Gemini CLI to wrap local file operations (read/write/execute) inside Lima VM.
It should work with Claude Code, Codex, etc. too, but they might need a modification to disable their built-in local file operation tools. (Help wanted for testing)
This feature will be available in Lima v2.0
Preview of the documentation: https://deploy-preview-3744--lima-vm.netlify.app/docs/config/ai/
Interface
pkg/mcp/msi
defines "MCP Sandbox Interface" (tentative) that should be reusable for other projects too.MCP Sandbox Interface defines MCP (Model Context Protocol) tools that can be used for reading, writing, and executing local files with an appropriate sandboxing technology. The sandboxing technology can be more secure and/or efficient than the default tools provided by an AI agent.
MCP Sandbox Interface was inspired by Gemini CLI's built-in tools. https://github.com/google-gemini/gemini-cli/tree/v0.1.12/docs/tools
Implementation
limactl mcp serve INSTANCE
launches an MCP server that implements the MCP Sandbox Interface.Use https://github.com/modelcontextprotocol/inspector to play around with the server.
In the web browser,
Command
tolimactl
Arguments
tomcp serve default
▶️Connect
Usage with Gemni CLI
.gemini/extensions/lima/gemini-extension.json
as follows:.gemini/settings.json
so as to disable Gemini CLI's built-in tools except ones that do not relate to local command execution and file I/O:TODOs