Skip to content

MCP servers

Setting up MCP servers is usually the roughest part of onboarding onto a repo. One server needs Node 24, another needs Python 3.13 and uv, a third expects you to run an init command first, and a fourth lives behind an HTTP endpoint.

OpenLune supports three ways to declare MCP servers under mcp:—managed local servers, external local servers, and remote HTTP servers—so you can pick the level of automation each server needs.

1. Managed local servers (stdio + install)

Section titled “1. Managed local servers (stdio + install)”

If you want contributors to get a working MCP server without manually installing Node, Python, or npm/PyPI packages first, add an install block:

mcp:
codegraph:
transport: stdio
command: codegraph
args: [serve, --mcp]
install:
tools:
- tool: node
version: "24.22.3"
- tool: npm:@colbymchenry/codegraph
version: "1.6.0"

When you run openlune apply, OpenLune provisions the declared tools automatically:

  • Completely isolated. Managed tools live in private storage (.openlune/provision/ on macOS/Linux, or %LocalAppData%\openlune on Windows to stay well under path-length limits) with their own HOME and PATH. They never read or interfere with a contributor’s global Node, Python, or shell setup.
  • Broad runtime & package support. tool and version follow mise tool syntax—core runtimes (node, python, go), npm packages (npm:...), Python packages (pipx:... or uv), Cargo, GitHub releases (github:...), and more.
  • Fast, predictable reuse. Re-running openlune apply reuses a verified installation instead of reinstalling or silently upgrading packages. Changing args, env, or rotating a secret updates the launch config without touching the installed tools.
  • Direct launch at runtime. Once installed, OpenLune saves the resolved executable path and environment. When your AI client starts the server, it invokes openlune mcp run --root <repo> --server <id>, which launches the server directly from saved state without reading the manifest or touching the network.

If install.tools downloads from a private npm or PyPI registry, pass credentials or registry settings under install.env and install.envFrom:

mcp:
internal-docs:
transport: stdio
command: internal-docs-mcp
install:
tools:
- tool: node
version: "24.22.3"
- tool: npm:@acme/internal-docs-mcp
version: "2.1.0"
env:
NPM_CONFIG_REGISTRY: https://npm.internal.example
envFrom:
NPM_TOKEN: [secret:acme-npm-token, env:NPM_TOKEN]

Variables declared under install.env and install.envFrom are used only while installing tools. They are never written into saved state and never passed to the MCP server when it runs.

2. External local servers (stdio without install)

Section titled “2. External local servers (stdio without install)”

If a tool is already installed on contributors’ machines—or lives right inside your repository (like a local script)—omit install:

mcp:
local-helper:
transport: stdio
command: ./scripts/mcp-helper.sh
args: [--readonly]
env:
LOG_LEVEL: warn

During plan and apply, OpenLune resolves command against the project directory (for relative paths) or the contributor’s PATH, and verifies it exists. Unlike managed servers, external servers inherit the launching process’s environment plus any env and envFrom overrides you declare.

For remote Streamable HTTP MCP servers, use transport: http and url:

mcp:
linear:
transport: http
url: https://mcp.linear.app/mcp

Need static or environment-backed HTTP headers? Use headers for literal values and headersFrom for environment variables:

mcp:
metrics:
transport: http
url: https://mcp.metrics.example/v1
headers:
X-Team: platform
headersFrom:
Authorization: "Bearer ${env:METRICS_TOKEN}"

See Keeping secrets out of Git for how each client handles headersFrom (including Codex and Antigravity caveats). OAuth sign-in and connection lifecycle belong to the AI client itself.

Some MCP servers need a one-time initialization command—like building an index or generating a local database—before the client connects. Declare an initialize block on any stdio server:

mcp:
codegraph:
transport: stdio
command: codegraph
args: [serve, --mcp]
install:
tools:
- tool: node
version: "24.22.3"
- tool: npm:@colbymchenry/codegraph
version: "1.6.0"
initialize:
command: codegraph
args: [init, --yes]

How initializers behave:

  • Runs once in the repository root. On the first openlune apply, after tools are installed, OpenLune runs the initializer command directly (no shell expansion) and records the attempt in .openlune/.
  • Reused across clients. Switching from Copilot to Claude Code in the same checkout does not re-run a successful initializer.
  • Explicit retries and reruns. Initializer side effects cannot be rolled back automatically, so OpenLune never silently retries a failed initializer or silently re-runs a successful one when its inputs change:
    • If an initializer failed or was interrupted, run openlune apply --retry-init <server-id>.
    • If you changed the initializer inputs (or just want to run it again), run openlune apply --rerun-init <server-id>.
  • Environment inheritance. initialize inherits the server’s literal env and can add or override variables with initialize.env. It does not inherit the server’s args. For managed servers, initialize.command must be an executable from install.tools.

You can declare which tools a server should expose to the client using tools:

mcp:
tracker:
transport: stdio
command: tracker-mcp
tools: [search_issues, get_issue]
  • Omitted (or ["*"]): Every tool the server advertises is exposed.
  • Named list ([search_issues, get_issue]): Copilot, Codex, and Antigravity restrict the server to those tools. Claude Code and Grok Build do not support per-server tool filtering, so they expose all tools and OpenLune reports a deviation.
  • Empty list (tools: []): Exposes no tools in Copilot and Codex; Antigravity, Claude Code, and Grok Build cannot express an empty server tool list and report a deviation.

If your manifest uses commit: [...] so contributors don’t need OpenLune installed, local stdio servers are written as plain commands directly into the client’s MCP config instead of running through openlune mcp run. That means install.tools, initialize, and secret: sources have no effect for committed entries. See To commit or not commit? for the full trade-off.