MCP Server
The Ledger MCP server is an optional, read-only Model Context Protocol server. It lets MCP clients, such as AI assistants like Claude Code, Copilot, or Cursor, query Ledger data through a small set of tools. You can then ask questions such as "which hosts are affected by this CVE?" in plain language.
The server is read-only by design: every tool maps to a GET request to the Ledger REST API, so an assistant can never change anything in Ledger through it.
How it works
The MCP server does not connect to the Ledger database. It is a thin proxy in front of the REST API served by the Ledger web service:
MCP client ──MCP (streamable HTTP)──▶ ledger-mcp ──REST GET──▶ Ledger web service ──▶ database
- It runs as its own container, from the
ledger-mcpimage published alongside the other Ledger images. - It serves the MCP streamable HTTP transport in stateless mode, so each request is self-contained.
- Each tool calls the REST API and returns the JSON result. A REST error is returned to the assistant as a tool error with the API's status and reason, for example
403 Forbidden: ACCESS DENIED.
Because it reuses the REST API, everything the API enforces applies unchanged: each user's permissions, the API row limit, masking of secrets in the settings output, and the local password policy.
Authentication
The MCP server holds no credentials of its own. Each MCP client signs in with its own Ledger identity, and the server passes those credentials through to the REST API:
- The client sends an
Authorization: Basicheader (a base64-encodedusername:password) on its MCP requests: the same credentials it would use with the REST API directly. - The server forwards the header unchanged on every REST request, and never stores or substitutes credentials.
- The REST API checks the user's permissions, so a tool only returns what that user is allowed to see. Two users connected to the same MCP server see different, correctly scoped results.
- A request without credentials is refused with an error asking the caller to authenticate, and no REST call is made. There is no anonymous access. Invalid credentials are rejected by the REST API.
Only local accounts can authenticate this way, because the REST API verifies the password against the account's stored password. LDAP, SAML, and OpenID Connect accounts have no local password. Give each assistant integration a dedicated local account with only the permissions it needs. The local password policy applies: if the account's password expires or must be changed, the tools return 403 PASSWORD CHANGE REQUIRED until it is changed in the web interface.
Available tools
| Tool | Arguments | Permission |
|---|---|---|
list_resources | None | Any |
list_hosts | page, limit | View Hosts |
get_host | id | View Hosts |
get_elm_host_packages | uuid | View Packages |
get_elm_host_facts | uuid | View Facts |
list_facts | page, limit, host, fact, type | View Facts |
list_changes | page, limit, host, playbook, task_action, search | View Changes |
get_change | id | View Changes |
list_packages | page, limit, host, name, arch, errata | View Packages |
list_package_log | page, limit, host, name, arch, action | View Package Logs |
list_services | page, limit, host, name, state, status | View Services |
list_service_log | page, limit, host, name, state, status | View Service Logs |
get_cve | cve | View Errata (plus View Hosts and View Packages for the affected hosts list) |
get_errata | name, vendor | View Errata |
list_reports | page, limit | View Reports |
get_report | id | View Reports |
list_servers | page, limit | Administrator |
get_server | id | Administrator |
list_users | page, limit | Administrator |
get_user | id | Administrator |
get_settings | None | Administrator |
Notes:
list_resourcesreturns the resource types the calling user can read, so an assistant can find out up front which tools will work for that user.- The
list_*tools are paginated and honor Row Limit for API Queries under Settings > Visual. Theget_*tools return the whole resource in one call. list_packagestakeserrata: trueto list only packages with outstanding advisories.list_package_logaccepts anactionofaddedorremoved.get_cvereturns the CVE's details and fixing advisories and, for a user who also has the View Hosts and View Packages permissions, every affected host with the installed packages involved.get_erratatakes an optionalvendor, because an advisory name is unique only per vendor.get_elm_host_packagesandget_elm_host_factslook a host up by the UUID that the CIQ Enterprise Linux Manager agent assigns, and return its complete package or fact list.list_reportsandget_reportonly return reports shared with the calling user.- The
hostfilter of the list tools takes a numeric host ID. Uselist_hoststo find it.
Running the MCP server
The Ascender Pro installer does not deploy the MCP server. To use it, run the ledger-mcp image (from the same registry as your other Ledger images) where it can reach the Ledger web service, and configure it with these environment variables:
| Variable | Default | Purpose |
|---|---|---|
MCP_PORT | 8085 | Port the MCP endpoint listens on. The endpoint is served at /. |
LEDGER_API_URL | http://ledger-web | Base URL of the Ledger web service. In the same Kubernetes cluster as an Ascender Pro installation, this is the web-svc service in the Ledger namespace, for example http://web-svc.ledger. |
On startup the server logs a line such as ledger MCP server (read-only) ... listening on :8085, proxying http://ledger-web.

