[P1] Add declarative MCP server facts with install and run predicates #52
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Represent MCP servers as ordinary inspectable Prolog facts and provide explicit predicates to install and run each declared server through a hard host-controlled execution boundary.
This belongs with the external tool/MCP integration layer, not as hard-coded concrete tool behavior in
prolog-rlmcore.Final state — 2026-08-17
PR #60 (
3db30d832f9b124d6b6e6aa3cbe2808914f4ae6e) landed the initial declarative lifecycle.PR #66 (
9ba763d248f6e087b3ff01c651762997f02ee726) landed the inert externalmcpcategory/loading boundary.PR #72 finishes the remaining declaration-security and host execution-policy acceptance:
mcp_server/2facts plus sanitized discovery;env_ref/1andconfig_ref/1configuration references;dangerousskips interactive approval only and cannot bypass execution-profile allow-lists or hard validation;The final PR #72 head
8e9ce1a053409f82deffe26f9f4c93e868725935passed the complete deterministic matrix and, on unchanged-head rerun after one transient free-model core failure, the complete configured REAL OpenRouter matrix usingopenrouter/freeand selected:freemodels.Acceptance criteria
rlmInstallMcpServer(+Server)with structured outcome and canonical async variant.rlmRunMcpServer(+Server)with structured outcome/handle and canonical async variant.mcptool category exposes sanitized MCP management/discovery functionality without automatically starting configured servers.Non-goals retained
rlmLoadTools(mcp)orrlmLoadAllTools.process_runimplementation in this issue.Boundary
These boundaries are intentionally independent.
PR #62 authority-hardening update relevant to MCP:
rlm_authorityinfrastructure rather than an MCP-specific approval subsystem;allow_oncelifecycle execution now records completion/replay instead of leaving the exact fingerprint stuckin_progress;mcp_client_connect_execute/5outcome directly rather than expecting a nonexistent wrapper result.#52 should remain open: final host allowlisted install/run schema, external secret/config references, companion MCP tool-pack/category work, and the remaining lifecycle acceptance surface are not all complete. Also see #63/#64, which block declaring the authority core final.
Authority/lifecycle integration dependency is now complete on canonical
mainvia PR #62, squash merge88b64db41a4c474379a1808b95c761ffc78d9fc2. MCP install/run/stop/restart/connect remain mediated by the shared host authority model and preserve canonical execute -> async Future -> sync-await direction.Keeping #52 open intentionally. Remaining acceptance is still the production-facing declarative layer: final host-controlled installer/package-manager allow-list, first-class config/environment secret references, concrete external
mcploader/category integration without auto-starting servers, and any final stdio/non-stdio declarative fixture/metadata gaps. Do not duplicate those as a new issue unless live implementation shows a genuinely separate defect.PR #66 implements the loader-facing MCP category portion of #52 on top of the existing #60/#62 lifecycle architecture.
Current PR behavior:
mcpcategory through the hardened loader manifest contract;mcpregisters only inert read-only MCP server discovery/inspection tool schemas;rlm_mcp_toolafter an explicit host connection;#52 should remain OPEN after #66 unless further work lands in this PR. The live implementation still permits the older restricted direct
process(Executable, Args, Options)installer representation and rawenv(Env)install options. Finishing the host-controlled installer/package-manager allow-list plus first-class environment/config secret references is a distinct execution/declaration policy slice and should not be smuggled into the loader PR. The final declarative stdio fixture/metadata acceptance should be reconciled with that slice as well.Security-audit follow-up on PR #66: loader-facing MCP inspection now deliberately redacts legacy execution-detail values that may contain inline secrets before #52's first-class config-reference work lands. It reports execution shape (transport/install kind, executable where applicable, argv count, whether cwd/env are present) but not stdio/install argv contents, raw HTTP endpoint text, cwd value, raw env values, or runtime options. A dedicated regression fixture embeds sentinel secret values in stdio argv, installer argv, cwd and env and proves none appear in model-facing
mcp_serversoutput.This reduces exposure at the new loader boundary, but does NOT satisfy the remaining #52 declaration/lifecycle acceptance: raw secret-bearing declarations are still representable internally today, and the installer/package-manager allow-list is still unfinished. #52 remains intentionally open.
PR #66 is now merged on canonical main as
9ba763d248f6e087b3ff01c651762997f02ee726.The external
mcploader category acceptance is landed and validated: category load exposes only inert, capability-gated, sanitized management/discovery schemas; it does not install/start/connect/import servers/tools, grant capabilities, or change authority. The merged security regression also redacts legacy inline-sensitive declaration values from loader-facing inspection.Keeping #52 OPEN. Remaining acceptance is now sharply limited to:
Do not reopen the loader/category work in the next slice unless a regression is found.
PR #72 is the active implementation slice for the remaining #52 acceptance from canonical main
9ba763d248f6e087b3ff01c651762997f02ee726.Current draft architecture:
env_ref/1/config_ref/1references rather than raw environment values;package(Profile, Package, Version)recipes selected against trusted host profiles;dangerousstill cannot bypass profile allow-list or structural validation;The stdio arbitrary-command weakness is being handled here rather than as a duplicate issue because #52's existing acceptance already calls for the final host-allowlisted install/run schema.
PR remains draft. Exact-head deterministic and REAL OpenRouter validation are still required before #52 can close.
Second-pass security audit on PR #72 found and fixed two additional #52-scoped acceptance gaps before calling the head final:
mcp_server_inspect; policy errors now retain safe structural reason/reference metadata but redact malformed raw payloads, with deterministic assertions for raw config/package/version data;working_directoryis now part of the authority operation args so approval/session fingerprints track that exact effect.Issue search found no separate existing defect better scoped than #52 for either item, so they are fixed coherently in #72 rather than duplicated. Exact-head validation is rerunning after these audit fixes.