Metadata-Version: 2.4
Name: jirosearch
Version: 0.5.0
Summary: Self-hosted, AI-native web search and scraping API. 9 engines, 12 social platforms, query graphs and an MCP server. No cloud, no credits, MIT.
Author-email: Adarsh Kushwah <webcrafterreal@gmail.com>
Maintainer-email: Blackvault Technology <webcrafterreal@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/DevAnimecx/jiro
Project-URL: Documentation, https://github.com/DevAnimecx/jiro#readme
Project-URL: Repository, https://github.com/DevAnimecx/jiro
Project-URL: Issues, https://github.com/DevAnimecx/jiro/issues
Project-URL: Changelog, https://github.com/DevAnimecx/jiro/blob/main/CHANGELOG.md
Project-URL: Buy Me a Coffee, https://github.com/sponsors/DevAnimecx
Keywords: search,search-api,web-search,web-scraping,scraper,serpapi-alternative,serpapi,self-hosted,self-hosted-api,scraping-api,llm,agent,ai-agents,mcp,model-context-protocol,fastapi,langchain,llamaindex,function-calling,openai,anthropic,gemini,claude,cursor,markdown-scraper,seo,data-extraction,agentic-research,rag
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi>=0.110
Requires-Dist: uvicorn[standard]>=0.29
Requires-Dist: httpx[http2]>=0.27
Requires-Dist: curl_cffi>=0.15
Requires-Dist: brotli>=1.1
Requires-Dist: selectolax>=0.3.21
Requires-Dist: pydantic>=2.6
Requires-Dist: PyYAML>=6.0
Requires-Dist: typer>=0.12
Requires-Dist: rich>=13.0
Requires-Dist: PyJWT>=2.8
Requires-Dist: aiosqlite>=0.20
Requires-Dist: numpy>=1.26
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: fakeredis>=2.23; extra == "dev"
Requires-Dist: hypothesis>=6.100; extra == "dev"
Requires-Dist: cryptography>=42; extra == "dev"
Requires-Dist: lxml>=5.0; extra == "dev"
Provides-Extra: browser
Requires-Dist: playwright>=1.44; extra == "browser"
Provides-Extra: redis
Requires-Dist: redis>=5.0; extra == "redis"
Provides-Extra: recipes
Requires-Dist: lxml>=5.0; extra == "recipes"
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.39; extra == "anthropic"
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3; extra == "langchain"
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.12; extra == "llamaindex"
Provides-Extra: all
Requires-Dist: playwright>=1.44; extra == "all"
Requires-Dist: redis>=5.0; extra == "all"
Requires-Dist: lxml>=5.0; extra == "all"
Requires-Dist: openai>=1.0; extra == "all"
Requires-Dist: anthropic>=0.39; extra == "all"
Requires-Dist: langchain-core>=0.3; extra == "all"
Requires-Dist: llama-index-core>=0.12; extra == "all"
Dynamic: license-file

<div align="center">

<img src="assets/logo.png" alt="JIRO — open-source search API, web scraping and query graph engine" width="120">

# JIRO — Search API, Web Scraping & Query Graph Engine

**9 search engines. 12 social platforms. 23 MCP tools. One self-hosted API.**

