Skip to main content
Glama
Aiyatullah

estv-tax

by Aiyatullah

Swiss Tax Calculator — MCP Server & Python API

MIT ライセンスのもとで、Al Aiyatullah Saiyed が提供しています。

二つの用途に使えるスイスの税務ツールキットです:アプリケーションでは Python API クライアント として使用できるほか、MCP サーバー として実行してClaude などのAIアシスタントに利用させることもできます。公式の ESTV Swiss Federal Tax Calculator をラップしており、APIキーや認証は不要です。

スイスの全自治体を対象に、2010〜2026年の課税年度について、所得・税・財産税・一時金の資本税・相続・贈与税・法人税をカバーしています。


ク ック スタート

インストール

# Clone the repository
git clone https://github.com/aiyatullah/swiss-tax-calculator-mcp.git
cd swiss-tax-calculator-mcp

# Install dependencies
uv sync

Related MCP server: Swiss Health MCP Server

Python APIとしての利用

Pythonコードで EstvClient を直接インポートすると、ESTV の税務計算機をプログラム的に呼び出せます。

基本例 — 場所の検索

from estv_mcp import EstvClient

client = EstvClient()

# Search for a municipality by name or postal code
locations = client.search_location("Zug", tax_year=2026)
for loc in locations[:3]:
    print(f"{loc['City']} ({loc['Canton']}) — ID: {loc['TaxLocationID']}")

所得税の計算

from estv_mcp.api import EstvClient, RELATIONSHIP, CONFESSION, INCOME_TYPE

client = EstvClient()

# Step 1: Find the tax location
locations = client.search_location("8001", tax_year=2026)
location_id = locations[0]["TaxLocationID"]

# Step 2: Get the tax budget (deduction sheet)
budget = client.tax_budget({
    "SimKey": None,
    "TaxYear": 2026,
    "TaxLocationID": location_id,
    "Relationship": RELATIONSHIP["single"],
    "Confession1": CONFESSION["none"],
    "Confession2": 0,
    "Children": [],
    "Age1": 35,
    "RevenueType1": INCOME_TYPE["employed"],
    "Revenue1": 120_000,
    "Age2": 0,
    "RevenueType2": 0,
    "Revenue2": 0,
    "Fortune": 50_000,
})

# Step 3: Calculate detailed taxes
result = client.detailed_taxes({
    "SimKey": None,
    "TaxYear": 2026,
    "TaxLocationID": location_id,
    "Relationship": RELATIONSHIP["single"],
    "Confession1": CONFESSION["none"],
    "Confession2": 0,
    "Children": [],
    "Age1": 35,
    "RevenueType1": INCOME_TYPE["employed"],
    "Revenue1": 120_000,
    "Age2": 0,
    "RevenueType2": 0,
    "Revenue2": 0,
    "Fortune": 0,
    "Budget": budget,
})

print(f"Total tax: CHF {result['TotalTax']:,.0f}")
print(f"Federal:   CHF {result.get('IncomeTaxFed', 0):,.0f}")
print(f"Cantonal:  CHF {result.get('IncomeTaxCanton', 0):,.0f}")
print(f"Municipal: CHF {result.get('IncomeTaxCity', 0):,.0f}")

自治体の比較

from estv_mcp.api import EstvClient, RELATIONSHIP, CONFESSION, INCOME_TYPE, GROUP_CAPITALS

client = EstvClient()

# Compare tax burden across all 26 cantonal capitals
rows = client.many_simple_taxes({
    "SimKey": None,
    "TaxYear": 2026,
    "TaxGroupID": GROUP_CAPITALS,
    "Relationship": RELATIONSHIP["single"],
    "Confession1": CONFESSION["none"],
    "Confession2": 0,
    "Children": [],
    "Age1": 35,
    "RevenueType1": INCOME_TYPE["employed"],
    "Revenue1": 100_000,
    "Age2": 0,
    "RevenueType2": 0,
    "Revenue2": 0,
    "Fortune": 0,
})

ranked = sorted(rows, key=lambda r: r["TotalTax"])
print("Top 5 cheapest cantonal capitals:")
for r in ranked[:5]:
    loc = r["Location"]
    print(f"  {loc['City']} ({loc['Canton']}): CHF {r['TotalTax']:,.0f}")

相続税

from estv_mcp.api import EstvClient, BENEFICIARY, GROUP_CAPITALS

client = EstvClient()

# Inheritance tax for a sibling across cantonal capitals
rows = client.many_inheritance_taxes({
    "SimKey": None,
    "TaxYear": 2026,
    "TaxGroupID": GROUP_CAPITALS,
    "OnlyGroupID": BENEFICIARY["sibling"][0],
    "OnlyPersonID": BENEFICIARY["sibling"][1],
    "Donation": False,
    "Amount": 500_000,
})

ranked = sorted(rows, key=lambda r: r["TaxTotal"])
print(f"Cheapest: {ranked[0]['Location']['City']} — CHF {ranked[0]['TaxTotal']:,.0f}")
print(f"Most expensive: {ranked[-1]['Location']['City']} — CHF {ranked[-1]['TaxTotal']:,.0f}")

利用可能なAPI 操作

| メソッド | 説明 | | ------------------- | | search_location(query, tax_year) | 自治体を名前・郵便番地で検索 | | search_location_geo(lat, lon, radius_km, tax_year) | 半径内の自治体を検索 | | tax_budget(payload) | 世帯単位の控除・予算表を取得 | | detailed_taxes(payload) | 内訳付きの全税務計算 | | simple_taxes(payload) | あらかじめ計算された課税対金額から税を計算 | | many_simple_taxes(payload) | 複数自治体間で税務を比較 | | many_capital_taxes(payload) | 複数自治体の一時金資産(キャッシュ)に対する税を比較 | | many_inheritance_taxes(payload) | 複数自治体の相続・贈与税を比較 | | many_legal_entity_taxes(payload) | 複数自治体の法人税を比較 | | export_tax_scales(tax_year, tax_group_id) | 税率(税額表)の生データを取得 | | tax_year_range(calculator) | 計算ごとの対応した年の範囲 | | tax_version() | 現在のESTV データ バージョン |

