Skip to content
Closed
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
36 changes: 36 additions & 0 deletions docs/MCP_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,42 @@ Agents should search or gather facts before asserting. Use
agents should recall, and always include a stable dimension, confidence reason,
and evidence.

### Fathom CUA MCP

Maestro can attach the local Fathom computer-use MCP shim as a plugin-managed
stdio server. This keeps desktop-control tools available through the same
Maestro MCP manager and agent tool bridge used for other MCP servers.

Enable it for a local run:

```bash
export MAESTRO_FATHOM_CUA_ENABLED=1
export MAESTRO_FATHOM_CUA_REPO=/path/to/fathom
export MAESTRO_FATHOM_CUA_WORKSPACE_ID=workspace_1
```

Optional runtime settings:

| Variable | Purpose |
| --- | --- |
| `MAESTRO_FATHOM_CUA_MCP_NAME` | MCP server name; defaults to `fathom-cua`. |
| `MAESTRO_FATHOM_CUA_CLIENT_COMMAND` | Installed `fathom-client` command. If omitted and a repo is configured or found, Maestro uses `go run ./cmd/fathom-client`. |
| `MAESTRO_FATHOM_CUA_CLIENT_ARGS_JSON` | Extra JSON string array of `fathom-client` arguments. |
| `MAESTRO_FATHOM_CUA_IPC_ROOT` | Helper IPC root for live desktop actions. |
| `MAESTRO_FATHOM_CUA_SESSION_ID` / `MAESTRO_FATHOM_CUA_TURN_ID` | Receipt lineage IDs propagated into Fathom. |
| `MAESTRO_FATHOM_CUA_DISABLE_IPC` | Set to `1` for negotiation/tool-list checks without Helper IPC. |

To prove the full local path, run the live smoke on a Mac with Accessibility
permission granted:

```bash
MAESTRO_RUN_LIVE_FATHOM_CUA_MCP=1 npm run smoke:fathom-cua-mcp
```

The smoke opens Fathom's local AppKit dogfood target, connects `fathom-cua`
through Maestro's MCP manager, calls `get_app_state`, executes `set_value`, and
verifies the application state changed without printing the raw typed value.

## Creating a Custom MCP Server

### Minimal TypeScript Server
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@
"smoke": "node scripts/smoke-cli.js",
"smoke:local-e2e": "node scripts/smoke-cli.js",
"smoke:codex-app-server-live": "node scripts/smoke-codex-app-server-live.mjs",
"smoke:fathom-cua-mcp": "tsx scripts/smoke-fathom-cua-mcp.ts",
"smoke:event-bus": "tsx scripts/smoke-maestro-event-bus.ts",
"smoke:a2a-local": "tsx scripts/smoke-maestro-a2a-local.ts",
"smoke:a2a-local-swarm": "tsx scripts/smoke-maestro-a2a-local-swarm.ts",
"smoke:a2a-input-required": "tsx scripts/smoke-maestro-a2a-input-required.ts",
"smoke:a2a-tmux": "bash scripts/smoke-maestro-a2a-tmux.sh",
"a2a": "tsx src/cli.ts a2a",
"a2a:codex-bridge": "python3 scripts/codex-a2a-bridge.py",
"a2a:peer": "tsx src/cli.ts a2a",
"smoke:headless": "node scripts/smoke-headless.js",
"smoke:exec-replay-e2e": "node scripts/smoke-exec-replay-e2e.js",
"headless:responsiveness": "node scripts/headless-responsiveness-harness.js",
"smoke:pack": "node scripts/smoke-packed-cli.js",
"smoke:a2a-input-required": "tsx scripts/smoke-maestro-a2a-input-required.ts",
"smoke:a2a-tmux": "bash scripts/smoke-maestro-a2a-tmux.sh",
"a2a": "tsx src/cli.ts a2a",
"a2a:codex-bridge": "python3 scripts/codex-a2a-bridge.py",
"a2a:peer": "tsx src/cli.ts a2a",
"smoke:headless": "node scripts/smoke-headless.js",
"headless:responsiveness": "node scripts/headless-responsiveness-harness.js",
"smoke:pack": "node scripts/smoke-packed-cli.js",
"metadata:sync": "node scripts/sync-package-metadata.js",
"metadata:check": "node scripts/sync-package-metadata.js --check",
"cutover:check": "node scripts/check-package-cutover-readiness.js",
Expand Down
24 changes: 11 additions & 13 deletions scripts/check-smoke-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ if (entryPoints.length === 0) {
process.exit(0);
}

