Skip to main content
Glama
Aiyatullah

estv-tax

by Aiyatullah

Swiss Tax Calculator — MCP-Server & Python-API

Lizenziert unter MIT von Aiyatullah Saiyed.

Ein Schweizer Steuer-Toolkit mit doppeltem Zweck: Verwenden Sie es als Python-API-Client in Ihren Anwendungen oder führen Sie es als MCP-Server für KI-Assistenten wie Claude aus. Es kapselt den offiziellen ESTV Swiss Federal Tax Calculator – ohne API-Schlüssel oder Authentifizierung.

Abgedeckt werden Einkommen-, Vermögens-, Kapitalbezugs-, Erbschafts- und Schenkungs- sowie Unternehmenssteuer für alle Schweizer Gemeinden in den Steuerjahren 2010–2026.


Features

Kategorie

Tools

Haushaltssteuer

find_location, calculate_tax, list_deductions, calculate_tax_from_taxable_amounts

Orte vergleichen

compare_locations, find_cheapest_nearby

Steuerplanung

plan_capital_withdrawals, deduction_value

Weitere Steuern

calculate_capital_payment_tax, calculate_inheritance_tax, calculate_company_tax

Referenz

explain_tax_brackets, get_tax_years


Related MCP server: Swiss Health MCP Server

Schnellstart

Installation

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

# Install dependencies
uv sync

Verwendung als Python-API

Importieren Sie EstvClient direkt in Ihren Python-Code, um die ESTV-Steuerberechnungen programmatisch abzufragen.

Basisfeispiel — Ort finden

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']}")

Einkommensteuer berechnen

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}")

Gemeinden vergleichen

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}")

Erbschaftsteuer

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}")

Verfügbare API-Operationen

Methode

Beschreibung

search_location(query, tax_year)

Gemeinden nach Namen oder Postleitzahl finden

search_location_geo(lat, lon, radius_km, tax_year)

Gemeinden in einem Radius finden

tax_budget(payload)

Abzüge-/Budgetübersicht für einen Haushalt abrufen

detailed_taxes(payload)

Vollständige Steuerberechnung mit Aufschlüsselung

simple_taxes(payload)

Steuer aus festgelegten steuerpflichtigen Beträgen

many_simple_taxes(payload)

Steuer für viele Gemeinden vergleichen

many_capital_taxes(payload)

Einmalein Kapitalbezugssteuer in Gemeinden vergleiche

many_inheritance_taxes(payload)

Erbschaft- und Schenkungsteuer in Gemeinden vergleichen

many_legal_entity_taxes(payload)

Unternehmenssteuer in Gemeinden vergleichen

tax_scales(tax_year, tax_group_id)

Rohe Steuertabellen exportieren

tax_year_range(calculator)

Unterstützter Steuerjahresbereich pro Rechner

tax_version()

Aktuelle ESTV-Datenversion

Enum-Referenz

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)
)

Caching

Antworten werden standardmäßig eine Woche unter ~/.cache/estv-mcp zwischengespeichert. Steuerung über Umgebungsvariablen:

Variable

Wirkung

ESTV_MCP_NO_CACHE=1

Caching vollständig deaktivieren

ESTV_MCP_CACHE_DIR=/path

Eigenes Cache-Verzeichnis

ESTV_MCP_CACHE_TTL=3600

Cache-Lebensdauer in Sekunden


Verwendung als MCP-Server

Führen Sie dieses Projekt als MCP-Server aus, damit KI-Assistenten (Claude, etc.) Zugriff auf alle Schweizer Steuerrechnungen erhalten.

Bei Claude Code registrieren

# 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-Client-Konfiguration (JSON)

Fügen Sie für jeden MCP-kompatiblen Client Ihrer Konfiguration Folgendes hinzu:

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

Was die KI tun kann

Nach der Verbindung kann der KI-Assistent:

  • „Wie viele Steuern würde ich in Zürich auf CHF 150,000 zahlen?“ – ruft find_location + calculate_taxes auf

  • „Vergleiche Zug vs. Schwyz für ein Ehepaar mit 2 Kindern“ – ruft compare_locations auf

  • „Wo ist der günstigste Ort im Umkreis von 30 km um Zürich HB?“ – ruft find_cheapest_nearby auf

  • „Sollte ich meinen Bezug aus der 2. Säule auf mehrere Jahre verteilen?“ – ruft plan_capital_withdrawals auf

  • „Wie hoch ist die Erbschaftsteuer für ein Geschwister in Genf?“ – ruft calculate_inheritance_tax auf

  • „Wie viel würde mein Unternehmen in Zug vs. Luzern zahlen?“ – ruft calculate_company_tax auf


Entwicklung

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

Goldene Werte

tests/golden.json fixiert bekannte Steuerbeträge für abgeschlossene Steuerjahre. Der wöchentliche CI-Lauf prüft sie erneut gegen die Live-API, um Änderungen der upstream- Quelle zu erkennen.

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

CI

Die Tests laufen bei jedem Push auf Python 3.11/3.12/3.13, ergänzt durch einen wöchentlichen Zeitplan, um ESTV-Datenänderungen zu erkennen.


Wichtige Hinweise

  • Alle Beträge sind CHF pro Jahr

  • income_type='employed' bedeutet Bruttogehalt – Sozialversicherungen (AHV/IV/EO, ALV, NBU, BVG) werden automatisch abgeleitet.

  • Abzüge überschreiben Sie über deductions={id: value} mit IDS aus list_deductions (z.B. PRAEMIEN3A für Säule 3a, SCHULDZINSEN für Hypothekenzinsen).

  • compare_locations(scope='switzerland') deckt ca. 2.100 Gemeinden ab; die Ergebnisse werden zur Lesbarkeit zusammengefasst.

  • Die Hypothekarsteuer fällt nur an, wenn confession nicht none ist.

  • Die Zahlen stammen aus dem offiziellen ESTV-Modell – keine verbindliche, Steuerveranlage


Lizenz

MIT-Lizenz – siehe 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