Metadata-Version: 2.4
Name: autonomath-mcp
Version: 0.3.0
Summary: AutonoMath — Japanese public-program API + MCP server + npm SDK (66 tools): 13,578 programs + 2,286 case studies + 108 三軸分解 loans + 1,185 enforcement cases + 9,484 laws + 35 tax rulesets + 2,065 court decisions + 362 bids + 13,801 invoice registrants + 503,930 autonomath entities + 6.12M facts + 23,805 relations + 335,605 aliases, 181 exclusion/prerequisite rules, primary-source lineage. SLA 99.5% monthly uptime.
Project-URL: Homepage, https://autonomath.ai
Project-URL: Documentation, https://autonomath.ai/docs/
Project-URL: Repository, https://github.com/AutonoMath/autonomath-mcp
Project-URL: Issues, https://github.com/AutonoMath/autonomath-mcp/issues
Author-email: Bookyou株式会社 <info@bookyou.net>
License: MIT
License-File: LICENSE
Keywords: claude,government,japan,llm,mcp,rest-api,subsidy
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: email-validator<3,>=2.0
Requires-Dist: fastapi<0.120,>=0.115
Requires-Dist: httpx<1.0,>=0.28
Requires-Dist: keyring<26,>=24.0
Requires-Dist: mcp>=1.2
Requires-Dist: orjson<4,>=3.10
Requires-Dist: pydantic-settings<3,>=2.6
Requires-Dist: pydantic<3,>=2.9
Requires-Dist: python-multipart<1,>=0.0.17
Requires-Dist: scipy<2,>=1.14
Requires-Dist: sentry-sdk[fastapi]<3,>=2.19
Requires-Dist: sqlite-utils<4,>=3.38
Requires-Dist: stripe<13,>=11.3
Requires-Dist: structlog>=24.4
Requires-Dist: tenacity<10,>=9.0
Requires-Dist: uvicorn[standard]<0.40,>=0.32
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: duckdb>=1.1; extra == 'dev'
Requires-Dist: httpx>=0.28; extra == 'dev'
Requires-Dist: huggingface-hub<1,>=0.25; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pre-commit>=4.0; extra == 'dev'
Requires-Dist: pyarrow<25,>=18; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: e2e
Requires-Dist: httpx>=0.28; extra == 'e2e'
Requires-Dist: playwright>=1.48; extra == 'e2e'
Requires-Dist: pytest-asyncio>=0.24; extra == 'e2e'
Requires-Dist: pytest-playwright>=0.6; extra == 'e2e'
Requires-Dist: pytest>=8.3; extra == 'e2e'
Provides-Extra: site
Requires-Dist: jinja2>=3.1; extra == 'site'
Requires-Dist: pykakasi>=2.2; extra == 'site'
Description-Content-Type: text/markdown

# AutonoMath — Japanese Subsidy/Grant/Loan Database API + MCP Server