[![PyPI version](https://img.shields.io/pypi/v/jirosearch.svg)](https://pypi.org/project/jirosearch/)
[![npm version](https://img.shields.io/npm/v/jiro-sdk.svg)](https://www.npmjs.com/package/jiro-sdk)
[![Python](https://img.shields.io/pypi/pyversions/jirosearch.svg)](https://pypi.org/project/jirosearch/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Docker](https://img.shields.io/docker/pulls/devanimecx/jiro.svg)](https://hub.docker.com/r/devanimecx/jiro)
[![Downloads](https://img.shields.io/pypi/dm/jirosearch.svg)](https://pypi.org/project/jirosearch/)

[Docs](https://github.com/DevAnimecx/jiro/blob/main/docs/README.md) · [Blog](https://github.com/DevAnimecx/jiro/tree/main/blog) · [Changelog](https://github.com/DevAnimecx/jiro/blob/main/CHANGELOG.md)

</div>

---

## What is JIRO?

JIRO is an **open-source, self-hosted search API and web scraping platform**. It aggregates 9 search
engines and 12 social platforms behind one HTTP API, and adds a **query graph engine** that plans,
executes and cites multi-step research — every answer traces back to the pages that produced it.

It runs entirely on your own infrastructure. No per-query vendor bill, no data leaving your network.

**Answer engine optimization note for the curious:** the *Sourced answers* section below is the part
that replaces a search API. Engines return links; JIRO returns claims plus the source ids behind them.

---

## Quick Start

```bash
pip install jirosearch
jiro serve
```

```bash
curl -X POST http://localhost:8000/search \
  -H "Content-Type: application/json" \
  -d '{"q": "latest AI research", "engine": "google"}'
```

Running: 9 engines, hybrid ranking, caching and structured extraction, all local.

There is no cloud tier and no hosted endpoint. Jiro runs on your machine or your server,
and that is the only place it runs.

---

## Sourced answers

Most search APIs return a list of links and stop. Jiro runs a **query graph**: it plans the
research shape, executes nodes in parallel, and returns an **evidence packet** where every claim
carries the `source_ids` it rests on.

```bash
curl -X POST http://localhost:8000/v1/graph/search \
  -H "Content-Type: application/json" \
  -d '{"query": "compare vector databases", "fetch_top": 3, "max_tokens": 2000}'
```

```json
{
  "graph_id": "g_8f2c1a",
  "intent": "comparison",
  "status": "ok",
  "duration_ms": 1840,
  "engine_attribution": { "google": 2, "bing": 1 },
  "gaps": [],
  "budget": { "requests_used": 5, "bytes_used": 284113, "nodes_used": 9, "tokens_used": 1780 },
  "packet": {
    "packet_id": "p_41d9",
    "used_tokens": 1780,
    "claims": [
      { "id": "c1", "text": "Qdrant is written in Rust.", "source_ids": ["s2"] }
    ],
    "sources": [{ "id": "s2", "url": "https://qdrant.tech/documentation/" }],
    "contradictions": []
  }
}
```

**Plan without paying.** `/v1/graph/plan` is a dry run — it validates the graph and returns a cost
estimate without touching the network.

### What the graph engine buys you

| Guarantee | How it shows up in the response |
|---|---|
| Every claim is traceable | `packet.claims[].source_ids` resolves against `packet.sources[]` |
| Unknown cost is never invented | `budget.requests_used` is measured; unknown remainders are `null`, not a guess |
| Failures are visible | `gaps[]` records the node, query and reason a branch did not complete |
| Work is bounded | `max_tokens`, `deadline_ms` and `max_nodes` cap the run before it starts |
| You know which engine answered | `engine_attribution` counts per engine |

### Passing work between agents

`session_handoff` is an MCP tool that packages a finished run into a brief another agent can act on —
resolvable evidence ids, open questions taken from gaps, contradictions, remaining budget, and the
next node to run. Roles: `planner`, `retriever`, `verifier`, `writer`, `observer`.

---

## Shaped context (0.5.0)

`POST /context` is one call for the thing agents actually need: **web text that fits a token
budget**, with numbered sources. It searches, optionally reads the top pages, filters by domain and
date, then assembles the excerpts until the budget is full.

```bash
curl -X POST http://localhost:8000/context \
  -H "Content-Type: application/json" \
  -d '{"query": "EU AI Act obligations for deployers",
       "token_budget": 2500, "fresh_days": 90,
       "include_domains": ["europa.eu"]}'
```

```json
{
  "context": "[1] AI Act ...\nhttps://...\n\nDeployers must ...\n\n---\n\n[2] ...",
  "sources": [{"title": "AI Act", "url": "https://...", "tokens": 412, "fetched": true}],
  "budget": {"requested": 2500, "used": 2331, "remaining": 169, "tokenizer": "tiktoken:o200k_base"},
  "warnings": []
}
```

- `fetch_pages: false` uses snippets only and makes no request to the result pages.
- `fresh_days` sets the engine's coarse time filter and then applies the exact day window.
- Results with no parseable date are kept and counted in `search.undated`; a window never
  silently drops a page because an engine omitted its date.
- The MCP tool `get_context` takes the same arguments and returns the block as text.

---

## Search engines

| Engine | Type | Notes |
|--------|------|-------|
| Google | Web | Full SERP data, paginated |
| Bing | Web | Rich snippets, paginated |
| Brave | Web | Privacy-focused |
| DuckDuckGo | Web | Instant answers |
| Yandex | Web | Russian market |
| Baidu | Web | Chinese market, paginated |
| YouTube | Video | Transcripts, metadata |
| Amazon | Shopping | Product data |
| eBay | Shopping | Listings, prices |

## Social platforms

Reddit · Twitter/X · YouTube · LinkedIn · TikTok · Instagram · Facebook · Threads · Hacker News · Bluesky · Telegram · Pinterest

---

## Official SDKs

All three expose the query graph and share the server's version.

### Python

```bash
pip install jiro-sdk
```

```python
from jiro_sdk import JiroClient

client = JiroClient(api_key="your-key")

# Classic search + scrape
results = client.search("python web scraping")
content = client.scrape("https://example.com")

# Query graph
plan = client.plan_search("compare vector databases")          # dry run, no network
run  = client.search_graph("compare vector databases", fetch_top=3)
for claim in run["packet"]["claims"]:
    print(claim["text"], claim["source_ids"])
```

### JavaScript / TypeScript

```bash
npm install jiro-sdk
```

```javascript
import { JiroClient } from 'jiro-sdk';

const client = new JiroClient({ apiKey: 'your-key' });

const results = await client.search('python web scraping');
const run = await client.searchGraph('compare vector databases', { fetchTop: 3 });

// WebSocket streaming
const ws = client.createSearchStream('AI news');
ws.onmessage = (event) => console.log(JSON.parse(event.data));
```

### Go

```bash
go get github.com/DevAnimecx/jiro/sdk/go
```

```go
import "github.com/DevAnimecx/jiro/sdk/go"

client := jiro.NewClient(jiro.WithAPIKey("your-key"))

results, _ := client.Search("python web scraping", nil)
run, _ := client.GraphSearch("compare vector databases", &jiro.GraphOptions{FetchTop: 3}, false)
```

---

## CLI

```bash
# Search
jiro search web "python web scraping"
jiro search web "AI news" --parallel --engines 3
jiro search web -i                      # interactive

# Scrape
jiro scrape https://example.com
jiro scrape "free SaaS directories"     # search + scrape top result

# AI
jiro ai ask "What is Python?"
jiro ai setup --provider openai -k sk-...

# Connect an agent (Claude Code, Cursor, OpenCode, Codex, ...)
jiro connect cursor

# System
jiro status && jiro doctor && jiro serve --port 8000
```

---

## MCP integration

Works with any MCP-compatible client — Claude Desktop, Claude Code, Cursor, OpenCode, Codex, VS Code and more.

```bash
jiro connect            # detect every installed client
jiro connect cursor     # or name one
jiro connect --list     # all 16 supported ids
```

It writes the client's own config file, backs up what was there, and records the
change so `jiro setup --uninstall --client <id>` can roll it back.

<details>
<summary>Manual config, if you prefer</summary>

```json
{
  "mcpServers": {
    "jiro": { "command": "jiro", "args": ["mcp"] }
  }
}
```

</details>

### 23 MCP tools

<details>
<summary><strong>Expand the full tool list</strong></summary>

| Tool | What it does |
|------|--------------|
| `search` | Search across 9 engines |
| `get_context` | Search and shape the web to a token budget |
| `scrape` | Scrape a URL to markdown |
| `smart_classify` | Classify search intent |
| `compare_engines` | Compare results across engines |
| `list_engines` | List available engines |
| `list_social_platforms` | List social platforms |
| `monitor_status` | Health and metrics |
| `health_check` | Live engine probes |
| `cache_stats` | Cache statistics |
| `task_submit` | Submit a background task |
| `task_status` | Poll a task |
| `task_cancel` | Cancel a task |
| `plan_search` | Plan a query graph, dry run |
| `ai_search` | AI research with citations |
| `search_hybrid` | Hybrid multi-signal search |
| `search_structured` | Structured data extraction |
| `social_scrape` | Scrape a social profile or post |
| `social_search` | Search social platforms |
| `social_batch` | Batch scrape URLs |
| `smart_search` | Intent-aware routing |
| `search_graph` | Execute a query graph, return the evidence packet |
| `session_handoff` | Package a run as a brief for another agent |

</details>

---

## Features

### Sourced answers
- **Query graph** — plans a research shape, then executes it
- **Evidence packets** — claims paired with resolvable source ids
- **Cost estimation** — dry-run a graph before paying for it
- **Gap reporting** — branches that failed say why
- **Session handoff** — pass a run to another agent as a structured brief
- **Durable runtime** — lease-based node execution that survives restarts

### Search intelligence
- **Hybrid search** — keyword + semantic + freshness signals
- **Multi-query** — parallel query expansion
- **Answer synthesis** — extractive answers from results
- **Pagination** — walks SERP pages until `num` is met or the budget runs out
- **Substitution reporting** — tells you when a fallback engine answered

### Web scraping
- **Stealth client** — TLS/JA3 fingerprint rotation and browser headers
- **Anti-bot friction** — improves access; it does not solve JS challenges
- **JS rendering** — optional Playwright browser mode
- **Structured extraction** — JSON-schema-driven
- **Social scraping** — 12 platforms, normalized output

### Operations
- **Rate limiting** — sliding window, configurable limits
- **Plugin system** — custom engines and scrapers
- **Advanced caching** — LRU/LFU with analytics
- **Batch operations** — concurrent search and scrape
- **Monitoring** — Prometheus metrics, health checks
- **WebSocket streaming** — real-time results

---

## Deploy

```bash
docker-compose up -d                       # Docker
helm install jiro ./helm              # Kubernetes
pip install jirosearch && jiro serve       # Local
```

---

## Comparisons

### vs SerpAPI

| | JIRO | SerpAPI |
|---|:----:|:-------:|
| Self-hosted | ✅ | ❌ |
| Cost | $0 | $50+/mo |
| Search engines | 9 | 1 (Google) |
| Social scraping | 12 platforms | ❌ |
| Sourced answers with source ids | ✅ | ❌ |
| MCP integration | ✅ | ❌ |
| Official SDKs | Python, JS, Go | Python, JS |

### vs ScraperAPI

| | JIRO | ScraperAPI |
|---|:----:|:----------:|
| Search engines | 9 | ❌ |
| Social platforms | 12 | ❌ |
| Query graph + citations | ✅ | ❌ |
| Self-hosted | ✅ | ❌ |

### vs Bright Data

| | JIRO | Bright Data |
|---|:----:|:-----------:|
| Self-hosted | ✅ | ❌ |
| Query graph + citations | ✅ | ❌ |
| MCP integration | ✅ | ❌ |
| Entry price | $0 | $500+/mo |

---

## Architecture

```
jiro/
├── server/routers/      FastAPI endpoints (80+ routes)
├── graph/               Query graph
│   ├── planner.py       Turns a query into a validated graph
│   ├── executor.py      Ready-driven DAG execution
│   ├── operators.py     SEARCH / FETCH / VERIFY / SYNTHESIZE nodes
│   └── service.py       Plan + run entry points
├── parametric/packet.py Evidence packet assembly
├── search/              Hybrid search, reranking, query expansion
├── scraping/            9 engines, stealth client, 12 social platforms
├── ai/                  LLM integration + MCP tool schemas
├── runtime/             Durable execution, leases, config
├── context.py           Budgeted context assembly (POST /context)
├── mcp.py               MCP server (23 tools)
├── cache_advanced.py    Cache with analytics
└── dashboard.py         Web UI
```

### Exit codes

For scripting and CI, the CLI distinguishes outcomes rather than collapsing them:

| Code | Meaning |
|:----:|---------|
| `0` | Success |
| `1` | Failure |
| `2` | Usage error |
| `3` | Substituted — a fallback engine answered |

---

## Pricing

**Free. All of it. MIT.**

| | Jiro |
|---|:---:|
| Price | $0 |
| Search engines | All 9 |
| Social platforms | All 12 |
| Query graph and citations | ✓ |
| MCP server | ✓ |
| Requests | Unlimited (your hardware, your rules) |
| Commercial use | ✓ (MIT) |
| Cloud account required | No |

No credits, no tiers, no "contact sales." `pip install jirosearch && jiro serve`.

---

## FAQ

**Do I need API keys for the search engines?**
No. All 9 engines are scraped directly. No Google, Bing or SerpAPI keys required.

**Can I run JIRO fully offline?**
The server runs locally, but it reaches out to the engines you query. Point it at an internal
mirror or disable engines you don't want in the config.

**What makes the answers checkable?**
Every claim in the evidence packet carries `source_ids` that resolve against `packet.sources[]`.
A claim whose sources can't be resolved is flagged, not silently dropped.

**How is this different from a search API like SerpAPI?**
SerpAPI returns links from one engine. JIRO searches 9, fetches and extracts the pages, and returns
claims with citations — plus it's self-hosted, so there's no per-query bill.

**Is it really free?**
Yes. MIT, every feature, no account, no request quota from us. Your only costs are the machine
you run it on and whatever proxies you choose to add.

**Can I pass research between AI agents?**
Yes — the `session_handoff` MCP tool packages a run into a brief with evidence ids, open questions
and remaining budget, ready for the next agent to pick up.

---

## Community

- [Website](https://github.com/DevAnimecx/jiro) — home
- [GitHub](https://github.com/DevAnimecx/jiro) — source
- [Docs](https://github.com/DevAnimecx/jiro/blob/main/docs/README.md) — guides
- [Blog](https://github.com/DevAnimecx/jiro/tree/main/blog) — articles
- [Discord](https://discord.gg/jiro) — chat
- [Twitter](https://twitter.com/jirosearch) — updates

## License

MIT — use it freely, commercially or privately.

---

<div align="center">

**Built by [Blackvault Technology](https://github.com/DevAnimecx)**

[Docs](https://github.com/DevAnimecx/jiro/blob/main/docs/README.md) · [GitHub](https://github.com/DevAnimecx/jiro)

</div>
