Skip to main content
Glama

mamcp

MCP servers that let an LLM analyse malware the way an analyst does: unpack the delivery chain, read the code, detonate safely, and write an evidence-backed report.

  • mamcp (static): parses a sample and exposes granular, paginated tools to triage it, follow what it carries, and read its code through Ghidra's decompiler. It never runs the sample.

  • mamcp-dynamic (dynamic): runs the sample in a sandbox and returns its behaviour in one normalised format. Built in: Speakeasy Windows emulation (no VM needed), CAPEv2, and a Linux container sandbox for ELF on any architecture. Other sandboxes plug in.

Formats: PE (incl. .NET), ELF, Mach-O, raw shellcode, Office documents (OLE, OOXML, RTF), PDF, LNK shortcuts, scripts (PowerShell, JScript, VBScript, batch, HTA, shell, Python) and Inno Setup installers, including inside zip, 7z, tar, gzip and ISO archives, nested or password-protected.

Install

You need:

  • Docker: Docker Desktop on macOS or Windows, Docker Engine on Linux. Give it at least 8 GB of memory (Docker Desktop → Settings → Resources); capa and FLOSS need several GB each on large samples.

  • An MCP client: Claude Code, Claude Desktop, Cursor, VS Code...

  • Windows: use WSL2. The launch scripts are bash.

git clone https://github.com/sudhanvarao28/malwareAnalysisMcpToolkit.git mamcp
cd mamcp
docker build -t mamcp .     # ~2 GB with Ghidra, capa, FLOSS, YARA rules, Speakeasy; 10–20 min the first time
mkdir -p samples

There's nothing to install on the host besides Docker: both servers run in the image, launched by scripts/mamcp-docker.sh and scripts/mamcp-dynamic-docker.sh.

Related MCP server: Reverence

Connect your client

Claude Code: run claude in the mamcp folder. .mcp.json registers both servers. Approve mamcp and mamcp-dynamic when Claude Code asks; if you dismiss the prompt, the tools won't appear (run /mcp to check them). The malware-analysis skill in .claude/skills/ loads automatically. Don't want dynamic analysis? Don't approve mamcp-dynamic, or remove it from .mcp.json.

Other clients: add both servers with absolute paths:

// Claude Desktop: claude_desktop_config.json      Cursor: .cursor/mcp.json
{
  "mcpServers": {
    "mamcp":         { "command": "bash", "args": ["/path/to/mamcp/scripts/mamcp-docker.sh"] },
    "mamcp-dynamic": { "command": "bash", "args": ["/path/to/mamcp/scripts/mamcp-dynamic-docker.sh"] }
  }
}
// VS Code: .vscode/mcp.json
{
  "servers": {
    "mamcp":         { "type": "stdio", "command": "bash", "args": ["/path/to/mamcp/scripts/mamcp-docker.sh"] },
    "mamcp-dynamic": { "type": "stdio", "command": "bash", "args": ["/path/to/mamcp/scripts/mamcp-dynamic-docker.sh"] }
  }
}

For agents that support Agent Skills, copy or link skills/malware-analysis/ into their skills folder (for Claude Code in other projects, ~/.claude/skills/). It tells the agent when and how to use the tools. Clients without prompts or skills can still use every tool: paste the text of the analyze_sample prompt (src/mamcp/prompts.py) as instructions.

Analyse a sample

  1. Put the sample in samples/. Keep it zipped (the usual infected password is fine): mamcp unpacks archives in memory, and antivirus on your machine may quarantine an extracted sample.

  2. Ask in plain language, for example:

    • "Analyse sample.zip and write a report."

    • "Quick triage of invoice.zip: is it malicious, and what does it contact?"

    • "This installer is suspicious. What does it actually install, and what runs?"

    Or run the full workflow as a prompt: /mcp__mamcp__analyze_sample sample.zip (add depth: quick for triage only).

The agent works through the delivery chain (archive → document, shortcut, script or installer → payload), reads the code, detonates in Speakeasy with no network, extracts IOCs, writes and tests a YARA rule, and saves the report to reports/<sha256-prefix>_<name>.md. The first deep run on a sample takes a few minutes (capa, FLOSS and Ghidra); results are cached afterwards.

Nothing needs configuring for this. Configuration covers the extras: public hash lookups, your own YARA rules, CAPE and the Linux sandbox.

Update

git pull && docker build -t mamcp .

