Skip to main content
Glama

Union MCP

English | 繁體中文

Node.js TypeScript MCP Tools Platform License: MIT

A lightweight, native local Model Context Protocol (MCP) host that delivers mandatory rules before protected operations, maintains durable operation receipts across restarts, and connects local or web AI agents (ChatGPT, Gemini, Claude, Cursor, Codex) to your Windows machine without virtual OS layers or wrapper runtimes.

WARNING

Security boundary: Union MCP executes with your native local OS user permissions. It is not an OS sandbox. Never expose its HTTP server directly to the public internet; always keep HTTP bound to 127.0.0.1 behind Cloudflare Tunnel and Cloudflare Access OAuth (or use OpenAI Secure MCP Tunnel over stdio). See SECURITY.md.


Setup with an AI Agent

If you use a coding agent (Claude Code, Codex, Cursor, Antigravity, etc.), paste this prompt to install, build, test, and configure Union MCP automatically using the concise agent runbook:

Read https://github.com/Evanlau1798/union-mcp/blob/main/docs/agent-setup.md (or docs/agent-setup.md after cloning) and follow it step by step to install, build, test, and configure Union MCP on this Windows machine. Stop and ask me before entering credentials, OAuth flows, domains, or optional provider paths.

See docs/agent-setup.md for the complete agent runbook.


Related MCP server: rvn

Key Features

  • Document-First Reading Gate: Agents must open a task context and read all applicable core, project (AGENTS.md / AGENTS.override.md), and capability guides to EOF before protected file, process, or provider operations execute. Content is verified by SHA-256 hash on continuation and admission.

  • Native Windows Execution without Wrappers: Runs directly on Node.js with native Windows drive/UNC paths, exact executable + argv launches, discovered PowerShell/shell commands, interactive stdin, output spools, and owned process-tree cancellation. No WSL, Bash emulation, or Docker layer required.

  • Durable Receipts and Deduplication: Side-effecting calls require a stable operation_id, persist receipts with SQLite inter-process locks (node:sqlite), prevent silent replays of unknown outcomes, and support receipt inspection after host restarts.

  • Fixed 22-Tool Interface: Exposes a predictable catalog of 9 read-only tools and 13 action tools covering files, native processes, skills, downstream MCP servers (stdio and loopback Streamable HTTP, including multi-project Unity workflows), Codex sessions, Ego Browser, Desktop automation, and read-only Antigravity history.

  • Local stdio and Authenticated Remote HTTP: Works out of the box over stdio for local MCP clients and OpenAI Secure MCP Tunnel, or as a loopback-only stateless Streamable HTTP server (POST /mcp) protected by Cloudflare Access RS256 JWT verification for Gemini Web.

  • Duplicate-Safe Windows Logon Autostart: Includes native PowerShell Task Scheduler scripts that start only missing services using cross-session mutexes, exact executable/argument identity checks, process-tree port verification, and Windows DPAPI token decryption.


Architecture

flowchart LR
    subgraph Clients["MCP Clients"]
        Local["Local MCP Clients (Claude / Cursor / Codex)"]
        ChatGPT["ChatGPT Web"]
        Gemini["Gemini Web"]
    end

    subgraph Transports["Secure Transports"]
        Stdio["Local stdio"]
        OpenAITunnel["OpenAI Secure MCP Tunnel (stdio)"]
        CFTunnel["Cloudflare Tunnel + Access OAuth (RS256 JWT)"]
    end

    subgraph Host["Union MCP Host (Node.js)"]
        Gate["Document-First Gate + Context Store"]
        Store["Durable Receipts + SQLite Lock + Output Spool"]
    end

    subgraph Capabilities["Built-in & Optional Providers"]
        Native["Files, Search, Run, Jobs, Skills"]
        Downstream["Downstream MCP (stdio / loopback HTTP)"]
        History["Antigravity Read-Only History"]
        Optional["Optional: Codex, Ego Browser, agent-desktop / cua-driver"]
    end

    Local --> Stdio --> Gate
    ChatGPT --> OpenAITunnel --> Gate
    Gemini --> CFTunnel --> Gate
    Gate <--> Store
    Gate --> Native
    Gate --> Downstream
    Gate --> History
    Gate --> Optional

Quick Start (Local stdio)

Prerequisites

  • OS: Windows 10 or Windows 11 (primary tested platform; non-Windows environments are unverified)

  • Node.js: ^22.13.0 or >=23.4.0 (required for unflagged built-in node:sqlite; Node 20 is not supported)

