Skip to main content
Glama
Heretek-RE

re-patch

by Heretek-RE

re-patch

MCP server for on-disk patching of binary artifacts. Provides:

  • SHA-256 manifest of a binary (so the original can be verified / restored)

  • Byte-level patch application: copy a file, write new_bytes at offset, save the result

  • Manifest-driven restore: read the manifest, copy the original back

The server does not enforce policy — it surfaces an audit log (confirm_legal parameter) so the calling agent records the justification for every patch. The user / run policy is the caller's responsibility.

Why

The 2026-06-05 stress test surfaced a need for an on-disk patch primitive that's:

  • Auditable — every call carries a confirm_legal text the analyst must type in

  • Reversible — the SHA-256 manifest + restore_original tool let the analyst roll back to the exact original bytes

  • Non-destructiveapply_patch writes a copy at dst, not in place; the original at src is never modified

Related MCP server: hashline-mcp

Tools

Tool

What it does

check_patch

Health check — re-patch has no system dependencies; always status: OK

sha256_manifest

Return the SHA-256 of path (hex-encoded)

apply_patch

Copy src to dst, write new_bytes_b64 at offset in dst

restore_original

Copy original (whose SHA-256 matches the manifest) to restore_target

Install

Part of the RE-AI plugin; ./install.sh installs the package. To install standalone:

pip install -e ./servers/re-patch

Run

re-patch                                # stdio transport (default for MCP)
python -m re_patch                      # equivalent

Available Tools

4 tools
apply_patchA

Copy src to dst, then splice new_bytes_b64 at offset.

This is the on-disk patch primitive. The original bytes at src are never modified; the patch is written to a copy at dst. The function returns both the pre-patch and post-patch SHA-256 so the analyst can record the patch's net effect in the report.

Args: src: source file (the original; never modified) dst: destination file (created or overwritten with the patched copy) offset: byte offset into dst at which to write (0-based) new_bytes_b64: base64-encoded bytes to splice in confirm_legal: free-text justification (the audit trail; the server does not enforce policy)

Returns::

{
  "src": "...",
  "dst": "...",
  "src_sha256": "<original>",
  "dst_sha256": "<patched>",
  "src_size": N,
  "dst_size": N,
  "offset": N,
  "patched_bytes": M,
  "confirm_legal": "...",
}

Override-scope contract: this tool is gated behind the run's policy override (see override-scope.md of the active run). The override authorizes on-disk patches only inside Output/<run-id>/patches/; the confirm_legal text must reference the override file and the rationale.

ParametersJSON Schema
NameRequiredDescriptionDefault
srcYes
dstYes
offsetYes
new_bytes_b64Yes
confirm_legalNo

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description thoroughly discloses behavior: src is never modified, dst is created or overwritten, returns pre- and post-patch SHA-256, explains confirm_legal as audit trail (not enforced), and details return object keys. No annotations are present, so the description bears full responsibility and meets it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections (summary, args, returns, override-scope contract) and is front-loaded. It is slightly lengthy but every sentence adds value; minor conciseness improvements could be made.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is remarkably complete. It covers behavior, parameter semantics, return value structure, and policy constraints (override scope). It provides all necessary information for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by explaining each parameter: src (source file, never modified), dst (destination file, created/overwritten), offset (0-based byte offset), new_bytes_b64 (base64-encoded bytes), confirm_legal (free-text justification). This adds significant meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: copy src to dst, then splice new_bytes_b64 at offset. It is identified as the 'on-disk patch primitive', which distinguishes it from sibling tools like check_patch, restore_original, and sha256_manifest.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context on when to use the tool via the 'Override-scope contract' section, explaining it is gated behind a policy override and restricted to Output/<run-id>/patches/. However, it does not explicitly state when not to use it or mention alternative approaches.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

check_patchA

Return server status + version. Always status: OKre-patch has no external system dependencies (pure Python stdlib + mcp / pydantic).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description carries full burden. It sufficiently discloses key traits: deterministic output ('Always `status: OK`'), no external dependencies (pure Python), and return of version. It does not mention error scenarios, but the simplicity warrants a high score.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loads the primary action, and contains no redundant information. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema), the description is mostly complete. It covers status and version but omits details on return format or potential error conditions. Slightly more detail could warrant a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters, baseline is 4. The description adds value by explaining the tool's return content and lack of dependencies, but parameter semantics are inherently N/A.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action ('Return server status + version') and distinguishes it from siblings like 'apply_patch' and 'restore_original' by emphasizing it always returns 'status: OK' and has no external dependencies, making it a safe read-only check.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for checking server status and version, but it does not explicitly state when to prefer this tool over siblings like 'sha256_manifest' or in what contexts (e.g., before applying patches). The lack of explicit guidance lowers the score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