Then restart your MCP client: running servers keep the old image until they restart.

Troubleshooting

Symptom

Fix

The mamcp tools don't appear

Approve both servers (/mcp in Claude Code), check that docker build finished, and restart the client

capa or FLOSS "was killed (SIGKILL)"

Docker is out of memory: raise its memory limit to 8 GB or more

New tools or fixes missing after an update

Restart the client after docker build

Your rules/ aren't scanned

The folder is mounted at start-up: restart the client after creating it

An extracted sample vanished from samples/

Your antivirus quarantined it: keep samples zipped, or exclude the folder

lookup_reports returns nothing

Add an API key to mamcp.toml and give the dynamic server network (see Configuration)

A Ghidra call says another instance is busy

Wait a minute and retry: another client is analysing the same sample

Security

The servers run in a container with no network, a read-only root filesystem, read-only sample and rule mounts, no capabilities, no-new-privileges and a non-root user. Everything taken from a sample is escaped, length-capped and marked as untrusted, so text in the sample can't pose as instructions. Tool responses are size-capped. Read docs/THREAT_MODEL.md for the boundaries and the risks that remain. In short: for targeted samples, run mamcp inside a VM, and treat the model's verdict as a draft to check against the evidence it cites.

Static tools (mamcp)

Tool

Purpose

list_sample_files / load_sample / list_loaded_samples

Find and load samples; archives unpacked in memory (member="a.zip!b.iso!c.lnk" for nesting)

list_archive

Archive or disk-image members, without loading them

get_overview

Headers, hashes, timestamps, signatures, overlay, plain-language indicators

get_sections / get_entropy

Sections/segments with permissions and entropy; block entropy map

get_imports / get_exports

Imports tagged by behaviour (injection, network, crypto, anti-debug...)

get_resources

PE resources with entropy and content type

get_dotnet / get_dotnet_user_strings

.NET metadata, suspicious APIs, P/Invoke, obfuscator hints, #US strings

get_strings / read_bytes

Strings with IOC tags, regex filter, pagination; hex dump at offset, VA or RVA

get_capa / get_floss

Capabilities mapped to ATT&CK and MBC; stack, tight and decoded strings

yara_scan / test_yara_rule

Community + your rules; check a new rule against the sample and a clean corpus

get_document / get_macros

Office/RTF: VBA and XLM macros, auto-exec, VBA stomping, remote templates, DDE, embedded objects

get_pdf

Risky keywords, JavaScript (incl. in object streams), actions, URIs, embedded files, appended data

get_lnk

Shortcut command line, icon, window style, builder fingerprints (machine id, MAC)

get_script

Language, risky constructs, obfuscation signals, statically decoded layers (base64, -enc, char codes)

get_installer

Inno Setup installers (incl. 7.x): files it installs, hash-verified against the installer's own record, the compiled [Code] script and DLLs it calls during setup, header strings in any language, DLL side-loading sets

load_child

Load a file embedded in a document or PDF, or installed by an installer, as a sample of its own

ghidra_analyze

Import and auto-analyse in Ghidra (background; shellcode via language)

list_functions / decompile / disassemble

Functions filterable by capability; C output; listings

get_xrefs / get_call_graph / find_string_refs

Who calls what, call trees, which code uses a string

triage

One call: everything cheap (or deep=true for capa + FLOSS), format-aware, with next steps

extract_iocs

Deduplicated, defanged IOCs from every source, including saved dynamic runs

export_iocs

STIX 2.1 bundle or MISP event with TLP marking

Prompt: analyze_sample(target, depth) drives the full workflow and report template.

Dynamic tools (mamcp-dynamic)

Tool

Purpose

lookup_reports

What public sandboxes already know about the hash (nothing is uploaded; needs API keys)

list_sandboxes

Available backends and what each can do

load_sample / load_child

Load a sample, a file from inside an installer or document, or (source="artifacts") a memory dump from an earlier run

detonate

Run it, optionally with fake C2 responses so command handlers run, and companions placed beside it (a side-loading set, an encrypted payload the loader reads)

run_status / list_runs / get_behavior

Progress and a summary of the run

get_api_calls / get_network / get_file_activity / get_runtime_strings

Drill down: API trace, DNS/HTTP/connections, files and registry, strings decoded in memory

get_memory_dumps / get_dropped_files

Unpacked code and dropped files, saved under ./artifacts; the static server loads them with load_sample(path, source="artifacts")

