Skip to content

MCP Setup Guide

This guide walks you through setting up the LumenFlow MCP server with your AI coding assistant.

MCP (Model Context Protocol) is an open standard for AI-to-tool communication. Instead of relying on file-based instructions, MCP provides a programmatic interface for AI assistants to interact with development tools.

Structured Tools

Tools with typed inputs and outputs, not just text parsing

Resource Access

Direct access to LumenFlow data via URI patterns

Consistent Interface

Same tools work across different AI clients

Safety Maintained

All operations respect LumenFlow workflow rules

Before setting up MCP:

  1. LumenFlow initialized in your project

    pnpm lumenflow
  2. An agent host with MCP support

  1. Install the MCP package (if not already included)

    pnpm add -D @hellmai/lumenflow-mcp
  2. Verify the binary is available

    pnpm list @hellmai/lumenflow-mcp

Follow your host’s current MCP documentation and register this server in the project-owned configuration:

SettingValue
Commandpnpm
Arguments["exec", "lumenflow-mcp"]

Environment variables:

VariableDescriptionDefault
LUMENFLOW_PROJECT_ROOTProject root directoryprocess.cwd()
LUMENFLOW_MCP_LOG_LEVELLog levelinfo

LumenFlow does not create, update, validate, or version a host-specific MCP configuration file. LUMENFLOW_PROJECT_ROOT defaults to process.cwd() when omitted.

After registration, verify the mode-aware surface. Local stdio exposes applied in-process reads such as context_get, wu_list, and agent_resolve, plus the canonical methodology resources below. Authenticated HTTP adds task lifecycle and tool execution only when the bearer has the matching permission. The exact effective catalog is generated at /reference/mcp.

LumenFlow serves the stable MCP 2026-07-28 revision. Its own clients and release certification pin that exact revision and fail closed when a peer offers only an older one. Both stdio and HTTP reject legacy openings. The underlying SDK can be configured explicitly for legacy interoperability by a downstream integrator, but that connection is non-certifying.

Modern clients use server/discover; there is no initialize/initialized exchange and no Mcp-Session-Id. Every request repeats its protocol revision, client capabilities, and optional client information in _meta. HTTP requests also carry MCP-Protocol-Version, Mcp-Method, and, where applicable, Mcp-Name.

LumenFlow advertises tools and resources. It currently advertises no list-change capability; if one is added, the current subscription method is subscriptions/listen. LumenFlow’s task_* names are ordinary tools and do not advertise the separate io.modelcontextprotocol/tasks extension.

The examples above use stdio, which remains the default. Stdio is a local process-environment trust boundary and does not use the HTTP bearer flow.

For a shared long-lived service, select Streamable HTTP and configure the exact remote trust binding:

LUMENFLOW_MCP_TRANSPORT=http \
LUMENFLOW_MCP_HTTP_ISSUER=https://issuer.example.com \
LUMENFLOW_MCP_HTTP_RESOURCE=https://runtime.example.com/mcp \
LUMENFLOW_MCP_HTTP_WORKSPACE_ID=workspace-1 \
LUMENFLOW_CONTROL_PLANE_SIGNING_KEY=replace-with-a-strong-secret \
  pnpm exec lumenflow-mcp
VariablePurpose
LUMENFLOW_MCP_HTTP_ISSUERExact trusted credential issuer
LUMENFLOW_MCP_HTTP_RESOURCEExact protected resource URL and credential audience
LUMENFLOW_MCP_HTTP_WORKSPACE_IDExact workspace accepted by this MCP deployment
LUMENFLOW_CONTROL_PLANE_SIGNING_KEYSecret used to verify signed remote credentials
LUMENFLOW_MCP_HTTP_HOSTBind host; defaults to 127.0.0.1
LUMENFLOW_MCP_HTTP_PORTBind port; defaults to 8848

Every MCP protocol request must send a signed Authorization: Bearer … credential. Verification requires a valid signature and expiry, the configured issuer, exact resource audience and workspace, and a canonical subject. Opaque bearer fallback is off. Legacy tool scopes do not become transport permissions.

The supported transport permissions are:

  • task:read and task:write
  • event:read and evidence:read
  • discovery:read
  • tool:invoke
  • ag-ui:run

Authentication occurs before MCP route selection, body reads, protocol handling, or MCP server creation. Invalid credentials receive 401 invalid_token; an authenticated caller without the operation permission receives 403 insufficient_scope.