restore_originalA

Copy original back to restore_target, optionally verifying the original's SHA-256 against expected_sha256 first.

This is the rollback primitive. The function:

  1. Computes the SHA-256 of original.

  2. If expected_sha256 is non-empty, verifies the computed hash matches (refuses to proceed otherwise).

  3. Copies original to restore_target (overwriting).

Args: original: file whose bytes are the canonical "original" (typically the source the patch was applied from) restore_target: file to write the original bytes to (typically the patched copy) expected_sha256: optional hex-encoded SHA-256 to verify original against confirm_legal: free-text justification (audit trail)

Returns::

{
  "original": "...",
  "restore_target": "...",
  "original_sha256": "<hash>",
  "expected_sha256": "<hash>" or null,
  "verified": bool,
  "confirm_legal": "...",
}
ParametersJSON Schema
NameRequiredDescriptionDefault
originalYes
restore_targetYes
expected_sha256No
confirm_legalNo

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but the description fully discloses the three-step process: compute hash, optionally verify, and overwrite target. It adds behavioral context beyond schema by explaining verification logic.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with summary, numbered steps, Args, and Returns. It is slightly lengthy but every element adds value, and the action is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

In the absence of an output schema, the description provides a complete return structure. All four parameters are covered, and the use case is fully explained with step-by-step logic.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description includes an 'Args' block that explains the purpose of each parameter, including optionality of expected_sha256 and the audit trail role of confirm_legal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool copies original to restore_target and calls it a rollback primitive. This distinguishes it from siblings apply_patch (forward) and check_patch/sha256_manifest (verification/list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description identifies it as a rollback primitive, implying use for reverting patched files. It does not explicitly state when not to use or list alternatives, but context from siblings provides differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

sha256_manifestA

Compute the SHA-256 manifest of path.

Args: path: file to hash

Returns::

{
  "path": "...",
  "size": N,
  "sha256": "<64 hex chars>",
}

Use this to record the canonical SHA-256 of the original binary before any patch is applied. The hash is the rollback key: restore_original(original, target, expected_sha256=...) will refuse to proceed if the original's hash has drifted.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully carries the burden. It explains the tool computes a hash (read-only), describes the output format including path, size, and sha256, and notes its role in the patching process. No contradictions with annotations since none exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with docstring format (Args, Returns, usage note). Every sentence adds value: the core purpose, parameter definition, return structure, and use case. It is appropriately sized with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema) and context signals, the description covers all necessary information: input, output, and usage context. There are no gaps; it is complete for an agent to understand and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must explain the parameter. It documents 'path: file to hash' explicitly, adding meaning beyond the schema's type-only definition. The description covers the single parameter comprehensively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool computes a SHA-256 manifest of a path, specifying the verb 'Compute' and the resource 'SHA-256 manifest'. It distinguishes from sibling tools (apply_patch, check_patch, restore_original) by explicitly tying into the patching workflow as a prerequisite step.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Use this to record the canonical SHA-256 of the original binary before any patch is applied', providing clear guidance on when to use it. It also connects to restore_original, indicating the hash is used as a rollback key, which helps differentiate from siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.1.0
    • First observedapply_patch
    • First observedcheck_patch
    • First observedrestore_original
    • First observedsha256_manifest

TDQS

A4.5/5.0
Disambiguation5/5

Each tool has a distinct purpose: applying patches, health check, rollback, and hash computation. No overlap or ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (apply_patch, check_patch, restore_original, sha256_manifest).

Tool Count5/5

4 tools is well-scoped for a focused patching utility; each tool is necessary and justified.

Completeness4/5

Core patching workflow (hash, apply, rollback, health) is covered, though a tool to list applied patches is missing.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    A deterministic MCP server that enforces auditable workflows by requiring AI agents to provide structured justifications and obtain human approval for file operations. It provides a secure, tamper-evident pipeline for tracking agent intent and codebase changes through cryptographic signatures and SQLite indexing.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server for precise, hash-referenced file editing that enables atomic edits using line:hash references instead of fragile line numbers or full content reproduction.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    A filesystem MCP server that journals every file operation (write, delete, move, mkdir) and outbound commands (exec, http) into an append-only ledger, enabling undo and compensation of actions.
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    A local-first, model-neutral MCP server for collecting and normalizing change-scoped release evidence. It provides deterministic Git change summaries, evidence collection, and review bundles for agent review.
    7
    18
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Heretek-RE/re-patch'

If you have feedback or need assistance with the MCP directory API, please join our Discord server