MCP Integration Guide
Connect Model Context Protocol servers and call their tools from Ada CLI
Looking for the MCP Gateway? The Lovelace platform is also available as a single MCP server you can connect to from any MCP client. See the MCP Gateway documentation for setup instructions, tool reference, and client configuration.
Overview#
Model Context Protocol (MCP) servers expose tools and resources to AI clients. ada mcp manages the external MCP servers Ada can use: it adds and removes servers, lists their tools and resources, and calls tools directly from the terminal.
Server definitions live in ~/.lovelace/mcp-servers.toml. Commands that talk to a server (tools, call, exec, resources) run through the Lattice daemon, which starts on demand.
MCP vs ACP#
| Protocol | Purpose | Use Case |
|---|---|---|
| MCP | AI ↔ Resources | File access, databases, APIs, tools |
| ACP | Editors ↔ Ada CLI | Editor subprocess integration (ada acp start) |
Adding Servers#
Stdio Servers#
A stdio server is a local command that Ada starts and talks to over stdin/stdout. Pass the command with --command and each argument with a separate --arg:
# Official filesystem server, limited to the current directory
ada mcp add filesystem --command npx --arg=-y --arg @modelcontextprotocol/server-filesystem --arg .
# Pass environment variables to the server process
ada mcp add github --command github-mcp-server --arg stdio --env GITHUB_PERSONAL_ACCESS_TOKEN=<token>
Use the --arg=VALUE form for arguments that start with a dash.
Remote (HTTP) Servers#
# Streamable HTTP server
ada mcp add <name> --url <server-url>
# Send a static header with every request
ada mcp add <name> --url <server-url> --header "X-Api-Version:2"
# Store a header value from an environment variable in the OS keyring
ada mcp add <name> --url <server-url> --credential-header Authorization=MY_SERVER_TOKEN
Other ada mcp add options: --root <path> limits the workspace root a server may access, --timeout-ms <ms> sets an operation timeout, and --stateless lets sessions share one server process.
Removing Servers#
# Preview the removal
ada mcp remove filesystem --dry-run
# Remove without a confirmation prompt
ada mcp remove filesystem --yes
Inspecting Servers#
# List configured servers and their status
ada mcp servers list
ada mcp servers list --format json
# Force health checks against the daemon
ada mcp servers status --health-check
# Show the MCP configuration, or validate it without loading servers
ada mcp config
ada mcp config --validate
Tools#
Listing Tools#
# All tools from all configured servers
ada mcp tools
# Group tools by server
ada mcp tools --group
# Only servers whose name matches a pattern
ada mcp tools --filter filesystem
Calling Tools#
Tool names use the server:tool format.
# Call a tool with JSON arguments
ada mcp call filesystem:list_directory --args '{"path": "."}'
# The same call in function-call syntax
ada mcp exec 'filesystem:list_directory(path=".")'
# Validate an invocation without contacting the daemon
ada mcp exec 'filesystem:list_directory(path=".")' --dry-run
# Cancel the call if it runs longer than 10 seconds
ada mcp call filesystem:list_directory --args '{"path": "."}' --timeout-ms 10000
Interactive MCP Shell#
ada mcp repl opens an interactive shell for exploring servers:
# Start the shell
ada mcp repl
# Use a default server for unqualified tool names
ada mcp repl --server filesystem
Commands inside the shell:
| Command | What it does |
|---|---|
help | Show shell help |
tools | List MCP tools from the daemon |
call <invocation> | Execute a tool through the daemon |
dry-run <invocation> | Validate an invocation without daemon access |
resources [command] | List, read, or subscribe to resources |
sessions | Show local MCP execution history |
set server <name> | Change the default server |
save <path> | Save the shell transcript |
exit | Leave the shell |
Example session:
mcp> tools
mcp> call filesystem:list_directory(path=".")
mcp> exit
Resources#
# List resources from all configured servers
ada mcp resources list
# Read a resource by URI
ada mcp resources read <uri>
# Watch a resource for updates
ada mcp resources subscribe <uri> --watch
Execution History#
Every tool call is recorded locally:
# Recent calls
ada mcp sessions list
# Search the history
ada mcp sessions search list_directory
# Show one entry
ada mcp sessions show <entry-id>
# Export history as Markdown
ada mcp sessions export mcp-history.md --format markdown
# MCP sessions the daemon is tracking right now
ada mcp sessions active
# Clear the history
ada mcp sessions clear --yes
Serving Lattice to Other MCP Clients#
lattice-ctl mcp is an MCP server over stdio that gives other clients, such as
Claude Code or OpenAI Codex, the Lattice running on your computer. It forwards
to the running Lattice and needs no account or key.
Register it with Claude Code:
claude mcp add lattice -- lattice-ctl mcp
Register it with Codex in ~/.codex/config.toml:
[mcp_servers.lattice]
command = "lattice-ctl"
args = ["mcp"]
See Local Server for the tools it provides.
Editor Integration#
Editors connect to Ada over the Agent Client Protocol, not MCP:
ada acp start
See Editor Integration.
Troubleshooting#
Server not responding
# Force a health check
ada mcp servers status --health-check
# Show detailed information for each server
ada mcp servers list --verbose
# Check the daemon
ada status
Configuration errors
ada mcp config --validate
Tool call fails
# Validate the invocation first
ada mcp exec 'filesystem:list_directory(path=".")' --dry-run
# Look at recorded failures
ada mcp sessions --status failed
Best Practices#
- Add only the servers you need: each server is another process with access to your machine.
- Limit access: pass the narrowest directory or
--roota server needs. - Keep secrets out of the config file: use
--credential-headerfor remote tokens. - Dry-run first: validate invocations with
--dry-runbefore running tools that change data.
Next Steps:
- MCP Gateway: access the entire Lovelace platform as a single MCP server
- Editor Integration: use Ada from your editor