The server never forwards the bearer to tools, the kernel, logs, evidence, or protocol state. Each request receives only the sanitized principal, workspace, resource, and permission set and creates a fresh server instance. Successful transport admission does not bypass downstream kernel ownership, scope, policy, approval, or evidence checks.

The protected-resource metadata endpoint is the public RFC 9728 exception. It is derived from the resource URL: for https://runtime.example.com/mcp, use https://runtime.example.com/.well-known/oauth-protected-resource/mcp. All other MCP HTTP routes require authentication.

The web HTTP surface uses the same signed credential and permission model, but its deployment variables are:

LUMENFLOW_WEB_HTTP_ISSUER=https://issuer.example.com
LUMENFLOW_WEB_HTTP_RESOURCE=https://runtime.example.com
LUMENFLOW_CONTROL_PLANE_SIGNING_KEY=replace-with-a-strong-secret

The web runtime reads the exact workspace ID from workspace.yaml. GET /api/health without a credential is intentionally public but returns only { "success": true, "status": "ok" }. Presenting a credential opts into authentication: an invalid credential is rejected, and detailed diagnostics are returned only after successful authentication.

Once configured, your AI assistant can use LumenFlow tools directly.

Local stdio:
AI uses: context_get {}
AI uses: agent_resolve { "wu": "WU-123", "client": "codex-cli" }

Authenticated HTTP with task:read:
AI uses: task_inspect { "task_id": "WU-123" }

agent_resolve is planner-only. It reports requested/resolved routing and explicitly marks host application unattested; it never claims that a host applied a model or reasoning setting.

The AI can check current context at any time:

AI uses: context_get {}

Result: {
  "location": { "type": "worktree", ... },
  "wu": { "id": "WU-123", "status": "in_progress" }
}

AI assistants can read canonical methodology evidence via resources:

Read resource: lumenflow://methodology/contract
Read resource: lumenflow://methodology/skills
Read resource: lumenflow://methodology/skills/design-first

Each result includes canonical path/version and SHA-256 digest evidence. An individual skill URI can include ?digest=sha256:... to reject stale content. Reads are confined to the project contract and methodology skill roots; traversal and symlink escapes fail closed. Caller memory and synthetic briefs remain advisory and cannot elevate authority.

lumenflow://wu/{id} is available over authenticated HTTP with task:read. The legacy lumenflow://context and lumenflow://backlog resources remain hidden typed exclusions while their runtime migration is pending.

ApproachBest ForWhen to Use
MCPProgrammatic AI interactionAI clients with MCP support
CLIHuman operators, scriptsTerminal workflows, CI/CD
File-basedUniversal AI compatibilityAny AI that can read markdown

Check: Is the package installed?

pnpm list @hellmai/lumenflow-mcp

Check: Can you start the installed binary? A healthy stdio server waits for an MCP client; stop the manual process after confirming it stays running without a discovery error.

pnpm exec lumenflow-mcp

Check: Is MCP enabled in your AI client?

Check: Does the project-owned host configuration use the command and arguments above?

Check: Are there any errors in the AI client logs?

Check: Is LUMENFLOW_PROJECT_ROOT set correctly?

Fix: Use explicit path or ensure the AI client is opened in the project directory.

Check: Does the user running the AI client have access to the project?

Check: Are all LumenFlow files readable?

The MCP server:

  • Lists only capabilities callable under the current transport/auth mode
  • Confines canonical methodology resource reads to project-owned roots
  • Respects all LumenFlow workflow rules (worktree discipline, gates)
  • Cannot bypass safety hooks or constraints
  • Authenticates remote HTTP before MCP route, body, protocol, or state work
  • Separates transport permissions from kernel tool scopes
  • Never treats request-body authority fields as caller identity
  • Never passes a remote bearer credential into the kernel or evidence

For custom integrations:

import { createMcpServer } from '@hellmai/lumenflow-mcp';

const server = createMcpServer({
  projectRoot: '/path/to/project',
  logLevel: 'debug',
});

// List tools
console.log(server.listTools());

// List resources
console.log(server.listResources());
console.log(server.listResourceTemplates());

// Start the server
await server.start();

Gates can take longer to run. The default timeout for gates_run is 10 minutes. This is configured in the tool implementation and cannot be overridden via MCP.