Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 82 additions & 70 deletions packages/loopover-miner/bin/loopover-miner-mcp.d.ts
Original file line number Diff line number Diff line change
@@ -1,74 +1,86 @@
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { EventLedger } from "../lib/event-ledger.js";
import type { PredictionLedgerEntry } from "../lib/prediction-ledger.js";

/** The static, non-secret payload the loopover_miner_ping tool always returns, independent of input. */
export const MINER_PING_STATUS: { status: "ok"; tool: "loopover_miner_ping" };

#!/usr/bin/env node
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { type EventLedger } from "../lib/event-ledger.js";
import { type PredictionLedgerEntry } from "../lib/prediction-ledger.js";
/** The static, non-secret payload the ping tool always returns, independent of any input or AMS state. */
export declare const MINER_PING_STATUS: {
status: string;
tool: string;
};
export interface MinerMcpServerOptions {
/**
* Override the portfolio-queue store opener (defaults to the real on-disk store); injection seam for tests.
* Typed to the minimal read surface the dashboard tool uses, mirroring runPortfolioDashboard's own seam.
*/
initPortfolioQueue?: () => { listQueue(repoFullName?: string | null): unknown[]; close(): void };
/**
* Override the claim-ledger opener (defaults to the real on-disk ledger); injection seam for tests. Typed to
* the minimal read surface the list-claims tool uses.
*/
openClaimLedger?: () => {
listClaims(filter?: { repoFullName?: string | null; status?: string | null }): unknown[];
close(): void;
};
/** Override the clock used for the oldest-queued age (defaults to Date.now()); injection seam for tests. */
nowMs?: number;
/** Override the event-ledger opener (defaults to initEventLedger); injection seam for tests. */
initEventLedger?: () => EventLedger;
/**
* Override the run-state store opener (defaults to the real on-disk store); injection seam for tests. Typed to
* the minimal read surface the run-state tool uses (never setRunState).
*/
initRunStateStore?: () => {
getRunState(repoFullName: string): unknown;
listRunStates(): unknown[];
close(): void;
};
/**
* Override the plan-store opener (defaults to the real on-disk store); injection seam for tests. Typed to the
* minimal read surface the plan tools use (never savePlan).
*/
openPlanStore?: () => {
loadPlan(planId: string): unknown;
listPlans(filter?: { status?: string | null }): unknown[];
close(): void;
};
/**
* Override the governor-ledger opener (defaults to the real on-disk ledger); injection seam for tests. Typed
* to the minimal read surface the decisions tool uses (the payload-excluding readGovernorDecisions).
*/
initGovernorLedger?: () => {
readGovernorDecisions(filter?: { repoFullName?: string | null }): unknown[];
close(): void;
};
/** Override the status reader (defaults to status.js's collectStatus); injection seam for tests. */
collectStatus?: () => unknown;
/** Override the doctor-checks reader (defaults to status.js's runDoctorChecks); injection seam for tests. */
runDoctorChecks?: () => unknown[];
/**
* Override the prediction-ledger opener (defaults to the real on-disk ledger); injection seam for tests. Typed
* to the minimal read surface the calibration-report tool uses (never appendPrediction).
*/
initPredictionLedger?: () => {
readPredictions(filter?: { repoFullName?: string | null }): PredictionLedgerEntry[];
close(): void;
};
/**
* Override the portfolio-queue store opener (defaults to the real on-disk store); injection seam for tests.
* Typed to the minimal read surface the dashboard tool uses, mirroring runPortfolioDashboard's own seam.
*/
initPortfolioQueue?: () => {
listQueue(repoFullName?: string | null): unknown[];
close(): void;
};
/**
* Override the claim-ledger opener (defaults to the real on-disk ledger); injection seam for tests. Typed to
* the minimal read surface the list-claims tool uses.
*/
openClaimLedger?: () => {
listClaims(filter?: {
repoFullName?: string | null;
status?: string | null;
}): unknown[];
close(): void;
};
/** Override the clock used for the oldest-queued age (defaults to Date.now()); injection seam for tests. */
nowMs?: number;
/** Override the event-ledger opener (defaults to initEventLedger); injection seam for tests. */
initEventLedger?: () => EventLedger;
/**
* Override the run-state store opener (defaults to the real on-disk store); injection seam for tests. Typed to
* the minimal read surface the run-state tool uses (never setRunState).
*/
initRunStateStore?: () => {
getRunState(repoFullName: string): unknown;
listRunStates(): unknown[];
close(): void;
};
/**
* Override the plan-store opener (defaults to the real on-disk store); injection seam for tests. Typed to the
* minimal read surface the plan tools use (never savePlan).
*/
openPlanStore?: () => {
loadPlan(planId: string): unknown;
listPlans(filter?: {
status?: string | null;
}): unknown[];
close(): void;
};
/**
* Override the governor-ledger opener (defaults to the real on-disk ledger); injection seam for tests. Typed
* to the minimal read surface the decisions tool uses (the payload-excluding readGovernorDecisions).
*/
initGovernorLedger?: () => {
readGovernorDecisions(filter?: {
repoFullName?: string | null;
}): unknown[];
close(): void;
};
/** Override the status reader (defaults to status.js's collectStatus); injection seam for tests. */
collectStatus?: () => unknown;
/** Override the doctor-checks reader (defaults to status.js's runDoctorChecks); injection seam for tests. */
runDoctorChecks?: () => unknown[];
/**
* Override the prediction-ledger opener (defaults to the real on-disk ledger); injection seam for tests. Typed
* to the minimal read surface the calibration-report tool uses (never appendPrediction).
*/
initPredictionLedger?: () => {
readPredictions(filter?: {
repoFullName?: string | null;
}): PredictionLedgerEntry[];
close(): void;
};
}

/**
* Build the miner MCP server with its tools registered (loopover_miner_ping,
* loopover_miner_get_portfolio_dashboard, loopover_miner_get_manage_status, loopover_miner_list_claims,
* loopover_miner_get_audit_feed, loopover_miner_get_run_state, loopover_miner_list_plans,
* loopover_miner_get_plan, loopover_miner_get_governor_decisions, loopover_miner_status,
* loopover_miner_get_calibration_report). `options` supplies test injection seams; production callers
* pass nothing.
* Build the miner MCP server with its tools registered. `options.initPortfolioQueue`, `options.openClaimLedger`,
* `options.initEventLedger`, `options.initRunStateStore`, `options.openPlanStore`, `options.initGovernorLedger`,
* `options.collectStatus`, `options.runDoctorChecks`, and `options.nowMs` are injection seams for tests (default
* to the real stores/readers and the wall clock); the ping tool needs none. Each store-backed tool opens its
* store only when invoked and closes any store it opened.
*/
export function createMinerMcpServer(options?: MinerMcpServerOptions): McpServer;
export declare function createMinerMcpServer(options?: MinerMcpServerOptions): McpServer;
Loading