1. Clone, Install, Build, and Test

Run in native PowerShell:

git clone https://github.com/Evanlau1798/union-mcp.git
cd union-mcp
npm.cmd ci --ignore-scripts --no-audit --no-fund
npm.cmd run typecheck
npm.cmd run build
npm.cmd test

2. Configure Your MCP Client

Point your MCP client at the compiled dist\server.js using exact absolute paths (template: examples/mcp-client.example.json):

{
  "mcpServers": {
    "union-mcp": {
      "command": "C:\\Program Files\\nodejs\\node.exe",
      "args": ["C:\\path\\to\\union-mcp\\dist\\server.js"]
    }
  }
}
NOTE

Runningnode dist\server.js directly without UNION_MCP_HTTP_CONFIG starts the stdio MCP server and waits for JSON-RPC messages on stdin. It is not an interactive CLI shell. stdout carries protocol frames only; diagnostics are written to stderr.

3. Verify with a Read-Only Prompt

Once connected in your MCP client, send this verification prompt (replace the path with your local repository path):

Verify the Union MCP connection using read-only operations only:

1. Call context(action="open", cwd="C:/path/to/union-mcp", task="Read-only setup check").
2. Read every document in required_documents to EOF using read and following next_cursor.
3. Read C:/path/to/union-mcp/package.json and report its package name, version, and full snapshot SHA-256.
4. Call task_close to close this context and report context_id, closed, and owned_jobs.

Do not run commands, edit files, or access desktop/browser tools.

A valid verification returns a real context_id, the parsed package fields with a SHA-256 digest, and closed: true.


Tool Catalog (22 Fixed Tools)

Union MCP exposes a fixed catalog (catalog_revision: union-mcp-0.7.0). Optional external providers stay cleanly disabled until their paired environment variables are configured.

Category

Tools

Access

Required Guide(s)

Notes

Context & Gate

context, read, task_close

Mixed

core + project rules

Opens task scope, delivers documents/files via cursors, releases snapshots and owned providers

Discovery & Skills

discover

Read-only

core (+ guide:skills)

Inspects tool schemas, local/configured skill catalogs, and imported MCP previews without spawning providers

Native Files

search, write, edit

Read / Write

core + project rules

UTF-8 search and atomic writes/edits with operation_id deduplication and optional expected_sha256

Native Processes

run, job

Action

guide:native-exec, guide:output

Runs exact executables or discovered shells (oneshot / interactive / service) with spooled output and process-tree cancel

Downstream MCP

mcp

Action

guide:mcp

Previews JSON/TOML configs safely; connects stdio or loopback Streamable HTTP servers (including multi-project Unity)

Codex Sessions

codex_list, codex_status, codex_read, codex_send, codex_resume, codex_stop, codex_watch

Read / Action

guide:codex

Optional; inspects and controls existing Codex Desktop and Windows daemon threads without auto-compaction

Browser

browser_use

Action

guide:browser, guide:native-exec

Optional; runs scoped JavaScript in an explicit Ego Browser TaskSpace after reading the installed Ego guide

Desktop / CUA

computer_use

Action

guide:desktop, guide:native-exec, guide:mcp

Optional; pinned agent-desktop (1.3.1) and supplemental cua-driver (0.70.7) with explicit background/foreground lanes

Antigravity History

antigravity_list, antigravity_status, antigravity_read

Read-only

guide:antigravity

Reads persisted SQLite WAL public messages across app, ide, and cli sources; never controls or wakes sessions

Full tool contracts, capacity limits, and protocol details are documented in docs/tools-and-architecture.md.


Remote Web Access (ChatGPT & Gemini)

Union MCP supports both major web agent platforms with distinct private transport models:

Surface

Recommended Transport

Local Mode

Setup Guide

ChatGPT Web

OpenAI Secure MCP Tunnel

stdio backend

docs/web-mcp-setup.md#2-chatgpt-web

Gemini Web

Cloudflare Tunnel + Cloudflare Access OAuth

Loopback HTTP (POST /mcp)

docs/web-mcp-setup.md#3-gemini-web

Both remote backends can be started automatically at Windows user logon using docs/autostart.md.


Documentation

Document

Description

docs/agent-setup.md

Concise, staged setup runbook designed for AI agents with strict credential guardrails

docs/configuration.md

Complete environment variable reference, local MCP client setup, Skills, and optional providers

