Skip to content

Developers

One MCP server. Scoped tools. No shell.

Coding agents reach LokiAI through a single, provider-neutral MCP server. This page covers how they connect, what they can call, how the repository is laid out and what is still to build.

  • MCP server
  • Rust runtime
  • Electron shell
  • In development

01Connecting an agent

How a coding client connects

Codex, Claude Code, Cursor and later clients use the same server and the same tools. Setup differs per client. The contract does not.

  1. 01

    Pick a client

    You choose a coding client in LokiAI Settings or onboarding.

  2. 02

    Create a connection

    LokiAI makes a revocable agent connection with a workspace and capability scope.

  3. 03

    Write the config

    LokiAI generates the client configuration with the exact executable path and a credential reference. It never prints a reusable plaintext secret into logs or the agent conversation.

  4. 04

    Client starts the server

    The coding client launches the MCP server over local stdio. Remote HTTP is disabled until it is separately accepted and threat-modelled.

  5. 05

    Each request describes itself

    Every request carries the protocol version and client identity. The server authenticates the workspace connection and exposes only what that connection is scoped to.

  6. 06

    You can see and revoke it

    LokiAI shows the last handshake, the client, server and runtime versions, the scope, and a revoke control.

The server is planned as a standalone Node 24 distribution with its own launcher. It does not rely on Electron's embedded Node or a global install. LokiAI does not promise that every client can be woken automatically after an incident. That depends on the client and is labelled as such.

02Resources

What an agent can read

Resources are projections of LokiAI state, never raw database rows or arbitrary files. The URIs below are the proposed families in the MCP spec.

loki://workspaces/{id}/summary
Workspace, runtime and capability summary.
loki://devices/{id}
Device identity, connector, capability, health and freshness.
loki://devices/{id}/logs
A bounded, redacted page of logs. Untrusted text.
loki://devices/{id}/telemetry
A bounded signal query and its result, with quality.
loki://incidents/{id}
State, affected scope, correlations and verification.
loki://incidents/{id}/evidence
A bounded evidence manifest. Untrusted text.
loki://deployments/{id}
Artifact, target, stage, verification and rollback.
loki://jobs/{id}
A durable job: stage, result and error.
loki://agents/runs/{id}
The run hierarchy and the tools and jobs tied to it.

03Tools

What an agent can call

This is the proposed list. The final schemas are owned by the contracts package, so names may still change.

01

Inspection

Low risk. Scoped to the workspace, paginated, redacted, and marked with source and freshness.

  • loki_list_devices
  • loki_get_device
  • loki_get_device_health
  • loki_read_device_logs
  • loki_query_telemetry
  • loki_list_incidents
  • loki_get_incident
  • loki_get_job
  • loki_list_deployments
  • loki_get_deployment
02

Diagnosis and build

Low or medium risk, depending on policy. Build inputs are limited to an approved repository root, a revision, a target and a typed toolchain recipe.

  • loki_run_health_check
  • loki_run_preflight
  • loki_collect_incident_evidence
  • loki_register_agent_run
  • loki_update_agent_run
  • loki_request_build
  • loki_cancel_job
03

Consequential operations

High risk by default. Each one creates a request, checks policy, and returns a denial, an approval requirement or a durable job.

  • loki_request_restart
  • loki_request_flash
  • loki_request_test_on_device
  • loki_request_deployment
  • loki_request_rollback

04Rules

What every tool call must obey

These rules hold for every client. A prompt cannot change them.

Typed parameters only
Tools never accept raw commands, executables, scripts, URLs, environment maps or free paths.
Approval is not a flag
No tool takes an approval boolean from the agent. An agent can request a flash. It cannot approve one.
Long calls return handles
Slow or device-changing calls return a durable job id or approval_required. They do not block until the work looks finished.
Device text is untrusted
Logs and evidence come back marked as untrusted text. Prompt content cannot set role, policy, approval, target or artifact digest.
Stable names and schemas
Tool names use the loki_ prefix. Every input and output has a runtime schema and version. Final schemas are owned by the contracts package.

The MCP spec writes the result shapes as below. They are the documented contract, not output from a running system.

A successful read
{
  data,
  source,
  observed_at,
  freshness,
  correlation_id,
  next_cursor?
}
A consequential request
{
  outcome: "rejected" | "approval_required"
         | "accepted" | "deduplicated",
  approval_id?,
  job_id?,
  bound_request_digest?,
  policy_reason,
  correlation_id,
  status_resource?
}

Clients that support the MCP Tasks extension see long jobs through it. Others poll loki_get_job with the job id. Either way the runtime job stays the source of truth.

05Repository

How the code is laid out

Version 1.2.0 of the Rust workspace and the root package. The workspace has 20 crates, listed in Cargo.toml.

Rust crates

Other folders

crates/
The Rust workspace, listed on the left.
electron/
The Electron shell: main process, preload bridge and scripts.
packages/contracts
Shared TypeScript contracts.
packages/ipc-client
Client for the local IPC protocol.
packages/native-credential-store
Credential store binding.
services/mcp-server
The MCP server, built as a standalone launcher.
LokiAI Desktop UI/
The React and Vite renderer, the accepted visual baseline.
Docs/
The specifications. Start with Docs/README.md.
tools/
Repository scripts.

Toolchain pins as the repository states them: Rust 1.97.1 stable with edition 2024 in rust-toolchain.toml, Node 24 (24.19.0 or newer, below 25) and pnpm 11 in the root package.json.

06Working on it

The honest state of the code

The interface baseline exists. Most of what sits behind it is implementation work.

To look at the interface, run npm install and then npm run dev inside the LokiAI Desktop UI folder. That starts a React and Vite preview. It is for visual inspection only. It does not prove sign-in, hardware access, monitoring, incidents, agent delivery, builds, deployments or updates.

The Electron shell, the trusted IPC, the runtime, storage, cloud integration, the MCP server and the real hardware paths are still to be built and verified. See the status section in the docs.

Engineering rules (AGENTS.md)

  • Spec first. The documents in Docs/ define the behaviour, and the code has to match them. A change to behaviour updates the spec and its tests in the same change.
  • Bounded context. Each task names the few documents it needs. Nobody loads everything into every task.
  • Source-of-truth order. The latest human instruction comes first, then the task packet, accepted decisions and architecture, the security, build, cloud and stack documents, the spec, and the product requirements. A contradiction that touches safety or contracts is raised, not guessed.

Read AGENTS.md

Start with the spec, then the code.

The MCP spec, the architecture and the tech stack are in the repository.