Skip to main content
Glama
AgentExtract MCP

AgentExtract MCP

README.md
# ⚡ AgentExtract MCP: Token-Saving Web Extraction for AI Agents

[![Smithery Compatible](https://smithery.ai/badge/@griffin121/agent-extract-mcp)](https://smithery.ai/server/@griffin121/agent-extract-mcp)

**AgentExtract MCP** connects your AI agents (Claude Desktop, Cursor, LangChain, CrewAI) to a high-speed, token-optimizing web extraction engine. It strips scripts, cookie banners, navigation menus, and ads from any webpage, returning dense, pristine Markdown and structured tables.

> 💰 **Saves 70% to 90% of LLM prompt tokens** on web research tasks.

---

## 🛠️ Tools Included

1. **`extract_clean_markdown`**: Extracts dense semantic Markdown and page metadata from any URL.
2. **`extract_tables`**: Converts HTML tables into clean Markdown tables and 2D JSON arrays.
3. **`check_balance`**: Checks your remaining API credit balance.

---

## 🚀 Quickstart

### 1. Claude Desktop Setup

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "agent-extract": {
      "command": "npx",
      "args": ["-y", "@griffin121/agent-extract-mcp"],
      "env": {
        "AGENT_EXTRACT_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

### 2. Cursor Setup

Add to your Cursor MCP settings (`~/.cursor/mcp.json` or Workspace Settings):

```json
{
  "mcpServers": {
    "agent-extract": {
      "command": "node",
      "args": ["/path/to/dist/index.js"],
      "env": {
        "AGENT_EXTRACT_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

### 3. Smithery Installation

Install via the Smithery CLI:

```bash
npx -y @smithery/cli install @griffin121/agent-extract-mcp --client claude
```

---

## 🐍 Python / LangChain & CrewAI Integration

If you are building custom agents in Python with LangChain or CrewAI:

```python
import os
import requests
from langchain.tools import tool

AGENT_EXTRACT_URL = "https://accent-amendment-loaded-bills.trycloudflare.com/v1/extract"
API_KEY = os.getenv("AGENT_EXTRACT_API_KEY", "your_key_here")

@tool
def scrape_clean_markdown(url: str) -> str:
    """Scrapes a URL and returns token-optimized clean Markdown stripped of ads and clutter."""
    headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
    response = requests.post(AGENT_EXTRACT_URL, headers=headers, json={"url": url})
    data = response.json()
    if response.status_code == 402:
        return f"Payment Required: Out of credits. Refill here: {data['details']['refillUrl']}"
    return data["data"]["markdown"]

# Attach to your agent:
# agent = create_openai_tools_agent(llm, [scrape_clean_markdown], prompt)
```

---

## 💳 Getting an API Key

API keys are managed with pre-funded credits. When an account runs out of credits, calls return an `HTTP 402 Payment Required` with an instant Stripe checkout link to top up.

## License
MIT

TDQS

A3.5/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a clearly distinct action: markdown extraction, table extraction, and account balance. Extraction tools split by output type, which is a meaningful and easy-to-distinguish boundary.

Naming Consistency4/5

Two tools follow a verb_object pattern (extract_clean_markdown, extract_tables), but check_balance is a different verb-resource pairing and extract_clean_markdown has a redundant adjective. Still readable and predictable overall.

Tool Count4/5

Three tools is on the thin side, but it matches a focused extraction-plus-billing service. Each tool earns its place with no filler.

Completeness3/5

Core extraction and account status are covered, but there are notable gaps: no extraction from provided HTML/documents, no bulk or batch extraction, and no way to manage or top up credits beyond checking balance.