# Swiss Federal Law MCP Server (Fedlex) (`darikami/swiss-federal-law-mcp`) Actor

MCP server for AI agents: search the Classified Compilation of Swiss federal law (SR) and fetch the in-force text of an article in German, French, Italian or English (where an English translation exists), from the Federal Chancellery's Fedlex linked data.

- **URL**: https://apify.com/darikami/swiss-federal-law-mcp.md
- **Developed by:** [DARIKAMI GmbH](https://apify.com/darikami) (community)
- **Categories:** MCP servers, AI, Business
- **Security:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 tool calls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Swiss Federal Law MCP Server (Fedlex)

**An MCP server that gives AI agents the in-force text of Swiss federal law, from the Federal Chancellery's Fedlex data.**
It searches the Classified Compilation (SR) and returns an article in German, French, Italian or English (where a translation exists).
**USD 0.01 per answered tool call.** A call that finds nothing is free. Apify also bills the server's Standby usage. Works with MCP clients such as Claude, ChatGPT, Cursor and n8n.

| Tool call | What comes back |
|---|---|
| `search_law("MWSTG")` | SR 641.20, the Value Added Tax Act, in force |
| `search_law("OR")` | SR 220, the Code of Obligations, as the first hit |
| `get_article("641.20", "1", "en")` | Art. 1 "Subject and principles", version 2025-03-31, with footnotes |
| `get_article("641.20", "10", "de")` | the German text of Art. 10 in force, with the version date |
| `search_law("<nonsense>")` | a free error result: nothing found |

The calls come from the live smoke test against Fedlex (03.11.2026). The full answer is under Example.

### Who uses it

- **Legal and tax assistants for Swiss users:** quote the exact article instead of the model's memory.
- **Compliance agents:** look up the data-protection act (DSG), the VAT act (MWSTG) or the Code of Obligations (OR).
- **Developers of Swiss legal products:** one MCP endpoint instead of a SPARQL and XML parser of their own.

### What it does not do

- Federal law only: no cantonal law, no case law.
- The main text only: no transitional provisions, no annexes.
- The English text is a translation without legal force. This is not legal advice.
- It is independent: not affiliated with or endorsed by the Swiss Federal Chancellery.

### Tools

Two tools:

| Tool | What it does |
|---|---|
| `search_law(query, language?, includeRepealed?)` | Find acts by words of the title, the abbreviation (`MWSTG`, `OR`, `DSG`, `StGB`) or the SR number (`641.20`, also written `SR 641.20`). Up to 20 acts with SR number, title, abbreviation, in-force status and a link. All words must match; an exact abbreviation or SR number ("OR") comes first; in-force acts only unless `includeRepealed`. |
| `get_article(srNumber, article, language?)` | The text of one article - `641.20` + `10`, `220` + `41`, `101` + `8`, also `10a`, `10bis`, `663bbis` - with the version date and the **footnotes** (the amendment history: "Fassung gemäss Ziff. I des BG vom ..., in Kraft seit ..."). Main text only: transitional provisions and annexes are not supported. |

### Connect

The actor runs in Apify's **Standby mode**; the MCP endpoint (Streamable HTTP) is
`https://darikami--swiss-federal-law-mcp.apify.actor/mcp`, authenticated with your Apify API token as a bearer token:

```json
{
  "mcpServers": {
    "swiss-federal-law": {
      "url": "https://darikami--swiss-federal-law-mcp.apify.actor/mcp",
      "headers": { "Authorization": "Bearer <your Apify token>" }
    }
  }
}
```

Input (optional): `defaultLanguage` - `de` (default), `fr`, `it`, `en` - used when a call does not name a language.

### Example

`get_article` with `{ "srNumber": "641.20", "article": "1", "language": "en" }` returns, abridged:

```json
{
  "srNumber": "641.20",
  "language": "en",
  "title": "Federal Act of 12 June 2009 on Value Added Tax (Value Added Tax Act, VAT Act)",
  "shortTitle": "VAT Act",
  "versionDate": "2025-03-31",
  "article": { "number": "Art. 1", "heading": "Subject and principles", "text": "Art. 1 Subject and principles\n1 The Confederation shall levy a general consumption tax ...", "footnotes": ["..."], "truncated": false },
  "url": "https://www.fedlex.admin.ch/eli/cc/2009/615",
  "source": "Fedlex, Swiss Federal Chancellery (fedlex.admin.ch) - Classified Compilation of Federal Legislation (SR)",
  "notice": "Only the texts published by the Confederation in the Official Compilation are legally binding; ..."
}
```

### Pricing (pay per event)

| Event | Price | When |
|---|---|---|
| `tool-call` | **USD 0.01** | one **answered** call of either tool |

Calls that find nothing (unknown act, unknown article, no English version), calls with bad input and calls the source
fails are **free**: they return an error result with the reason. Apify also bills the platform usage of the Standby run, in addition to the tool-call price. We do not set that charge.
That usage runs while the server waits for requests, until the idle timeout stops it. Apify's documents describe a maximum cost per run for standard runs, not for a Standby call.

### Data source and terms

- **Source:** the Federal Chancellery's **Fedlex** linked data - SPARQL `https://fedlex.data.admin.ch/sparqlendpoint`
  for search and for the version that applies today, and the consolidated text as the Akoma Ntoso XML file that
  Fedlex publishes for each version (`https://www.fedlex.admin.ch/filestore/...`). Each answer names its source and
  the act's page on fedlex.admin.ch.
- **Terms (read 03.11.2026):** acts, ordinances and official decisions of the Confederation are not protected by copyright
  (Art. 5 URG).
- **Only the official publication is legally binding.** The text served is Fedlex's consolidated version - a
  convenience copy; the English version is a translation without legal force. The answer says so (`notice`). This is
  not legal advice.
- When more calls arrive than the actor reads at once, the surplus gets a free "busy" error result.
- The text comes as Fedlex publishes it, without warranty.

**More official-data actors by darikami:** [Swiss UID & VAT validator](https://apify.com/darikami/swiss-uid-validator) · [Swiss electricity tariffs](https://apify.com/darikami/swiss-electricity-tariffs) · [SEC company fundamentals](https://apify.com/darikami/sec-company-fundamentals) · [German public tenders](https://apify.com/darikami/german-public-tenders).

# Actor input Schema

## `defaultLanguage` (type: `string`):

Language of the returned law text when a tool call does not name one. English exists only for some acts (non-binding translations).

## Actor input object example

```json
{
  "defaultLanguage": "de"
}
```

# Actor output Schema

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("darikami/swiss-federal-law-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("darikami/swiss-federal-law-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call darikami/swiss-federal-law-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,darikami/swiss-federal-law-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Iw6mLASH5zdfiCbKM/builds/bkL24BENdQD3Eepov/openapi.json