列挙型リファレンス

from estv_mcp.api import (
    RELATIONSHIP,      # single=1, married=2, concubinage=3, registered_partnership=4
    CONFESSION,        # reformed=1, roman_catholic=2, christ_catholic=3, none=4, other=5
    INCOME_TYPE,       # employed=1, self_employed=2, pensioner=3, other=4
    GENDER,            # male=1, female=2
    LANGUAGE,          # de=1, fr=2, it=3, en=4
    CANTON_GROUP,      # AG=1 ... ZH=26
    GROUP_CAPITALS,    # 88 — all 26 cantonal capitals
    GROUP_SWITZERLAND, # 99 — every municipality (~2100)
    CALCULATOR,        # income_wealth=1, capital_payment=2, legal_entity=3, inheritance=5
    BENEFICIARY,       # spouse, child, sibling, unrelated, etc. → (GroupID, PersonID)
)

キャッシュ

_response は ~/.cache/estv-mcp に1週間キャッシュされます。環境変数で制御できます:

環境変数

効果

ESTV_MCP_NO_CACHE=1

キャッシュを完全に無効化

ESTV_MCP_CACHE_DIR=/path

キャッシュ・ディレクトリを変更

ESTV_MCP_CACHE_TTL=3600

キャッシュの有効期間(秒)


MCPサーバーとしての利用方法

このプロジェクトをMCPサーバーとして実行し、AIアシスタント(Claude Codeなど)にスイス税務ツールを提供できます。

Claude Codeへの登録

# Project-local (this repo only)
claude mcp add estv-tax -- uv run --directory "$PWD" estv-mcp

# User-wide (available in every project)
claude mcp add -s user estv-tax -- uv run --directory "$PWD" estv-mcp

MCPクライアント設定(JSON)

MCP互換のクライアントには、その設定に次を追加してください:

{
  "mcpServers": {
    "estv-tax": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/swiss-tax-calculator-mcp", "estv-mcp"]
    }
  }
}

AI が行えること

接続後、AIアシスタントは次のようなことができます:

  • 「チューリ・でCHF 150,000の所得の場合、税額はいくらか?」find_locationcalculate_tax を呼び出し

  • 「子ど・2人者夫妻、ツークとシュヴィッで比較してください」compare_locations を呼び出し

  • 「チューリッ中央駅から30km圏内で最全くの場所はどこですか?」find_cheapest_neearby を呼び出し

  • 「企業年金(2ののというの列)の引き出しは複数年分けに分けるべきですか?」plan_capital_withdrawals を呼び出し

  • 「ジュエーヴで兄弟が相続した場合の相続税はいくらですか?」calculate_inheritance_tax を呼び出し

  • 「ツールクとルシェルンでは、会社方の税額はどれくらいかわりますか?」calculate_company_tax を呼び出し


開発

uv sync                                          # Install dependencies (including dev)
uv run pytest -q                                  # Run tests (hits live ESTV API)
uv run python scripts/stdio_smoke.py              # MCP stdio handshake test
uv run ruff check . && uv run ruff format --check .  # Lint & format check

Golden Values

tests/golden.json は、課税年度が固定された年の既知の税務数値を固定しています。毎週の CI 実行がライブAPI に照らして再確認し、上流の変更を検出します。

uv run python scripts/update_golden.py   # Update golden values (prints diffs)

CI

テスートは Python3.11/3.12/3.13 で実行、push のたびと、毎周スケジュールで ESTV データの変更をチェックします。


重要な注意事項

  • すべての金額は CHF/年 です

  • income_type='employed' とは、総給与を意味し、社会の保険料(AHV/IV/EO、ALV、NBU、BVG)は自動的に算出されます

  • 控除は list_deductions の ID を使って deductions={id: value} の形で上書きすることができます(例: 柱資産 3a には PRAEMIEN3A、抵当ローン利息には SCHULDZINSEN

  • compare_locations(scope='switzerland') は、約 2,100の自・体を対象とし、結果は読みやすさ維持のため集約されます

  • 繳会none 以外のときだけ、教会税が適用されます

  • 数字は公式の ESTV モデルによるもので、法的に拘束力のある査定ではありません


ライセンス

MIT License — LICENSE を参照してください。

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to calculate French individual income tax and retrieve current tax brackets using official government data. Supports household composition calculations and provides up-to-date tax information for French residents.
    11
    14
  • A
    license
    B
    quality
    D
    maintenance
    Provides AI assistants access to 1.6 million Swiss health insurance premium records from 55 insurers across 11 years (2016-2026), enabling price comparisons, historical analysis, and finding the cheapest insurance options based on location, age, and coverage preferences.
    4
    56
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Provides AI-native access to Swiss Federal Statistical Office datasets through 9 tools for querying education, population, and cross-cantonal comparisons without authentication.
    15
    2
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables AI assistants to answer tax compliance questions (VAT, sales tax, GST) and validate EU VAT numbers in real time via the VIES registry.
    2
    12
    MIT

View all related MCP servers

Related MCP Connectors

  • Current source-cited 2026 US tax constants and calculators for AI agents; every answer cites IRS.

  • Free public tax MCP: GST/VAT, income, company & capital-gains tax for 50+ countries, source-cited.

  • Validate EU, UK, AU VAT numbers for AI agents. EU ViDA e-invoicing compliance.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Aiyatullah/swiss-tax-calculator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server