Skip to main content
Glama

folio-mcp

MCP server for FOLIO, the Federated Open Legal Information Ontology.

FOLIO is an open-source legal ontology with 18,000+ concepts covering areas of law, document types, legal entities, governmental bodies, and more. This MCP server makes the full ontology available to AI agents as searchable, browsable tools.

A public REST API is already available at https://folio.openlegalstandard.org/ with interactive Swagger documentation at /docs. This MCP server wraps the same ontology for native use in AI coding assistants and agent frameworks.

License: MIT (server code) / CC-BY 4.0 (ontology data)

Backends

folio-mcp supports two interchangeable backends:

Mode

Startup

Dependencies

Use case

API (default)

Instant

httpx only

Normal usage — calls the public FOLIO REST API

Local (--local)

~10s

folio-python[search]

Offline use or when mounting inside folio-api

API mode (default)

The server starts instantly and delegates all queries to the public API at https://folio.openlegalstandard.org/. No local ontology loading required.

Local mode

Loads the full FOLIO ontology in-process (~18k classes). Useful for offline work or when embedded in folio-api.

# Install with local dependencies
pip install folio-mcp[local]

# Run in local mode
folio-mcp --local

# Or via environment variable
FOLIO_MCP_LOCAL=1 folio-mcp

Custom API URL

Point to a different FOLIO API instance:

folio-mcp --api-url https://my-folio-instance.example.com

Related MCP server: Legal Court MCP Server

Installation

Claude Code

claude mcp add folio -- uvx folio-mcp

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "folio": {
      "command": "uvx",
      "args": ["folio-mcp"]
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "folio": {
      "command": "uvx",
      "args": ["folio-mcp"]
    }
  }
}

VS Code

Add to your User Settings (JSON):

{
  "mcp": {
    "servers": {
      "folio": {
        "command": "uvx",
        "args": ["folio-mcp"]
      }
    }
  }
}

Remote (Streamable HTTP)

Connect to the hosted endpoint:

https://folio.openlegalstandard.org/mcp

Manual (pip)

pip install folio-mcp
folio-mcp

Tools (13, plus 1 optional)

Tool

Description

search_concepts(query, limit=10)

Search concepts by label/name using fuzzy matching (start here; max 50)

search_definitions(query, limit=10)

Loose fuzzy search over definition text (fallback)

query_concepts(...)

Advanced query with composable text and structural filters

query_properties(...)

Query OWL object properties by label, domain, range

get_concept(iri)

Get full details for a concept by IRI

export_concept(iri, format)

Export a concept as markdown, JSON-LD, or OWL XML

list_branches()

List all 24 taxonomy branches with concept counts

get_taxonomy_branch(branch_name, max_depth)

Get concepts in a taxonomy branch

get_children(iri, max_depth)

Get child concepts

get_parents(iri, max_depth)

Get parent concepts

get_properties()

List all OWL object properties (iri, label, short definition)

find_connections(subject_iri, property_name, object_iri)

Find semantic triples

extract_concepts(text, limit=50, branch=None)

Tag pasted text with the FOLIO concepts it mentions (label/synonym dictionary match; first call builds the index in ~1s)

extract_citations(text, limit=100)

Optional, needs the kaos extra on Python 3.13+. Find legal citations (cases, U.S.C., C.F.R., federal rules, ...) and map each to its FOLIO legal authority type and, for federal appellate/Supreme Court cases, the court

extract_citations is registered only when kaos-citations is installed:

uvx --python 3.13 --from 'folio-mcp[kaos]' folio-mcp

Browse operations return compact summaries (iri, label, definition). Use get_concept(iri) for full details including translations (31% of concepts, 10+ languages), preferred labels, external identifiers, and cross-references.

Prompts (3)

Prompt

Description

Argument

classify-document

Classify a legal document against the FOLIO taxonomy

description

identify-area-of-law

Identify applicable areas of law for a situation