Read docs/DYNAMIC.md for the backends (Speakeasy, CAPE and Linux), choosing a sandbox for Windows or Linux samples, the safety defaults, and writing your own backend plugin.

Inflated samples (megabytes of zero padding to slip past size-limited scanners) are flagged by get_overview, and FLOSS runs on a de-padded copy with a byte-identical memory image.

Configuration

Settings come from MAMCP_* environment variables or ./mamcp.toml, which the Docker scripts mount read-only. Copy mamcp.toml.example, which lists every setting with its default. Environment variables win. Common ones:

Setting

Default

max_response_chars

60000

Per tool response; longer lists are trimmed with a note on how to paginate

capa_timeout / floss_timeout

900

Seconds

sandboxes

all installed

Which dynamic backends to enable

allow_internet / allow_upload

false

Opt-ins for dynamic analysis

malwarebazaar_key, virustotal_key, hybrid_analysis_key, triage_key

Hash lookups (lookup_reports); MalwareBazaar's key is free

[cape] url, token, shared

CAPE backend: real Windows VMs

[linux] url, token

Linux sandbox agent (sandboxes/linux): ELF on any architecture

Hash lookups, CAPE and the Linux agent need network access from the dynamic server's container: set MAMCP_SANDBOX_NETWORK=1 for it, either with "env": {"MAMCP_SANDBOX_NETWORK": "1"} on the mamcp-dynamic entry in your client's MCP config, or exported before starting the client. The sample itself still never gets real network unless you also set allow_internet. Setting these up is covered in docs/DYNAMIC.md.

Your own YARA rules go in ./rules/. They're scanned with the bundled YARA-Forge set, and mounted when the server starts, so restart it after creating the directory. Known-clean binaries in ./goodware/ strengthen test_yara_rule's false-positive check.

Custom rules

File

Rule

Covers

rules/apt1_greencat.yar

APT1_GreenCat_Backdoor

GreenCat / WEBC2 (APT1) backdoor: command table, fake "Invalid Hostname" idle page, usage strings

APT1_GreenCat_C2_stratos_mcafeepaying

Its C2 stratos.mcafeepaying.com, plain or shifted left by one bit

Evaluation

evals/ scores mamcp against samples with known answers. The tools mode checks the tools surface the expected IOCs, techniques and facts (no LLM). The agent mode scores the reports an agent writes, plus turns and cost. Use it before and after a change. See evals/README.md.

cp evals/cases.example.toml evals/cases.toml    # then add your corpus
scripts/eval-in-docker.sh                        # tools mode
python evals/run.py agent                        # end to end with Claude Code (needs the dev install below)

Development

python3 -m venv .venv && .venv/bin/pip install -e ".[dev,dynamic]"
scripts/fetch-rules.sh            # capa-rules + YARA-Forge into .cache/rules (needs git, curl, unzip)
.venv/bin/pytest                  # add -m "not slow" to skip capa/FLOSS runs
scripts/test-in-docker.sh         # full suite inside the image, including Ghidra

CI (.github/workflows/ci.yml) runs the fast suite on every push and pull request, and the full suite inside the built image. Tests use benign inputs only: pip's PE launchers, pythonnet's .NET DLL, a tiny C file compiled by clang, and documents, archives and scripts built in code with the structures malware uses. No malware lives in this repo.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to safely fetch malware samples, run isolated headless Ghidra static analysis, and retrieve decompiled function logic, imports, and strings through callable MCP tools.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Gives MCP clients such as Claude Code and OpenCode a static-analysis toolbox for binaries, executables, DLLs, shared objects, and web-app code, covering file identification and hashing, string extraction, PE/ELF/Mach-O/WASM parsing, disassembly, Ghidra decompilation, YARA scanning, and JavaScript deobfuscation. All inspection is read-only and never executes the target.
      16
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to run read-only static reverse-engineering tasks — binary triage, symbol and import inventory, per-function decompilation, and Android native-lib analysis — with untrusted samples confined to a no-network bubblewrap chamber that never executes the target.
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents and CLI users to statically inspect any binary offline — identifying file type, architecture, imports, packing, embedded content and signatures — and to diff two files to see exactly what changed. It works on ELF, PE and Mach-O executables, firmware dumps and calibration files without ever running them, reporting observations and inferences with file offsets as evidence.
      104 npm
      1
      MIT