docs/web-mcp-setup.md

From-scratch setup for ChatGPT Web (OpenAI Tunnel) and Gemini Web (Cloudflare Tunnel + Access), verification prompts, and known platform limits

docs/autostart.md

Windows Task Scheduler logon autostart, duplicate-safe service startup, and DPAPI token protection

docs/tools-and-architecture.md

Detailed 22-tool reference, document-first gate lifecycle, durable receipts, output spool, and capacity limits

docs/troubleshooting.md

Error code reference, remote connection debugging, schema sync, and provider troubleshooting

examples/

Sanitized configuration templates for MCP clients, HTTP mode, Skill sources, launchers, and Windows autostart

SECURITY.md

Trust boundaries, authentication design, and vulnerability reporting

CONTRIBUTING.md

Development workflow, coding standards, and pull request checklist


Development

npm.cmd run typecheck   # Strict TypeScript type checking
npm.cmd run build       # Compile TypeScript to dist/
npm.cmd test            # Run full test suite (node:test)

License

Licensed under the MIT License.

Available Tools

22 tools
antigravity_listB
Read-only

Search and page the local Antigravity app/ide/cli history index after reading guide:antigravity. Reads persisted SQLite snapshots only; does not contact, start, resume or stop Antigravity. Sources remain separate; returned state is not live execution status.

Inputs: context_id (required), limit, query, offset, +1 more.

antigravity_readA
Read-only

Read only persisted public user/assistant text from one exact Antigravity conversation and source after reading guide:antigravity. Page newest steps with before_step; complete a long message using its next_action before moving to older steps. Excludes thinking, configurations and raw tool output. No session control or app/RPC connection.

Inputs: context_id (required), conversation_id (required), limit, source, +4 more.

antigravity_statusA
Read-only

Read persisted Antigravity metadata for an exact conversation_id and source after reading guide:antigravity. is_live=false and state=unknown; saved run status never proves current execution or termination. Does not wake an app, session or model.

Inputs: context_id (required), conversation_id (required), source.

browser_useA
Destructive

Acquire the installed Ego Browser guide or execute user-authorized JavaScript through the supported task/Page API on one explicit TaskSpace. Browser work can read signed-in pages, navigate, fill forms, click, upload/download files, capture images and submit changes to remote services. Requires the installed guide, exact provider identity and operation ID. Native programs use run; browser source is limited to the supported TaskSpace interface.

codex_listC
Read-only

List bounded candidates from the existing Codex backend. Use offsets for Desktop or the native cursor for the daemon.

Inputs: context_id (required), limit, cursor, offset, +1 more.

codex_readC
Read-only

Read public messages and subagent IDs from the exact local thread with native history cursors.

Inputs: thread_id (required), context_id (required), cursor, turn_id, +7 more.

codex_resumeB
Destructive

Resume one verified existing Codex agent thread with a user-authorized message and a stable operation ID. This can continue autonomous agent work with filesystem, process or external-service effects under that thread permissions. Uses the original thread and delivery receipt; does not create a replacement conversation.

Inputs: message (required), thread_id (required), context_id (required), operation_id (required), +4 more.

codex_sendA
Destructive

Send a user-authorized message to one verified existing Codex agent thread and return its durable delivery receipt. The message can start or steer agent work with filesystem, process or external-service effects under that thread permissions. An accepted receipt is not completion; preserve the original operation ID when checking an unknown outcome.

Inputs: message (required), thread_id (required), context_id (required), operation_id (required), +4 more.

codex_statusB
Read-only

Read the exact thread identity and last native turn from an existing Codex backend without waking it.

Inputs: thread_id (required), context_id (required), execution_backend, backend_instance_id.

codex_stopC
Destructive

Request native user-stop for one verified Codex thread. Requires the current exact target and user authorization.

Inputs: thread_id (required), context_id (required), operation_id (required), expected_title (required), +3 more.

codex_watchC

Start an owned observation job for one exact native Codex turn. Canceling the watch only stops observing.

Inputs: thread_id (required), context_id (required), operation_id (required), expected_title (required), +5 more.

computer_useA
Destructive

