finlex-mcp

finlex-mcp

An MCP server providing direct, citable access to Finnish legislation by retrieving statute text from Finlex open data, enabling AI assistants to answer legal queries with accurate citations.

Category
访问服务器

README

finlex-mcp

An MCP server that gives AI assistants direct, citable access to Finnish legislation.

Ask Claude "Mitä kuluttajansuojalaki sanoo etämyynnin peruuttamisesta?" and instead of answering from memory (and possibly inventing a section number), it calls this server and answers with the actual, current text of KSL 6 luku 14 § — with the formal citation, the Finlex consolidation date, and a link to verify.

CI

This is a retrieval tool, not legal advice. It returns statute text with citations; it never interprets law. Always verify against finlex.fi.

Demo

"Mitä kuluttajansuojalaki sanoo etämyynnin peruuttamisesta?" → Claude calls search_statutes, then get_section → answers with the real section text + citation.

<!-- TODO: docs/demo.gif — recorded in Claude Desktop -->

What it demonstrates

A complete public-data pipeline, end to end:

Stage Implementation
Acquisition Finlex open data REST API — resolves and downloads the newest consolidated (ajantasainen) version of each statute (src/scripts/fetch.ts)
Structuring Akoma Ntoso (OASIS LegalDocML) XML parsed into a SQLite schema: statute → chapter → section, with amendment labels and full-text search (src/parse.ts, src/scripts/ingest.ts)
Implementation A Model Context Protocol server (official TypeScript SDK) exposing three tools to any MCP host (src/server.ts)
Verification 15 scripted lookups through the real MCP interface, cross-checked against the live finlex.fi rendering — current accuracy: 15/15, regenerated by npm run verify, enforced in CI

Zero runtime API costs: the server is pure local retrieval. No keys, no external calls, no LLM spend.

Tools

Tool What it does
search_statutes(query) Full-text search over the covered statutes; returns sections with citations and snippets. Handles Finnish inflection with stem-prefix matching.
get_section(statute, chapter, section) Exact text of one pykälä, with formal citation, amendment label ("sellaisena kuin se on laissa 1211/2013"), and any confirmed-but-not-yet-in-force wording explicitly flagged.
list_statute_structure(statute?) Without arguments: the exact dataset coverage. With a statute: its full table of contents.

Every response ends with the source line: consolidation date, data-fetch date, and the finlex.fi link — so a downstream AI can always disclose how fresh its law is.

Accuracy discipline (the interesting part)

  • Scope honesty. v1 covers exactly one statute: Kuluttajansuojalaki (38/1978). The tool descriptions state this coverage as exhaustive, and out-of-scope requests are refused with a pointer to finlex.fi instead of a guess (verified: check #14).
  • Pending amendments handled correctly. Finlex consolidations include confirmed future changes (e.g. L 31/2026 rewrites KSL 7:10 effective 20.11.2026). The server returns the wording in force today as primary, and flags the upcoming wording as EI VIELÄ VOIMASSA (verified: check #9).
  • No hand-written accuracy claims. VERIFICATION.md is generated by the verification script, which exits non-zero on any failure — CI fails if accuracy drops.

Connect to Claude Desktop

Add to claude_desktop_config.json (Settings → Developer → Edit Config):

{
  "mcpServers": {
    "finlex": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/finlex-mcp/dist/server.js"]
    }
  }
}

Or run the container (no local Node needed):

{
  "mcpServers": {
    "finlex": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "finlex-mcp"]
    }
  }
}

Any other MCP host works the same way — the server speaks standard MCP over stdio.

Build from source

npm ci
npm run fetch    # download newest consolidations from Finlex open data
npm run ingest   # parse XML -> SQLite (data/finlex.db)
npm run verify   # regenerate VERIFICATION.md against live finlex.fi
npm start        # serve over stdio

Or: docker build -t finlex-mcp . — the image ships a ready-built database from the committed XML snapshot.

Adding a statute is one line in src/config.ts plus npm run fetch && npm run ingest.

Data source & license

  • Statute data: Finlex open data (Ministry of Justice / Legal Register Centre), used under CC BY 4.0 as published on avoindata.fi. Finnish statute text itself is exempt from copyright (tekijänoikeuslaki 404/1961 § 9).

  • The fetch pipeline identifies itself with a User-Agent (required by the API) and paces requests politely.

  • Finlex's consolidations are informational, not the authoritative source of law — the XML itself declares FRBRauthoritative="false". Hence: verify against finlex.fi, and nothing this server returns is legal advice.

  • Code: MIT © Anna Sebedach

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选