Connect an AI assistant
loch mcp starts an MCP server (stdio transport). It uses the endpoints and API keys of your loch configuration.
Before you start: install loch, then run loch config, loch use and loch login. Use the full path of the binary (which loch): desktop apps often do not see your PATH.
- Claude Code
- Codex
- OpenCode
- LM Studio
claude mcp add --scope user loch /usr/local/bin/loch mcp
Check with claude mcp list.
codex mcp add loch -- /usr/local/bin/loch mcp
Or in ~/.codex/config.toml:
[mcp_servers.loch]
command = "/usr/local/bin/loch"
args = ["mcp"]
In opencode.json (project) or ~/.config/opencode/opencode.json (global):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"loch": {
"type": "local",
"command": ["/usr/local/bin/loch", "mcp"],
"enabled": true
}
}
}
In LM Studio, open Program → Install → Edit mcp.json, then add:
{
"mcpServers": {
"loch": {
"command": "/usr/local/bin/loch",
"args": ["mcp"]
}
}
}
Choose a model that supports tool calls.
Try it
Ask your assistant: "List my loch endpoints, then the stacks on the first one."
Good to know
- The assistant can do only what your API key allows. Use a key with limited scopes for daily work.
- Passwords are never returned to the assistant. To reset one, run
loch services reset-passwordyourself. - Deleting a database and publishing ports are CLI-only. So are deploying functions, their secrets and credentials: an assistant only invokes the functions marked
--mcp-invocable. loch ai:howtoprints these instructions in the terminal.
Full list of tools: MCP tools.