Acquire only the selected desktop provider guide; list apps/windows, wait or capture a window in som/vision/ax mode (compact elements by default, detail:full for the tree); or click/double_click/right_click/middle_click, drag, scroll, type, set_value, key, focus_app or set_window_frame on an exact window observation. set_window_frame uses desktop coordinates from capture.window_frame (visible frame), which can differ from window.bounds (outer frame). Input can modify application data or trigger external actions. Background and foreground delivery are explicit. Background AX clicks are supported by the supplemental provider; background pixel gestures are refused before dispatch. set_value uses native units; Slider postcondition reports independent native RangeValue readback separately from uncertain delivery. Requires exact provider identity, current observation and operation ID for input.

contextB

Open, inspect, or refresh a task in the native host. Read every required document with read before file or execution operations. Does not launch providers or version probes.

discoverB
Read-only

Inspect local tool metadata, schemas, skill metadata catalog, or imported/connected MCP server previews without launching providers or executing commands.

Inputs: kind (required), context_id (required), id, query, +1 more.

editA
Destructive

Apply an exact UTF-8 text replacement to an existing file within declared scope using a stable operation_id and optional expected_sha256 check.

Inputs: path (required), context_id (required), new_string (required), old_string (required), +3 more.

jobA
Destructive

Inspect a durable job receipt, read immutable spooled output, cancel owned work, or send gated stdin input to an interactive process. Status/read are observational; cancel can terminate an owned process tree, and input can trigger arbitrary actions in that program. Canceling a watch only ends observation. Use the original job_id or operation_id after an unknown result.

mcpA
Destructive

Preview MCP configuration without execution; connect, refresh or close configured downstream MCP servers; call their tools, read resources or get prompts. Connections can start configured server processes. Downstream tool calls can modify local files, Unity projects, applications or remote services and follow the acquired downstream schema. Requires exact server_id, instance_id, project and catalog_revision binding plus the applicable guides and server instructions.

readC
Read-only

Read a manifest document completely using its returned cursor, or read a native UTF-8 file after all applicable rules were delivered. File cursors cannot be combined with offset/limit.

runA
Destructive

Execute a user-authorized native program (exact executable + argv) or discovered shell command (shell_id), with native OS permissions and possible filesystem, process and network effects. Supports oneshot, interactive and service lifetimes. Read core, project rules and guide:native-exec first. Requires a stable operation_id; query the original receipt after an unknown outcome instead of resending.

Inputs: execution (required), context_id (required), operation_id (required), cwd, +6 more.

task_closeA
Destructive

Close this context and release its in-memory snapshots and observations. owned_jobs=retain preserves owned jobs; owned_jobs=cancel requests cancellation of owned work and can terminate owned process trees. Does not delete user files. Inspect each returned disposition; cancel_requested does not mean termination was observed.

Inputs: context_id (required), owned_jobs.

writeC
Destructive

Atomically write a UTF-8 file within declared scope using a stable operation_id for durable deduplication and optional expected_sha256 conflict protection.

Inputs: path (required), content (required), context_id (required), operation_id (required), +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 22 tools

    Disambiguation4/5

    Most tools target clearly distinct surfaces: core files, execution, MCP, browser/computer use, and prefixed Antigravity/Codex backends. The only notable overlap is codex_send versus codex_resume, both of which message an existing Codex thread, though the descriptions help distinguish them.

    Naming Consistency3/5

    There are recognizable subsystem prefixes such as antigravity_* and codex_*, but the overall set mixes bare verbs (read, search, run), noun-only names (job, mcp, context), and noun_verb names (task_close, browser_use, computer_use). It remains readable, but the convention is not predictable across the server.

    Tool Count3/5

    At 22 tools this is a heavy surface, falling into the borderline 16–25 range. The broad local-orchestration scope explains some size, but the many Codex/Antigravity-specific tools could likely be consolidated without losing coverage.

    Completeness4/5

    The set covers core file operations, execution/job handling, MCP, browser/computer use, context/task lifecycle, and multiple agent backends. There are minor gaps such as no dedicated file delete or new Codex-thread creation, but native execution can work around some file-management omissions.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to seamlessly integrate with the Windows operating system, performing tasks such as file navigation, application control, UI interaction, and QA testing via the MCP protocol.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI clients to securely control and interact with a local Windows machine through 218 configurable tools for files, Git, processes, Windows UI, browser automation, WSL, Office, recovery, skills, and child MCP servers.
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to control and interact with a local Windows computer through authenticated MCP tools, including file operations, shell commands, process management, HTTP requests, and system/media inspection.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP-capable AI assistants to control a Windows computer through GUI automation, file and process operations, PowerShell commands, durable background jobs, and binary file transfer with downloadable exports.
      MIT