[![PyPI version](https://img.shields.io/pypi/v/autonomath-mcp.svg)](https://pypi.org/project/autonomath-mcp/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-3776AB.svg?logo=python&logoColor=white)](https://www.python.org/)
[![MCP 2025-06-18](https://img.shields.io/badge/MCP-2025--06--18-6E56CF.svg)](https://modelcontextprotocol.io/)
[![CodeQL](https://github.com/AutonoMath/autonomath-mcp/workflows/CodeQL/badge.svg)](https://github.com/AutonoMath/autonomath-mcp/actions/workflows/codeql.yml)
[![Made in Japan](https://img.shields.io/badge/made%20in-%F0%9F%87%AF%F0%9F%87%B5-red.svg)](https://autonomath.ai)

日本の公的制度 (補助金・融資・税制・認定) **13,578 件** + 採択事例 **2,286** + 融資 **108** (担保・個人保証人・第三者保証人 三軸分解) + 行政処分 **1,185** + 法令 **9,484** + 判例 **2,065** + 入札 **362** + 適格事業者 **13,801** を横断検索する REST + MCP API。AI エージェント・Claude Desktop・企業内 RAG 向け。

## Why AutonoMath

- **13,578 programs** across 47 prefectures + national (補助金・融資・税制・認定)
- **2,286 採択事例 + 108 融資 + 1,185 行政処分 + 2,065 court decisions + 362 bids** — 単なる制度 DB ではなく「発見 + 併用可否判定 + 実績確認 + vendor vetting + 判例 + 入札」を 1 API
- **181 exclusion / prerequisite rules** for automatic 併給不可 + 前提条件 detection (125 exclude + 17 prerequisite + 15 absolute + 24 other kinds, 農業系 + 非農業系)
- **MCP native** — 66 tools (38 コア: 制度検索・採択事例・融資・行政処分 + prescreen + upcoming_deadlines + 7 one-shot discovery (smb_starter_pack / subsidy_combo_finder / deadline_calendar / dd_profile_am / similar_cases / regulatory_prep_pack / subsidy_roadmap_3yr) + 拡張 [法令 e-Gov CC-BY 9,484 件・継続ロード中 / 税務ruleset インボイス+電帳法 35 件 live / 適格事業者 13,801 件 delta / 判例 2,065 件 / 入札 362 件 + cross-dataset glue] / 24 autonomath: 503,930 entities + 6.12M facts + 23,805 relations + 335,605 aliases の entity-fact DB + list_tax_sunset_alerts + V4 universal annotation/validation/provenance + Phase A static/example/template/health)、protocol 2025-06-18、stdio で Claude Desktop / Cursor / ChatGPT / Gemini から直呼び
- **REST API** — 30+ endpoints: `/v1/programs/*`, `/v1/laws/*`, `/v1/tax_rulesets/*`, `/v1/case-studies/*`, `/v1/loan-programs/*`, `/v1/enforcement-cases/*`, `/v1/exclusions/*`, `/v1/am/*` (16 autonomath), customer self-serve `/v1/me/*` (cap / dashboard / usage_by_tool / billing_history / tool_recommendation / alerts / testimonials), transparency `/v1/stats/{coverage,freshness,usage}`, public `/v1/testimonials`. 完全な OpenAPI: [`docs/openapi/v1.json`](./docs/openapi/v1.json)
- **REST fallback** — curl / Python / Node / anywhere
- **Primary-source URLs on 99%+ of rows** (source_url + fetched_at; 12件は小規模自治体 CMS 不在のため URL 未取得、aggregator は除外)
- **¥3/req metered** (税込 ¥3.30)、匿名 50 req/月 無料 (登録不要、JST 月初リセット)

## 30-second quickstart (Claude Desktop)

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "autonomath": {
      "command": "uvx",
      "args": ["autonomath-mcp"]
    }
  }
}
```

Restart Claude Desktop, then ask: 「農業に使える東京都の補助金を教えて。」

## 30-second quickstart (REST)

```bash
# Primary (X-API-Key header, used across our docs)
curl "https://api.autonomath.ai/v1/programs/search?q=農業&prefecture=東京都" \
  -H "X-API-Key: YOUR_API_KEY"

# Also supported: Bearer token
curl "https://api.autonomath.ai/v1/programs/search?q=農業&prefecture=東京都" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Get an API key at <https://autonomath.ai/>.

## MCP tools

66 tools (38 コア + 24 autonomath: 17 V1 + 4 V4 universal + 7 Phase A), MCP protocol `2025-06-18`, FastMCP over stdio. 完全なリストと引数は [docs/mcp-tools.md](./docs/mcp-tools.md) を参照 (Single source of truth)。

| Group | Tools |
|-------|-------|
| Programs | `search_programs`, `get_program`, `batch_get_programs`, `prescreen_programs`, `upcoming_deadlines` |
| Case studies | `search_case_studies`, `get_case_study` |
| Loans (3-axis) | `search_loan_programs`, `get_loan_program` |
| Enforcement | `search_enforcement_cases`, `get_enforcement_case` |
| Exclusion rules | `list_exclusion_rules`, `check_exclusions` |
| Meta / vocabulary | `get_meta`, `enum_values` |
| Laws (e-Gov, CC-BY) | `search_laws`, `get_law`, `list_law_revisions` |
| Court decisions | `search_court_decisions`, `get_court_decision`, `find_precedents_by_statute` |
| Bids (GEPS + 自治体) | `search_bids`, `get_bid`, `bid_eligible_for_profile` |
| Tax rulesets (インボイス + 電帳法) | `search_tax_rules`, `get_tax_rule`, `evaluate_tax_applicability` |
| Invoice registrants (PDL v1.0) | `search_invoice_registrants` |
| Cross-dataset glue | `trace_program_to_law`, `find_cases_by_law`, `combined_compliance_check` |
| AutonoMath entity-fact (autonomath.db) — V1 (17) | `search_tax_incentives`, `search_certifications`, `list_open_programs`, `enum_values_am`, `search_by_law`, `active_programs_at`, `related_programs`, `search_acceptance_stats_am`, `intent_of`, `reason_answer`, `get_am_tax_rule`, `search_gx_programs_am`, `search_loans_am`, `check_enforcement_am`, `search_mutual_plans_am`, `get_law_article_am`, `list_tax_sunset_alerts` |
| AutonoMath V4 universal (4) | `get_annotations`, `validate`, `get_provenance`, `get_provenance_for_fact` |
| AutonoMath Phase A (7) | `list_static_resources_am`, `get_static_resource_am`, `list_example_profiles_am`, `get_example_profile_am`, `render_36_kyotei_am`, `get_36_kyotei_metadata_am`, `deep_health_am` |

## REST API & SDKs

> WARNING: SDKs are pre-release — published PyPI/npm packages coming after v0.1.0 tag.

**OpenAPI spec**

- Live: <https://api.autonomath.ai/openapi.json>
- Committed copy: [`docs/openapi/v1.json`](./docs/openapi/v1.json)

**Python SDK** (`autonomath`) — hand-written, lives at [`sdk/python/autonomath/`](./sdk/python/autonomath/). Not yet on PyPI. Direct install from git:

```bash
pip install "git+https://github.com/AutonoMath/autonomath-mcp.git#subdirectory=sdk/python"
```

**TypeScript / JavaScript SDK** (`@autonomath/sdk`) — lives at [`sdk/typescript/src/`](./sdk/typescript/src/). Available on npm as well as direct git install:

```bash
# npm (preferred)
npm install @autonomath/sdk

# or direct from git
npm install "git+https://github.com/AutonoMath/autonomath-mcp.git#subdirectory=sdk/typescript"
```

The package ships dual ESM + CJS output with `.d.ts` and exposes both REST (`@autonomath/sdk`) and MCP (`@autonomath/sdk/mcp`) entry points. Zero runtime dependencies (uses platform `fetch`).

**Runnable examples**

- Python: [`examples/python/`](./examples/python/) — search by prefecture, check exclusions, program detail, pandas CSV export
- TypeScript: [`examples/typescript/`](./examples/typescript/) — search, exclusions, MCP CLI, Next.js page

## Install (Python)

```bash
pip install autonomath-mcp
# or
uvx autonomath-mcp
```

## Data sources

All programs cite primary sources — 経産省, 農林水産省 (MAFF), 日本政策金融公庫 (JFC), 総務省, and 47 都道府県公報. 99%+ records carry `source_url` + `source_fetched_at` lineage (12 rows are small-municipality programs lacking a dedicated CMS page). Schema documented at [/docs/json_ld_strategy](https://autonomath.ai/docs/json_ld_strategy).

## Evaluation

Tool quality is publicly verifiable: see [`evals/`](./evals/) for a 79-query gold-standard suite (`gold.yaml` + `run.py`) covering 農業 / 製造 / IT / 創業 / 都道府県 / 税制 / 融資 / 採択事例 / prescreen / 行政処分 / cross-dataset / edge cases / 7 one-shot discovery tools (smb_starter_pack / deadline_calendar / subsidy_combo_finder / similar_cases / subsidy_roadmap_3yr / regulatory_prep_pack). Every `expected_ids` list was generated by calling the live MCP tool against `data/jpintel.db`; CI runs the suite on every PR. Per-tool precision table: see [`docs/per_tool_precision.md`](./docs/per_tool_precision.md). Run locally with `.venv/bin/python evals/run.py`.

## Self-serve dashboards & transparency

- **Dashboard** (authenticated): `GET /v1/me/dashboard` — month-to-date spend, request count, cap state, top tools. See [`docs/dashboard_guide.md`](./docs/dashboard_guide.md).
- **Amendment alerts**: `POST /v1/me/alerts/subscribe` — subscribe by tool / law_id / program_id / industry_jsic / all, with severity gating (critical / important / info). See [`docs/alerts_guide.md`](./docs/alerts_guide.md).
- **Stats** (public transparency): `GET /v1/stats/coverage` (per-prefecture / authority / kind program counts), `GET /v1/stats/freshness` (per-source `source_fetched_at` distribution), `GET /v1/stats/usage` (anonymised request volume).

## Pricing

- **Free** — 50 req/月 per IP (JST 月初 00:00 リセット、登録不要)
- **Paid** — ¥3/req 税別 (税込 ¥3.30) metered (Stripe、外税表示)
- **No tiers. No seat fees. No annual minimums.**

## Roadmap (gated cohorts)

These cohorts ship with the schema in place at launch; tools are
gated behind feature flags and primary-source ingest is rolling.

- **V4 absorption** (complete 2026-04-25, ships in v0.3.0) —
  Autonomath absorption CLI landed migrations 046–049 (annotations /
  validation rules / program health + 3 ALTERs) and four universal
  MCP tools (`get_annotations`, `validate`, `get_provenance/{entity}`,
  `get_provenance/fact/{fact}`). Ingest landed: examiner_feedback
  (~16,474 annotations from 8,189 program-resolved feedback) / gbiz
  (~79,876 new corp entities + ~861K corp.* facts) / case-study
  supplement (~1,901 new rows). Tool count 55 → **59**; `am_entities`
  424,054 → **503,930**; `am_entity_facts` 5.26M → **6.12M**. **v0.3.0
  manifest bump landed 2026-04-25** — `pyproject.toml` / `server.json` /
  `mcp-server.json` / `dxt/manifest.json` / `smithery.yaml` now report
  the post-V4 / post-Phase-A numbers. No env flag — universal once shipped.
- **Phase A absorption** (complete 2026-04-25, ships in v0.3.0) —
  +7 MCP tools (`list_static_resources_am`, `get_static_resource_am`,
  `list_example_profiles_am`, `get_example_profile_am`,
  `render_36_kyotei_am`, `get_36_kyotei_metadata_am`, `deep_health_am`)
  + 8 静的タクソノミ + 5 example profiles + 4 utility modules
  (`wareki` / `jp_money` / `jp_constants` / `templates/saburoku_kyotei`)
  + `models/premium_response.py` + `/v1/am/health/deep` mounted on
  `health_router` (no AnonIpLimitDep). Tool count 59 → **66**.
- **Healthcare V3** (T+90d, 2026-08-04) — `medical_institutions` +
  `care_subsidies` (migration 039); +6 MCP tools when
  `HEALTHCARE_ENABLED=true`. Plan: [`docs/healthcare_v3_plan.md`](./docs/healthcare_v3_plan.md).
- **Real Estate V5** (T+200d) — `real_estate_programs` +
  `zoning_overlays` (migration 042); +5 MCP tools when
  `REAL_ESTATE_ENABLED=true`. Plan: [`docs/real_estate_v5_plan.md`](./docs/real_estate_v5_plan.md).

## SLA & infrastructure

- **Monthly uptime target: 99.5%** on `api.autonomath.ai` (Fly.io
  Tokyo + Cloudflare Pages + Cloudflare WAF). Token-bucket rate-limit
  middleware + WAF managed-ruleset are in front of every request.
  See [`docs/sla.md`](./docs/sla.md).
- **Tokushoho disclosure** — full statutory disclosure under 特定商取引法
  at [`site/tokushoho.html`](./site/tokushoho.html).
- **Spec surfaces** — `site/llms.txt` and `site/llms-full.txt` (JA);
  `site/llms.en.txt` and `site/llms-full.en.txt` (EN) for AI-agent
  discovery.

## Support

- Docs: <https://autonomath.ai/docs/>
- Issues: <https://github.com/AutonoMath/autonomath-mcp/issues>
- Email: <info@bookyou.net>

## License

MIT © 2026 [Bookyou株式会社](https://bookyou.net) (T8010001213708) — 代表 梅田茂利
</content>
</invoke>