Decompose Mcp
Verified@echology-io
npx machina-cli add skill @echology-io/decompose-mcp --openclawDecompose
Decompose any text or URL into classified semantic units. Each unit gets authority level, risk category, attention score, entity extraction, and irreducibility flags. No LLM required. Deterministic. Runs locally.
Setup
1. Install
pip install decompose-mcp
2. Configure MCP Server
Add to your OpenClaw MCP config:
{
"mcpServers": {
"decompose": {
"command": "python3",
"args": ["-m", "decompose", "--serve"]
}
}
}
3. Verify
python3 -m decompose --text "The contractor shall provide all materials per ASTM C150-20."
Available Tools
decompose_text
Decompose any text into classified semantic units.
Parameters:
text(required) — The text to decomposecompact(optional, default: false) — Omit zero-value fields for smaller outputchunk_size(optional, default: 2000) — Max characters per unit
Example prompt: "Decompose this spec and tell me which sections are mandatory"
Returns: JSON with units array. Each unit contains:
authority— mandatory, prohibitive, directive, permissive, conditional, informationalrisk— safety_critical, security, compliance, financial, contractual, advisory, informationalattention— 0.0 to 10.0 priority scoreactionable— whether someone needs to act on thisirreducible— whether content must be preserved verbatimentities— referenced standards and codes (ASTM, ASCE, IBC, OSHA, etc.)dates— extracted date referencesfinancial— extracted dollar amounts and percentagesheading_path— document structure hierarchy
decompose_url
Fetch a URL and decompose its content. Handles HTML, Markdown, and plain text.
Parameters:
url(required) — URL to fetch and decomposecompact(optional, default: false) — Omit zero-value fields
Example prompt: "Decompose https://spec.example.com/transport and show me the security requirements"
What It Detects
- Authority levels — RFC 2119 keywords: "shall" = mandatory, "should" = directive, "may" = permissive
- Risk categories — safety-critical, security, compliance, financial, contractual
- Attention scoring — authority weight x risk multiplier, 0-10 scale
- Standards references — ASTM, ASCE, IBC, OSHA, ACI, AISC, AWS, ISO, EN
- Financial values — dollar amounts, percentages, retainage, liquidated damages
- Dates — deadlines, milestones, notice periods
- Irreducibility — legal mandates, threshold values, formulas that cannot be paraphrased
Use Cases
- Pre-process documents before sending to your LLM — save 60-80% of context window
- Classify specs, contracts, policies, regulations by obligation level
- Extract standards references and compliance requirements
- Route high-attention content to specialized analysis chains
- Build structured training data from raw documents
Performance
- ~14ms average per document on Apple Silicon
- 1,000+ chars/ms throughput
- Zero API calls, zero cost, works offline
- Deterministic — same input always produces same output
Security & Trust
Text classification is fully local. The decompose_text tool performs all processing in-process with no network I/O. No data leaves your machine.
URL fetching performs outbound HTTP requests. The decompose_url tool fetches the target URL, which necessarily involves network I/O to the specified host. This is why the skill declares the network permission in claw.json. If you do not need URL fetching, you can use decompose_text exclusively with no network access required.
SSRF protection. URL fetching blocks private/internal IP ranges before connecting: 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.168.0.0/16, ::1/128, fc00::/7, fe80::/10. The implementation resolves the hostname via DNS before connecting and checks all returned addresses against the blocklist. See src/decompose/mcp_server.py lines 19-49.
No API keys or credentials required. No external services are contacted except when using decompose_url to fetch user-specified URLs.
Source code is fully auditable. The complete source is published at github.com/echology-io/decompose. The PyPI package is built from this repo via GitHub Actions (publish.yml) using PyPI Trusted Publishers (OIDC), so the published artifact is traceable to a specific commit.
Resources
- Source Code (GitHub) — full source, auditable
- PyPI — published via Trusted Publishers
- Documentation
- Blog: When Regex Beats an LLM
- Blog: Why Your Agent Needs a Cognitive Primitive
Overview
Decompose any text or URL into classified semantic units—authority, risk, attention, and entities. It runs locally without an LLM and delivers deterministic outputs. This makes it ideal for preprocessing contracts, specifications, and regulatory documents.
How This Skill Works
Use the decompose_text or decompose_url tools to produce a JSON payload with units. Each unit includes fields such as authority, risk, attention, actionable, irreducible, entities, dates, financial, and heading_path. The processing is fully local (no network I/O for text) while URL fetching uses a configurable MCP server to perform network access when needed.
When to Use It
- Pre-process contracts or specifications to identify mandatory obligations and risk.
- Classify policies and regulations by obligation level using RFC2119 keywords.
- Extract standards references (e.g., ASTM, ISO) for compliance reviews.
- Route high-attention content to specialized analysis chains.
- Build structured training data from raw documents for downstream AI pipelines.
Quick Start
- Step 1: pip install decompose-mcp
- Step 2: Configure MCP server and run (see setup section in the docs).
- Step 3: Decompose text example: python3 -m decompose --text "The contractor shall provide all materials per ASTM C150-20."
Best Practices
- Prefer decompose_text when you don't need web content to avoid network I/O.
- Set chunk_size to control the max characters per unit.
- Use compact to omit zero-value fields for smaller outputs.
- Test verification with the provided sample (e.g., --text).
- Only enable decompose_url if you need URL fetching; be mindful of network access and permissions.
Example Use Cases
- Identify and extract mandatory clauses in a vendor spec.
- Flag safety-critical sections in safety policies.
- List referenced standards like ASTM or ISO for compliance checks.
- Highlight highly attention-worthy clauses for legal review.
- Create structured JSON datasets from requirements documents for QA.