situation

classify-entity

Classify a legal entity (person, org, role)

entity

Each prompt guides the LLM through the correct tool workflow and returns structured output (FOLIO label, IRI, definition, confidence, reasoning).

Resources (3)

Resource URI

Description

folio://branches

Branch names with concept counts (564 bytes)

folio://stats

Ontology statistics — version, class/property counts, license

folio://branch/{name}

Top-level concepts in a specific branch (on-demand)

Taxonomy Branches

The FOLIO ontology is organized into 24 top-level branches:

Branch

Description

actors_players

Parties, roles, and participants in legal matters

areas_of_law

Legal practice areas and specializations

asset_types

Types of assets (real property, intellectual property, etc.)

communication_modalities

Communication channels and methods

currencies

Monetary currencies

data_formats

Data and file formats

document_artifacts

Legal documents, contracts, filings

engagement_terms

Terms of engagement and fee arrangements

events

Legal events and milestones

forum_venues

Courts, tribunals, and dispute resolution venues

governmental_bodies

Government agencies and departments

industries

Industry sectors and classifications

languages

Natural languages

folio_types

FOLIO internal type classifications

legal_authorities

Statutes, regulations, case law

legal_entities

Entity types (corporations, LLCs, trusts, etc.)

locations

Geographic locations and jurisdictions

matter_narratives

Matter descriptions and narratives

matter_narrative_formats

Formats for matter narratives

objectives

Legal objectives and goals

services

Legal services and service types

standards_compatibilities

Standards and compatibility mappings

statuses

Status values for matters, documents, etc.

system_identifiers

System and external identifiers

Development

# Clone and install
git clone https://github.com/alea-institute/folio-mcp.git
cd folio-mcp
uv sync

# Run tests (requires folio-python for local backend tests)
uv sync --extra local
uv run pytest tests/

# Run with MCP Inspector
uv run mcp dev folio_mcp/server.py

# Run locally for Claude Code
claude mcp add folio-dev -- uv run --directory /path/to/folio-mcp folio-mcp

Available Tools

14 tools
export_conceptA

Export one FOLIO concept as Markdown, JSON-LD or OWL/XML (for documents or other systems). For reading a concept yourself, get_concept is more compact.

Args: iri: The concept IRI or short ID. format: "markdown" (default), "jsonld", or "owl_xml".

Returns: The concept in the requested format, or {error, hint}.

Inputs: iri (required), format. Returns: result

extract_conceptsA

Tag a passage of text with the FOLIO concepts it mentions.

Paste a fact pattern, clause, email, or brief excerpt; returns every FOLIO concept whose label or synonym appears in it (e.g., "tenant", "eviction", "temporary restraining order", "Bankruptcy Court", "EEOC"), with its branch. Dictionary matching, not inference: use it as a fast first pass, then get_concept(iri) or the classification prompts for judgment calls. The first call builds the label index (about 2s).

Args: text: The text to tag (up to 100,000 characters). limit: Maximum concepts to return, in order of first mention (default 50). branch: Optional branch filter, e.g. "areas_of_law", "document_artifacts", "actors_players", "forum_venues" (see list_branches).

Returns: JSON {"count", "concepts": [{iri, label, branch, match_type, matched_text, count, first_offset}]}.

Inputs: text (required), limit, branch. Returns: result

find_connectionsA

Find explicit property links (subject -> property -> object triples) from a FOLIO concept, e.g. Actor / Player -folio:drafted-> Document / Artifact.

FOLIO records only a small number of these links (mostly on top-level classes), so most concepts have none. For broader/narrower relationships use get_parents/get_children; for related concepts see "see_also" in get_concept.

Args: subject_iri: IRI or short ID of the subject concept (branch names accepted). property_name: Optional property label (e.g. "folio:drafted") or IRI. object_iri: Optional object concept IRI to filter by.