To check it end to end without an MCP client, send a tool call with curl. This exercises the MCP endpoint, the credential pass-through, and the REST API in one request:
curl -s http://127.0.0.1:8085/ \
-u "$USER_NAME:$PASSWORD" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_hosts","arguments":{"limit":2}}}'
The response is a server-sent event whose data: line carries the JSON-RPC result. The tool's output is under result.structuredContent.
Securing the MCP server
- Put TLS in front of the endpoint. The server speaks plain HTTP, and credentials travel in the
Authorizationheader, so it must sit behind TLS (for example, a reverse proxy or an ingress with a certificate) whenever it can be reached from anywhere other than the local machine. Never expose it over plain HTTP. - Do not publish the port publicly. Keep the server on an internal network, or bind its published port to loopback, until a TLS proxy and firewall are in place.
- Use least-privilege accounts. There is no shared or elevated account to leak: each caller has exactly its own read permissions, and the tools are read-only. Give each assistant integration its own local account with only the permissions it needs.
Connecting a client
Point the client at the MCP server's URL (for example http://127.0.0.1:8085/, or the TLS URL you publish) using the streamable HTTP transport, and attach a Basic Authorization header. The client must be able to send a custom header.
For example, with Claude Code:
claude mcp add --transport http ledger http://127.0.0.1:8085/ \
--header "Authorization: Basic $(printf '%s:%s' "$USER_NAME" "$PASSWORD" | base64 -w0)"
The equivalent entry for clients that read an mcpServers map in JSON:
{
"mcpServers": {
"ledger": {
"type": "http",
"url": "http://127.0.0.1:8085/",
"headers": { "Authorization": "Basic <base64(username:password)>" }
}
}
}
In Claude Code, claude mcp list shows the server as Connected (it performs a real handshake, so a wrong URL or a closed port shows up here), and claude mcp get ledger prints the stored configuration. Add --scope user to claude mcp add to make the server available in every project, and use claude mcp remove ledger to remove it.

Using Ledger from an assistant
Once connected, the assistant sees the tools listed above and chooses them itself. Claude Code prefixes the tool names with the server name, for example mcp__ledger__list_hosts. Some questions that work well:
- "Which hosts have critical security advisories outstanding?" uses
list_hosts, where each host carries its advisory counts by severity. - "Which of our hosts are affected by CVE-2026-1234, and which packages need updating?" uses
get_cve. - "What changed on web01 in the last playbook run?" uses
list_hoststo find the host ID, thenlist_changesandget_change. - "Show me the kernel packages across the fleet and whether an advisory covers them." uses
list_packageswithnameanderrata: true. - "Is the httpd service running everywhere it should be?" uses
list_services. - "What does the web-inventory report contain?" uses
list_reports, thenget_report.

What to expect:
- Answers are limited to what the account in the header may see. A user without View Hosts gets
403 Forbidden: ACCESS DENIEDfromlist_hosts, and the assistant usually says so. - Nothing is changed. The assistant cannot edit users, servers, or settings through the MCP server, whatever it is asked.
- A missing
Authorizationheader is an error, not an anonymous request.