Use Loha with Claude Code & Cursor
Loha's MCP server lets your AI coding agent talk to Loha directly. Instead of switching to the dashboard when a build goes red, you ask the agent, and it reads the failing logs and suggests a fix in the file you already have open.
This guide gets you connected in three steps.
1. Create a personal access token
In the dashboard, open your workspace's Settings → API Keys and create a personal access token (the dashboard calls it an API key). Members, admins and owners can create one (guests cannot), where member self-service is enabled for the workspace; starting builds (triggers:run) needs the member role or higher. Scope it to what you want the agent to do:
- Read-only (
builds:read,repos:read,pipelines:read): inspect builds, read logs, validate configs. The safe default. - Add
triggers:runonly if you want the agent to be able to start builds.
An agent runs with your token's permissions, so a read-only token keeps it strictly "look, don't touch." It's the simplest way to make the agent's access narrower than your own.
Copy the token (loha_…); you'll paste it next.
2. Add the MCP server
Claude Code:
claude mcp add --transport http loha https://mcp.loha.longtumlab.com/ \
--header "Authorization: Bearer loha_xxxxxxxx"
Cursor / Claude Desktop: add to your MCP config (.mcp.json or the app's config):
{
"mcpServers": {
"loha": {
"type": "http",
"url": "https://mcp.loha.longtumlab.com/",
"headers": { "Authorization": "Bearer loha_xxxxxxxx" }
}
}
}
Restart the agent if needed, then confirm it's connected: ask it "what Loha workspace am I in?" (it calls whoami).
3. Try it
A few things to ask your agent:
- "Are my builds green?" → it lists repos and recent builds and summarizes.
- "Why did the last build on
mainfail?" → it finds the failed run, opens the failing step, reads the redacted logs, and proposes a fix. - "Is this
.loha.ymlvalid?" → it validates against Loha's real schema before you commit. - "Run the pipeline for this repo on
main." → it shows you the intended run and waits for your go-ahead (guarded; see below).
trigger_pipeline dry-runs by default: the agent tells you what it would run and dispatches nothing until it confirms. And with a read-only token, it can't start builds at all.
Logs and build metadata the agent reads enter its model's context. Build logs are secret-redacted by Loha first, but see Data sovereignty before using it on sensitive output.
See also
- MCP Server reference: full tool list, auth, and API mapping
- Personal access tokens: create, scope, and revoke
- CLI: the same workflows from your terminal