Returns: JSON array of {subject, property, object} (each {iri, label}), or {results: [], note} when the concept has no recorded links.

Inputs: subject_iri (required), object_iri, property_name. Returns: result

get_childrenA

Get the narrower (child) concepts of a FOLIO concept.

Args: iri: A concept IRI or short ID. A branch name such as "areas_of_law" is also accepted and returns that branch's top-level concepts. max_depth: 1 (default) = direct children. Up to 3; prefer drilling down one level at a time.

Returns: JSON array of {iri, label, definition}; capped at 100 items as {results, truncated, total, note}.

Inputs: iri (required), max_depth. Returns: result

get_conceptA

Get the full record for one FOLIO concept: definition, synonyms, translations, examples, parent/child IRIs, identifiers and cross-references.

Args: iri: A full IRI ("https://folio.openlegalstandard.org/RSYBzf149Mi5KE0YtmpUmr"), a short ID ("RSYBzf149Mi5KE0YtmpUmr"), or a branch name such as "areas_of_law" (returns that branch's root concept). Not a free-text name — use search_concepts to find the IRI first.

Returns: JSON object with all non-empty fields, or {error, hint}.

Inputs: iri (required). Returns: result

get_parentsA

Get the broader (parent) concepts of a FOLIO concept. A concept can have several parents (FOLIO is a polyhierarchy).

Args: iri: A concept IRI or short ID. max_depth: 1 (default) = direct parents; up to 3 for grandparents etc.

Returns: JSON array of {iri, label, definition}. Empty for a branch root.

Inputs: iri (required), max_depth. Returns: result

get_propertiesA

List all FOLIO object properties (relationship types such as "folio:advised", "folio:drafted", "folio:isGovernedBy", "oasis:hasActor").

Compact listing: iri, label and short definition only. For domain/range details, or to filter, use query_properties.

Returns: JSON array of {iri, label, definition}.

Inputs: no named parameters. Returns: result

get_taxonomy_branchA

Browse the top-level concepts of a FOLIO taxonomy branch.

Args: branch_name: A branch name from list_branches(), e.g. "areas_of_law", "document_artifacts", "actors_players". Close variants such as "Areas of Law" or "AREA_OF_LAW" are accepted. max_depth: 1 (default) = top level only. Up to 3, but deeper levels can be large; prefer get_children(iri) on the relevant concept.

Returns: JSON array of {iri, label, definition} (definitions shortened; use get_concept for full text). Large results are capped at 100 items and returned as {results, truncated, total, note}.

Inputs: branch_name (required), max_depth. Returns: result

list_branchesA

List the 24 top-level FOLIO taxonomy branches with their number of top-level concepts (e.g. areas_of_law, document_artifacts, legal_entities, actors_players, industries, locations).

Returns: JSON object mapping branch name to top-level concept count.

Inputs: no named parameters. Returns: result

query_conceptsA

Filter FOLIO concepts by exact field matches and structure (not ranked).

Use this for precise filters, e.g. every area of law whose label contains "tax", or concepts whose definition mentions "fiduciary". For "find the concept called X", search_concepts ranks better. All filters are ANDed; give at least one.

Text filters: label: Match the primary label. definition: Match the definition text. alt_label: Match alternative labels / synonyms. example: Match examples. any_text: Match any text field (label, definition, synonyms, examples, notes).

Structural filters: branch: Branch name from list_branches(), e.g. "areas_of_law" (also accepts "AREA_OF_LAW"). parent_iri: Only descendants of this concept (IRI, short ID or branch name). has_children: True = non-leaf concepts only, False = leaf concepts only. deprecated: Include deprecated concepts (default False). country: Match the country field.

Control: match_mode: "substring" (default, case-insensitive), "exact", "regex", or "fuzzy". limit: Maximum results (default 20, max 100).

Returns: JSON array of {iri, label, definition}.

Inputs: label, limit, branch, country, +8 more. Returns: result

query_propertiesA

Filter FOLIO object properties (relationship types), with full domain/range detail.

Text filters: label: Match the property label, e.g. "advised", "drafted", "governed", "hasActor". definition: Match the property definition.

Structural filters: domain_iri: Only properties whose domain includes this class IRI. range_iri: Only properties whose range includes this class IRI. has_inverse: True = only properties with inverses, False = only without.

Control: match_mode: "substring" (default), "exact", "regex", or "fuzzy". limit: Maximum results (default 20, max 100).

Returns: JSON array of {iri, label, definition, domain, range, inverse_of, sub_property_of}.

Inputs: label, limit, range_iri, definition, +3 more. Returns: result

search_conceptsA

Find FOLIO concepts by name. START HERE for almost every question.

Fuzzy-matches the query against concept labels and synonyms (alternative labels, abbreviations, translations of names). Works best with a short legal term or noun phrase, not a sentence: "noncompete agreement", "motion to dismiss", "landlord tenant", "LLC", "breach of contract". For a paragraph of facts, pick out the key legal terms and search each one.

Args: query: A short concept name (2-6 words). limit: Maximum results (default 10, max 50).

Returns: JSON array of {iri, label, definition, score}; score is 0-100, higher is better. Pass an iri to get_concept for the full record.

Inputs: query (required), limit. Returns: result

search_definitionsA

Fuzzy search over concept DEFINITIONS. Fallback only — use search_concepts first.

Ranking is loose: results often share only a few common words with the query, so read each definition before relying on a hit. For an exact word or phrase inside definitions, query_concepts(definition="...") is more precise.

Args: query: A short descriptive phrase (e.g. "duty of loyalty to beneficiaries"). limit: Maximum results (default 10, max 50).

Returns: JSON array of {iri, label, definition, score}.

Inputs: query (required), limit. Returns: result

search_expandedA

Search FOLIO with a plain-English question or fact pattern.

An LLM rewrites the query into synonyms and legal terms of art (e.g. "my landlord won't fix the heat" -> "Implied Warranty of Habitability", "Constructive Eviction"), searches each, and merges the results by rank. Use this for natural-language or situational queries; use search_concepts when you already know the concept's name. The first call for a query takes a few seconds; repeats are cached. If the LLM is unavailable it returns plain label-search results with an empty expansions list.

Args: query: Natural-language description (e.g., "fired for reporting safety violations"). limit: Maximum results (default 10, max 50). include_definitions: Also match concept definitions (default false).

Returns: JSON object: query, expansions, expansion_source ("llm", "cache" or "none"), and results [{iri, label, definition, score, matched_via}].

Inputs: query (required), limit, include_definitions. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 14 tools

    Disambiguation4/5

    The numerous search tools (search_concepts, search_definitions, search_expanded, query_concepts, extract_concepts) are unusually well-differentiated by explicit guidance ('START HERE', 'Fallback only', precise filters, natural-language queries), so an agent can pick correctly. The one genuine overlap is get_taxonomy_branch vs get_children: both accept a branch name and return that branch's top-level concepts, and get_children vs find_connections both touch related-concept traversal.

    Naming Consistency5/5

    Every tool follows a clean snake_case verb_noun pattern (search_concepts, get_concept, query_properties, extract_concepts, list_branches). The verb choice is semantically meaningful and consistent across search/get/list/query/export families.

    Tool Count5/5

    14 tools is squarely within the ideal range and each maps to a distinct capability (search, retrieve, navigate, filter, extract, export). Nothing feels redundant or padded for a taxonomy-browsing server.

    Completeness4/5

    The read-only surface is thorough for a taxonomy server: discovery, full-record retrieval, hierarchical navigation (parents/children/branches), property filtering, relation triples, text extraction, and export all exist. Minor gaps: no batch get_concept for multiple IRIs at once (a common post-search step) and subtree traversal is capped at depth 3, forcing iterative drill-down.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers