Skip to main content

OpenFisca-Japan-MCP

OpenFisca-Japan-MCP は、日本の税制・社会保障制度をシミュレーションするOSSのOpenFisca-Japan を、 MCP (Model Context Protocol) 経由でアクセス可能なサーバーおよび Python SDK です。本サーバーはMCPクライアント(Claude Codeなど)が利用しやすい型とインターフェースを提供します。

特徴

LLMは単独でも日本の税制・社会保障制度を知っており、入力された世帯情報をもとにそれらの金額を計算することができます。
しかし、OpenFisca-Japan-MCPを用いることで、再現性・透明性のある制度計算が可能になります。特に所得税や社会保険料、生活保護など多段階のステップで算出される制度において、検証が容易になります。 また、複数の世帯を一括して計算可能なため、大規模シミュレーションのオーバーヘッドを削減できます。(一括であっても、MCPクライアントが大規模データを読み込み、サーバーとやりとりするトークンは必要になります。)

制限事項

主に官庁・自治体が公開している制度情報を基に計算ロジックを実装していますが、例外的な条件などは反映されていない場合があり、完全に正しい結果を保証するものではありません。あくまで目安としてご利用ください。
OpenFisca-JapanのGitHubリポジトリ上で、実装されている計算ロジックおよび必要条件を確認できます。

機能 (Tools)

  • tax_benefit_info(tax_benefit_name): 入力された制度を計算するために必要な属性情報を取得します。
  • calculate_tax_benefit(household_list, output_tax_benefit_list, date): 世帯の配列データを元に、指定した制度の金額を計算し、元の配列を拡張して返します。

データ構造の例

calculate_tax_benefit ツールに渡す household_list は以下のような構造になります。

[
  {
    "name": "世帯1",
    "household_attribute": {
      "居住都道府県": "東京都",
      "居住市区町村": "千代田区"
    },
    "member_attribute": [
      {
        "name": "親1",
        "年齢": 40,
        "年収": 6000000,
        "個人事業主の必要経費": 0
      },
      {
        "name": "子1",
        "年齢": 10,
        "年収": 0
      }
    ]
  }
]

対応制度

  • 所得税
  • 住民税
  • 社会保険料
  • 児童手当
  • 生活保護

MCP Client からの利用

openfisca-japan-mcp は PyPI に登録されており、uvx を使用して、様々な MCP クライアントから簡単に呼び出すことができます。

PythonパッケージマネージャーのuvがローカルPCにインストールされている必要があります。

設定の基本構成 (JSON)

多くのクライアント(Claude, Copilot, Gemini など)では、以下の内容を設定ファイルに追加します。

{
  "mcpServers": {
    "openfisca-japan-mcp": {
      "command": "uvx",
      "args": ["--python", "3.11", "openfisca-japan-mcp"]
    }
  }
}

各クライアントの設定場所

  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Claude Code (CLI): 以下のように CLI コマンドで追加するのが推奨されています。
    claude mcp add openfisca-japan-mcp -- uvx --python 3.11 openfisca-japan-mcp
    
    (手動設定の場合は ~/.claude.json に追記します)
  • GitHub Copilot CLI: ~/.config/github-copilot/mcp-servers.json
  • Gemini CLI / Google AI Studio: ~/.gemini/settings.json
  • Cursor / Codex:
    • 設定画面の MCP セクションから以下のコマンドを登録します。
    • Type: command
    • Command: uvx --python 3.11 openfisca-japan-mcp

ローカルでの開発・検証

GitHub からクローンしたリポジトリを直接参照する場合は、--from オプションでディレクトリを指定します。

{
  "mcpServers": {
    "openfisca-japan-mcp": {
      "command": "uvx",
      "args": [
        "--python", "3.11",
        "--from", "/path/to/OpenFisca-Japan-MCP",
        "openfisca-japan-mcp"
      ]
    }
  }
}

Python SDK としての利用

MCP を介さず、Python ライブラリとして直接計算ロジックを利用することも可能です。

from openfisca_japan_mcp.sdk import calc

household_list = [
    {
        "name": "household1",
        "household_attribute": { "居住都道府県": "東京都" },
        "member_attribute": [
            { "name": "member1", "年齢": 35, "年収": 5000000 }
        ]
    }
]

# 計算の実行
result = calc(
    household_list, 
    [{"name": "児童手当", "household_or_member": "household"}]
)

print(result[0]["household_attribute"]["児童手当"])

開発者向けのセットアップ

リポジトリをクローンしてローカルで開発・テストを行う手順です。

  1. リポジトリのクローン

    git clone https://github.com/project-inclusive/OpenFisca-Japan-MCP.git
    cd OpenFisca-Japan-MCP
    
  2. 依存関係のインストール uv を使用して環境を構築します。Python 3.11 がインストールされている必要があります。

    uv python install 3.11
    uv sync --python 3.11
    
  3. テストの実行

    uv run test.py
    

ライセンス

Apache License 2.0

Metadata

Release files for openfisca-japan-mcp 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openfisca-japan-mcp 0.2.4
File Size Uploaded Provenance Actions
openfisca_japan_mcp-0.2.4.tar.gz 53.4 kB With provenance Details for openfisca_japan_mcp-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openfisca-japan-mcp 0.2.4
File Interpreter ABI Platform Actions
openfisca_japan_mcp-0.2.4-py3-none-any.whl Python 3 none any Details for openfisca_japan_mcp-0.2.4-py3-none-any.whl

Total release size: 68.5 kB

Release files / openfisca_japan_mcp-0.2.4.tar.gz

Download URL openfisca_japan_mcp-0.2.4.tar.gz
Size 53.4 kB
Tags Source
SHA-256 checksum
How to use checksums
64ae4e93b71b0603f5ead649d090162d42ef2fb86e0d867574dff6e919673d08
BLAKE2b-256 checksum
How to use checksums
2eff299810046339341b31fd7a4d43060ea9ae3db70307142a61619904efa98d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / openfisca_japan_mcp-0.2.4-py3-none-any.whl

Download URL openfisca_japan_mcp-0.2.4-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d492f92c46badd17c170192db9b88ec939533d0ace2da0682235f7398de099bd
BLAKE2b-256 checksum
How to use checksums
47214ce9879570acd9b511c88fd7248f492df044d8ee78c02b4c5432a2ae8392
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Security for openfisca-japan-mcp 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openfisca_japan_mcp-0.2.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page