Metadata-Version: 2.4
Name: loreto-mcp
Version: 0.2.1
Summary: MCP server for the Loreto skill generation API. API key or pay-per-call (x402, $0.75 USDC) — generate, list, and verify Claude Code skills inside any MCP client.
Project-URL: Homepage, https://loreto.io
Project-URL: Documentation, https://loreto.io/docs-mcp
Project-URL: Repository, https://github.com/kopias/loreto-mcp
License: MIT
Keywords: ai,claude,loreto,mcp,model-context-protocol,skills
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: fastmcp>=2.0
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Description-Content-Type: text/markdown

# loreto-mcp

Turn any YouTube video, article, PDF, or image into a reusable Claude Code skill — without leaving your editor.

---

## What it does

Loreto analyzes a content source and extracts **structured skill packages** that Claude Code can apply to future tasks. Each skill contains:

- **`SKILL.md`** — Principles, failure modes, implementation steps, and architectural patterns
- **`README.md`** — Overview and usage context
- **Reference files** — Supporting patterns and data structures
- **Test script** — Runnable validation for the skill's core concepts

Save skills to `.claude/skills/` and Claude picks them up automatically on relevant tasks — reducing hallucinations, token usage, and re-explaining the same concepts over and over.

---

## Sample skills

The [`sample-skills/`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills) folder contains real skills generated by Loreto from a single technical video on hybrid AI architecture. Browse them to see exactly what you get:

| Skill | What it teaches |
|---|---|
| [`designing-hybrid-context-layers`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/designing-hybrid-context-layers) | Architect hybrid retrieval systems that combine vector search, graph traversal, and structured data |
| [`temporal-reasoning-sleuth`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/temporal-reasoning-sleuth) | Enable agents to trace decision chains and reconstruct causal sequences across long time horizons |
| [`synthesizing-institutional-knowledge`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/synthesizing-institutional-knowledge) | Capture and query organizational knowledge in a way AI agents can reliably reason over |
| [`diagnosing-rag-failure-modes`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/diagnosing-rag-failure-modes) | Identify and fix the 7 most common RAG pipeline failure patterns |
| [`routing-work-across-ai-harnesses`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/routing-work-across-ai-harnesses) | Dynamically route tasks to the right AI harness based on task type and context |
| [`evaluating-ai-harness-dimensions`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/evaluating-ai-harness-dimensions) | Score and compare AI harness options across speed, cost, accuracy, and controllability |
| [`detecting-harness-lockin`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/detecting-harness-lockin) | Spot vendor lock-in signals early and design for portability |
| [`benchmarking-ai-agents-beyond-models`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/benchmarking-ai-agents-beyond-models) | Measure agent performance at the system level, not just model level |
| [`auditing-intelligence-context-fit`](https://github.com/kopias/loreto-mcp/tree/main/sample-skills/auditing-intelligence-context-fit) | Audit whether the right intelligence layer is solving the right problem |

Each folder includes the full `SKILL.md`, `README.md`, and any reference files — ready to drop into `.claude/skills/`.

---

## Billing — two paths, pick one

Loreto runs on two parallel billing paths. The right one depends on whether you're a human signing up or an AI agent paying per task.

| | **API key** (`lor_...`) | **x402 pay-per-call** (USDC) |
|---|---|---|
| **Best for** | Humans, recurring use, teams | Agents, one-off jobs, anonymous use |
| **Signup** | Yes — [loreto.io](https://loreto.io) | None |
| **Pricing** | Free: 2 calls/mo · Pro: $29/mo for 100 | Flat $0.75 per call, no monthly cap |
| **Wallet needed** | No | Yes — USDC on Base mainnet |
| **MCP support** | This package, out of the box | Direct REST + the [x402 Python SDK](https://pypi.org/project/x402/) |
| **Endpoint** | `POST /api/v1/skills/generate` | `POST /api/v1/skills/x402/generate` |
| **Docs** | [docs-authentication](https://loreto.io/docs-authentication.html) | [docs-x402](https://loreto.io/docs-x402.html) |

### Path A — API key (this MCP package)

Get your key at [loreto.io](https://loreto.io), set `LORETO_API_KEY` in your MCP config (see below), and you're done. Free tier ships immediately; upgrade to Pro when you need more.

### Path B — x402 pay-per-call (no signup)

If you're an autonomous agent, an AI workflow without persistent credentials, or a developer who just wants to try one generation, x402 is faster than signing up. The MCP package itself uses Path A — but every catalog call (`list_skills`, `get_skill`, `verify_artifacts`, `estimate_cost`) is free regardless of which path you generate skills under.

To run a generation under x402:

```bash
# Pseudocode — see https://loreto.io/docs-x402 for the full handshake
curl -X POST https://api.loreto.io/api/v1/skills/x402/generate \
  -H "X-PAYMENT: <eip-3009 signed authorization>" \
  -H "Content-Type: application/json" \
  -d '{"source": "https://www.youtube.com/watch?v=...", "source_type": "youtube"}'
```

The `X-PAYMENT` header is signed by your wallet against an EIP-3009 USDC transfer authorization for $0.75. The Loreto server only burns the authorization on a successful 2xx response — failed pipeline runs don't consume your USDC. Use the [x402 Python SDK](https://pypi.org/project/x402/) to handle the signing.

**Verify any generation by id.** Both paths return a `generation_id` (uuid4). Pass it to the MCP's `verify_artifacts` tool — or hit `GET /api/v1/skills/manifest/{generation_id}` directly — to fetch the source URL, theme plan, quality scores, artifact byte counts, and bundle sha256. The endpoint is public, no auth required: the id is the capability.

## Setup

### 1. Get an API key (Path A)

Sign up at [loreto.io](https://loreto.io). Skip this step if you're using x402 — see the billing section above.

### 2. Install

```bash
pip install loreto-mcp
```

Or run directly without installing (requires [`uv`](https://docs.astral.sh/uv/)):

```bash
uvx loreto-mcp
```

### 3. Configure Claude Code

**User-scoped** (works across all your projects) — add to `~/.claude/mcp.json`:

```json
{
  "mcpServers": {
    "loreto": {
      "command": "uvx",
      "args": ["loreto-mcp"],
      "env": {
        "LORETO_API_KEY": "lor_..."
      }
    }
  }
}
```

**Project-scoped** (shared with your team) — add to `.mcp.json` at your project root:

```json
{
  "mcpServers": {
    "loreto": {
      "command": "uvx",
      "args": ["loreto-mcp"],
      "env": {
        "LORETO_API_KEY": "${LORETO_API_KEY}"
      }
    }
  }
}
```

### 4. Verify

Restart Claude Code and run `/mcp` — you should see `loreto` listed with six tools: `generate_skills`, `get_quota`, `list_skills`, `get_skill`, `verify_artifacts`, `estimate_cost`.

---

## Usage

Once connected, just ask Claude Code naturally:

```
Use Loreto to extract skills from https://www.youtube.com/watch?v=JYcidOS9ozU
```

```
Extract skills from this article and save them to .claude/skills/
```

```
Check my Loreto quota before we start.
```

Claude calls `generate_skills`, receives the full skill package, and can write the files directly to your project.

---

## Available tools

| Tool | Auth | Description |
|---|---|---|
| `generate_skills` | API key | Extract ranked skill packages from a URL. Returns full file contents ready to save. For x402 pay-per-call generations, see the billing section above. |
| `get_quota` | API key | Check calls used, monthly limit, and plan for your API key. (Not relevant on x402 — there is no quota; you pay $0.75 per call.) |
| `list_skills` | None | List all published Loreto catalog skills with their structured artifact and safety claims. Free for everyone. |
| `get_skill` | None | Fetch the full structured record for one catalog skill — artifacts, mcp, safety, governance, references, FAQ. Free for everyone. |
| `verify_artifacts` | None | Fetch the provenance manifest for a past generation by `generation_id` — works for both API-key and x402 generations. Free for everyone. |
| `estimate_cost` | None | Heuristic token + USD cost estimate by source kind, before running the pipeline. Free for everyone. |

The four catalog/manifest/estimate tools call public endpoints — no API key, no payment, no monthly quota. Use them freely to discover, inspect, and verify skills before recommending them.

### `generate_skills` parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `source` | `str` | required | URL to analyze — YouTube, article, public PDF, or image |
| `source_type` | `str` | `"auto"` | `"auto"` \| `"youtube"` \| `"article"` \| `"pdf"` \| `"image"` |
| `test_language` | `str` | `"python"` | `"python"` \| `"typescript"` \| `"javascript"` |
| `include_visuals` | `bool` | `true` | Embed Mermaid diagrams in `SKILL.md` |
| `context` | `str` | `null` | 1–3 sentence hint to guide extraction (max 500 chars) |
| `themes_to_process` | `list[str]` | `null` | Follow-up call: skill names from a previous response's queued themes |

---

## Supported sources

| Source | Notes |
|---|---|
| YouTube videos | Up to 60 minutes |
| Web articles | Any publicly accessible URL |
| PDFs | Up to 100 pages |
| Images | Diagrams, whiteboards, slides (up to 20 MB) |

---

## Configuration

| Environment variable | Required | Default | Description |
|---|---|---|---|
| `LORETO_API_KEY` | Yes | — | Your Loreto API key (`lor_...`) |
| `LORETO_BASE_URL` | No | `https://api.loreto.io` | Override for local development |

---

## Plans

Free, Pro, and Enterprise tiers under Path A — see [loreto.io/pricing](https://loreto.io/pricing) for current limits. Path B (x402) has no tiers: $0.75 per generation, billed per call in USDC. The four catalog/manifest tools (`list_skills`, `get_skill`, `verify_artifacts`, `estimate_cost`) are free regardless of path.

---

## License

MIT
