DEV Community

Cover image for How we turned a 91-action Catalan civic policy document into a remote MCP server
Catalunya 2022
Catalunya 2022

Posted on

How we turned a 91-action Catalan civic policy document into a remote MCP server

In 2021, a task force of 30 Catalan experts published Catalunya 2022 - RESET: Crida per reactivar el país — a strategic action plan for Catalonia's future, structured across 3 spheres, 12 goals, and 91 concrete actions. The document was the product of nearly 400 collaborators and over 1,400 citizen proposals, developed above party lines.

Five years later, we wanted to make this document queryable by any AI assistant, expand it from the static PDF file and make it accessible as structured data through the Model Context Protocol (MCP).

The result is a remote MCP server at mcp.2022.cat that any MCP-compatible client can connect to in seconds.

What the server exposes

The document is available in three languages (Catalan, English, Spanish) through four tools:

  • search_document — full-text search across all content with locale filtering
  • get_section — retrieve any sphere, goal, or action by its canonical slug
  • get_document_metadata — the complete document hierarchy with titles and counts
  • list_proposals — list all 91 actions, filterable by sphere or goal

Every tool accepts a locale parameter (ca, en, or es). Default is Catalan.

Try it now

No API keys, no authentication. Just add this to your MCP client config:

{
  "mcpServers": {
    "catalunya-2022": {
      "url": "https://mcp.2022.cat"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Or with Claude Code:

claude mcp add --transport http catalunya-2022 https://mcp.2022.cat
Enter fullscreen mode Exit fullscreen mode

Then ask it something:

  • "Quins són els objectius de l'àmbit 2?" (Catalan)
  • "List all actions related to housing" (English)
  • "Resume la esfera de Sociedad Justa" (Spanish)

How it's built

The server is built with TypeScript using the official MCP SDK, Express, and FlexSearch for full-text search with diacritic support (important for Catalan and Spanish).

The content pipeline works like this:

  1. The original document lives as MDX files in three parallel directory trees (content/ca/, content/en/, content/es/)
  2. A build script processes the MDX into a single corpus.json — a pre-built index of all sections, titles, identifiers, and body text
  3. At startup, the server loads corpus.json into memory and builds FlexSearch indexes with LatinBalance charset encoding for proper diacritic handling
  4. Every MCP tool query runs against this in-memory corpus — no database, no file I/O at runtime

The server runs as a Streamable HTTP endpoint (stateless, one transport per request) behind Nginx on a VPS.

The document structure

The corpus follows a strict hierarchy that maps directly to the MCP tools:

3 Spheres
  Sphere 1: Fair Society (Goals 1-4)
  Sphere 2: Economy (Goals 5-8)
  Sphere 3: Public Sector (Goals 9-12)
    Each goal contains 4-12 actions
      91 actions total
Enter fullscreen mode Exit fullscreen mode

Plus static pages: introduction, executive summary, and the "train of prosperity" framework.

Where to find it

Why MCP for a policy document?

Policy documents are traditionally static, usually published as PDFs, maybe summarized in a press release, then forgotten. Making one queryable via MCP means any AI assistant can search, analyze, and cite specific proposals on demand. A researcher can ask "what does Catalunya 2022 propose about renewable energy?" and get the exact action text in three languages, with the canonical slug to link back to the source.

This is a small experiment in making civic policy AI-native and making it accessible where people already work.


Catalunya 2022 - RESET: Crida per reactivar el país, was created by a task force of 30 experts convened in 2020, with input from nearly 400 collaborators and over 1,400 citizen proposals. The full document is available at 2022.cat.

Top comments (0)