for (const entryPoint of entryPoints) {
await build({
bundle: true,
entryPoints: [entryPoint],
external: ["tree-sitter", "tree-sitter-bash"],
format: "esm",
logLevel: "silent",
packages: "external",
platform: "node",
target: "node20",
write: false,
});
}
await build({
bundle: true,
entryPoints,
external: ["tree-sitter", "tree-sitter-bash"],
format: "esm",
logLevel: "silent",
packages: "external",
platform: "node",
target: "node20",
write: false,
});

console.log(`Checked ${entryPoints.length} smoke script(s).`);
1 change: 1 addition & 0 deletions scripts/ci-nx-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ run_ci_guardrail_tests() {
run_smoke_script_static_checks() {
local smoke_scripts=()
while IFS= read -r file; do
[[ -f "$file" ]] || continue
smoke_scripts+=("$file")
done < <(grep -E '^scripts/smoke-[^/]+\.[cm]?[jt]sx?$' "$changed_files_log" || true)
if [[ "${#smoke_scripts[@]}" -eq 0 ]]; then
Expand Down
109 changes: 0 additions & 109 deletions scripts/install-smoke-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// @ts-check

import { execFileSync } from "node:child_process";
import { readFileSync } from "node:fs";
import { join } from "node:path";

export function getNpmCommand() {
return process.platform === "win32" ? "npm.cmd" : "npm";
Expand All @@ -11,115 +9,8 @@

export function getNpxCommand() {
return process.platform === "win32" ? "npx.cmd" : "npx";
}

Check failure on line 12 in scripts/install-smoke-utils.js

View workflow job for this annotation

GitHub Actions / unresolved-review-threads / unresolved-review-threads

unresolved P1 review thread

Check failure on line 12 in scripts/install-smoke-utils.js

View workflow job for this annotation

GitHub Actions / unresolved-review-threads / unresolved-review-threads

unresolved P1 review thread

Comment thread
haasonsaas marked this conversation as resolved.
Resolved

export function getBunCommand() {
return process.platform === "win32" ? "bun.exe" : "bun";
}

export function installedPackageJsonPath(packageName, installRoot) {
return join(
installRoot,
"node_modules",
...packageName.split("/"),
"package.json",
);
}

export function installedBinPath(installRoot, cliCommand) {
return process.platform === "win32"
? join(installRoot, "node_modules", ".bin", `${cliCommand}.cmd`)
: join(installRoot, "node_modules", ".bin", cliCommand);
}

export function readInstalledPackageJson(packageName, installRoot) {
const packageJsonPath = installedPackageJsonPath(packageName, installRoot);
try {
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
throw new Error("installed package.json did not contain an object");
}
return parsed;
} catch (error) {
const reason =
error instanceof Error ? error.message : "unknown package read error";
throw new Error(
`Could not read installed package metadata at ${packageJsonPath}: ${reason}`,
);
}
}

function arrayValues(value) {
return Array.isArray(value)
? value.filter((entry) => typeof entry === "string" && entry.length > 0)
: [];
}

function objectEntries(value) {
return value && typeof value === "object" && !Array.isArray(value)
? Object.entries(value)
: [];
}

export function assertInstallablePackageMetadata(
installedPackage,
{ label, forbiddenWorkspaceNames = [] },
) {
const forbiddenNames = new Set(forbiddenWorkspaceNames);
const offenders = [];
for (const section of [
"dependencies",
"optionalDependencies",
"peerDependencies",
]) {
for (const [name, spec] of objectEntries(installedPackage[section])) {
if (forbiddenNames.has(name)) {
offenders.push(`${section}.${name}`);
}
if (typeof spec === "string" && spec.startsWith("workspace:")) {
offenders.push(`${section}.${name}=workspace:`);
}
}
}

for (const section of ["bundleDependencies", "bundledDependencies"]) {
for (const name of arrayValues(installedPackage[section])) {
if (forbiddenNames.has(name)) {
offenders.push(`${section}.${name}`);
}
}
}

if (offenders.length > 0) {
throw new Error(
`${label} exposes non-registry workspace metadata: ${offenders
.sort()
.join(", ")}`,
);
}
}

export function runInstalledCliSmoke(
cwd,
{ cliCommand, expectedVersion, label },
) {
const binPath = installedBinPath(cwd, cliCommand);
const versionOutput = execFileSync(binPath, ["--version"], {
cwd,
encoding: "utf8",
});
if (!versionOutput.includes(expectedVersion)) {
throw new Error(
`Expected ${label} ${cliCommand} --version output to include ${expectedVersion}, received: ${versionOutput.trim()}`,
);
}

execFileSync(binPath, ["--help"], {
cwd,
stdio: "ignore",
});
}

function parseAuditJson(output) {
try {
return JSON.parse(output);
Expand Down
1 change: 0 additions & 1 deletion scripts/plan-ci-checks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ function isProofHarnessPath(path) {
CI_GUARDRAIL_FILES.has(path) ||
isFastPrChecksInfrastructurePath(path) ||
(path.startsWith("docs/") && path.endsWith(".md")) ||
isPackageManifest(path) ||
isSmokeScript(path)
);
}
Expand Down
18 changes: 9 additions & 9 deletions scripts/release-readiness.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
const mode = process.argv[2] ?? "release";
const rootPackage = loadRootPackage();

function run(command, env = {}) {
function run(command) {
console.log(`$ ${command}`);
execSync(command, { stdio: "inherit", env: { ...process.env, ...env } });
execSync(command, { stdio: "inherit" });
}

function hasScript(name) {
Expand All @@ -32,6 +32,12 @@
console.log("Skipping packed CLI smoke test (script missing)");
return;
}
if (!shouldManagePackageLock(rootPackage)) {
console.log(
"Skipping packed CLI smoke test (package is not npm-installable from a tarball in this repo)",
);
return;

Check failure on line 39 in scripts/release-readiness.js

View workflow job for this annotation

GitHub Actions / unresolved-review-threads / unresolved-review-threads

unresolved P1 review thread

Comment thread
haasonsaas marked this conversation as resolved.
Resolved
}

const tarball = execSync("npm pack --silent", { encoding: "utf8" })
.trim()
Expand All @@ -43,10 +49,7 @@
}

try {
run(`node scripts/smoke-packed-cli.js "${tarball}"`, {
MAESTRO_INSTALL_AUDIT_LEVEL:
process.env.MAESTRO_INSTALL_AUDIT_LEVEL ?? "critical",
});
run(`node scripts/smoke-packed-cli.js "${tarball}"`);
} finally {
rmSync(resolve(process.cwd(), tarball), { force: true });
}
Expand All @@ -58,8 +61,6 @@
run("bun run bun:lint");
run("npm run build");
run("npm run verify:runtime-deps");
runPackSmoke();
maybeRunScript("smoke:exec-replay-e2e");
maybeRunScript("openapi:check");
}

Expand All @@ -77,7 +78,6 @@
console.log("Skipping npm audit (package-lock not managed in this repo)");
}
runPackSmoke();
maybeRunScript("smoke:exec-replay-e2e");
}

switch (mode) {
Expand Down
5 changes: 0 additions & 5 deletions scripts/smoke-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const commands = [
cmd: "node",
args: ["scripts/smoke-headless.js"],
},
{
name: "exec-replay-e2e",
cmd: "node",
args: ["scripts/smoke-exec-replay-e2e.js"],
},
{
name: "mock-agent-read",
cmd: "node",
Expand Down
Loading
Loading