Skip to main content
Glama
finland-law-mcp-server

finland-law-mcp-server

by cyanheads

Version License Docker MCP SDK npm TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework


Overview

Read Finnish and Swedish legal material from Finlex. Search by title or metadata, resolve citations, and follow statutes to amendments, court decisions, and preparatory works. The Statute Book contains the authentic as-enacted wording. Finlex consolidations are informational and can include adopted amendments before they take effect. For wording on a date, request an effective-date read and retain its evidence.

Tools

Tool

Description

filaw_search_statutes

Find consolidated or as-enacted statutes by title, keyword, year, or type

filaw_search_decisions

Find KKO and KHO decisions by court, collection, exact keyword, or year

filaw_search_government_proposals

Find government proposals by title or year

filaw_lookup_citation

Resolve legal citations and turn provision references into tool inputs

filaw_get_statute

Read an outline, a chapter, or commencement text and related sources

filaw_get_provision

Read selected provisions as enacted, on a date, or in an adopted snapshot

filaw_list_amendments

Trace commencement dates, transitional rules, and preparatory works

filaw_get_decision

Read KKO and KHO decisions or selected published sections

filaw_get_government_proposal

Read a proposal outline or section, or get the source PDF link

filaw_list_reference

Look up citation syntax, collection coverage, and accepted filters

Related MCP server: US Code MCP

Capability reference

The three search tools filter titles or metadata. Finlex Open Data has no full-text search. They accept language (fin by default, or swe), start_year, end_year, published_since, and limit (default 5, capped at 10 with a notice). Results are oldest first by year and number. Use next_cursor as cursor with the original query. Finlex supplies no total for these searches.

filaw_search_statutes tool

  • Search Finnish or Swedish title substrings or exact Finlex keyword labels. Use statute_type with slugs such as act or decree, also accepted as laki or asetus.

  • collection defaults to consolidated. Use as_enacted for the Statute Book. in_force applies only to consolidated records.

  • Results include canonical numbers, source URIs, and has_text so callers can identify title-only records.

filaw_search_decisions tool

  • Choose court: "KKO" (Supreme Court) or "KHO" (Supreme Administrative Court). The default type is precedent. Both courts support other_decision, and KHO also supports summary_archive.

  • keyword matches exact Finlex labels. On an empty initial page, the server tries capitalizing a lowercase initial once and carries the resulting query into the continuation cursor.

filaw_search_government_proposals tool

  • title matches a case-insensitive substring, for example työsopimuslain. Results identify proposals by HE number, link affected statutes, and report XML, PDF-only, or unknown text availability.

filaw_lookup_citation tool

  • Resolve up to 25 citations per call. Accepted forms include 55/2001, SK 55/2001 (as enacted), Työsopimuslaki, 55/2001 7 luku 2 §, HE 157/2000, and court numbers or ECLIs.

  • Each citation returns its own outcome. Ambiguous numbers or titles return candidates. A resolved citation with a provision address provides input for filaw_get_provision.

filaw_get_statute tool

  • Omit part for the outline and metadata, including available decree, preparatory work, correction, and translation links. Use a chapter such as 7 luku or entry_into_force for the corresponding text.

  • Consolidated reads can select an asof date or an exact version, one at a time. The outline provides section selectors for filaw_get_provision. Translation links identify the last included amendment when Finlex records it.

filaw_get_provision tool

  • Select up to ten provisions from one statute. Use natural addresses such as 7 luku 2 § or copy selectors from the statute outline.

  • In the consolidated collection, asof requests wording effective on an ISO date and defaults to today in Europe/Helsinki when no version is supplied. An eight-digit version selects a served adoption snapshot, which may include prospective wording.

  • Dated reads can return established fragments, candidate wording, and unresolved paths when snapshots or commencement evidence leave gaps. Use filaw_list_amendments to inspect the underlying amendments and transitional text.

filaw_list_amendments tool

  • Lists amending acts newest first, with recorded commencement and end dates, published commencement and transitional text, preparatory-work references, and the earliest served version where available. Filter by recorded start dates or current status in Europe/Helsinki. The response includes the date used for status.

  • Pages default to 25 amendments and cap at 100. Continue with next_offset as offset.

filaw_get_decision tool

  • Read up to ten decisions. Use court numbers, numeric ECLIs, legacy KKO series such as KKO 1975 I 1, or structured { court, type, year, number } selectors.

  • Omit sections for all published body text. Select introduction, background, arguments, motivation, or decision to narrow the read. Results identify missing sections and summary-only coverage where applicable.

filaw_get_government_proposal tool

  • Use a proposal number such as HE 157/2000. Omit part for the heading outline and text sizes. Use a selector from the outline or an exact unique heading for section text.

  • PDF-only proposals return metadata and the source PDF link. The server reads text supplied as XML.

filaw_list_reference tool

  • Returns citation and provision syntax, curated abbreviation mappings, statute types, court collections, language and history coverage, and pagination rules. Takes an empty object and works offline.

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

  • Finlex requests start at least one second apart, with up to three in flight. When the shared queue fills, the server returns a retry delay.

  • A combined XML page above 16 MiB is fetched one document at a time. An individual expression above 8 MiB returns finlex_response_too_large. Read that expression directly on Finlex. Limits apply after decompression.

  • Resolved expressions and latest-version aliases are cached for up to ten minutes, with up to 64 entries per cache and a 24 MiB source-size budget for parsed documents.

  • Text returned in content[] preserves the data in structuredContent, including evidence, source links, and unresolved results.

Getting started

claude mcp add finland-law-mcp-server -- npx -y @cyanheads/finland-law-mcp-server

For other clients, add this to the MCP config file:

{
  "mcpServers": {
    "finland-law-mcp-server": {
      "command": "npx",
      "args": ["-y", "@cyanheads/finland-law-mcp-server"]
    }
  }
}

Finlex requires no API key. For Docker or a source build, see Running the server.

Configuration

Variable

Description

Default

MCP_TRANSPORT_TYPE

Transport, stdio or http

stdio

MCP_HTTP_HOST

HTTP listen address

127.0.0.1

MCP_HTTP_PORT

HTTP server port

3010

MCP_HTTP_ENDPOINT_PATH

HTTP endpoint path

/mcp

MCP_SESSION_MODE

HTTP session mode, stateless, stateful, or auto

auto; example and Docker use stateless

MCP_AUTH_MODE

Authentication, none, jwt, or oauth

none

MCP_LOG_LEVEL

Log level

info

LOGS_DIR

Directory for log files

<app-root>/logs

STORAGE_PROVIDER_TYPE

Framework storage backend

in-memory

OTEL_ENABLED

Enable OpenTelemetry

false

MCP_USAGE_REPORTING

Opt in to sending tool-call summaries to the maintainer

false

See .env.example for common framework overrides.

Running the server

Local development

Requires Bun v1.4.4 or higher and Node.js v24+.

  • Clone and install:

    git clone https://github.com/cyanheads/finland-law-mcp-server.git
    cd finland-law-mcp-server && bun install
    cp .env.example .env   # optional framework overrides
  • Build and run the production version:

    # One-time build
    bun run rebuild
    
    # Run the built server
    bun run start:http
    # or
    bun run start:stdio
  • Run checks and tests:

    bun run devcheck  # Lints, formats, type-checks, and more
    bun run test      # Runs the test suite

Docker

docker run --rm -p 3010:3010 ghcr.io/cyanheads/finland-law-mcp-server:latest

The image defaults to HTTP transport, stateless session mode, and logs to /var/log/finland-law-mcp-server. To run it over stdio from an MCP client, use "command": "docker" with "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/finland-law-mcp-server:latest"]. To build locally, docker build -t finland-law-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

Directory

Purpose

src/mcp-server/tools/definitions/

Ten tool definitions and shared statute schemas

src/services/finlex/

Finlex transport, Akoma Ntoso parsing, document lookup, citations, and effective-date reconstruction

tests/integration/

Fixture-backed integration tests

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic

  • Use ctx.log for logging, ctx.state for storage

  • Register new tools in the createApp() arrays in src/index.ts

  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

bun run devcheck
bun run test

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Source material from Finlex Open Data, published by Finland’s Ministry of Justice and Legal Register Centre under CC BY 4.0. This server reformats the material.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables searching and reading federal statutes with linked legal and inline citations, listing published titles, and retrieving complete sections with bounded pagination through hosted HTTP or local stdio.
      3
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables read-only search and retrieval of Finnish legislation and multi-tier court decisions from official sources, with citation verification and Markdown conversion of legal documents.
      6
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables searching Brazilian federal norms and STF constitutional-review decisions, resolving citations to Senado IDs, reading published or consolidated texts and specific articles, and tracing amendments by act or provision. Runs over STDIO or Streamable HTTP with an optional local index mirror for cross-year search.
      Apache 2.0