Skip to content

MCP server

Fredrik Dettner edited this page Oct 5, 2026 · 2 revisions

MCP server (@sedis/mcp)

The Partner API v2 was designed from the ground up to be LLM- and agent-friendly — named query parameters (which map cleanly to typed tool arguments) instead of OData $filter, camelCase + sparse fieldsets (which keep response tokens low), and a clean OpenAPI spec at /openapi/v2.json.

The Sedis MCP server — @sedis/mcp — is now published. It wraps the v2 endpoints as a small set of curated, read-only Model Context Protocol tools, so AI assistants and agents (Claude Desktop, Cursor, and any MCP-capable client) can query your Sedis Bolagsanalys (listed-company financials) and Fastighetsbenchmark (real-estate comparables) data in natural language. It is a thin pass-through: every tenant-isolation, authentication, rate-limit, and billing rule lives in PartnerAPI v2, not in the server.

Install

Easiest: one-click Claude Desktop bundle (.mcpb)

  1. Download sedis-mcp.mcpb from the latest release: https://github.com/sedis-ab/sedis-mcp/releases/latest
  2. Double-click it (or in Claude Desktop → Settings → Extensions → drag it in) and click Install.
  3. Paste your Sedis API key into the field that appears (stored in the OS keychain). Done — no Node, no JSON, no terminal.

Manual config (Claude Code, Cursor, other MCP clients)

The server runs over stdio and is launched on demand via npx — no global install needed. Add it to your MCP client's config and set your PartnerAPI v2 key:

{
  "mcpServers": {
    "sedis": {
      "command": "npx",
      "args": ["-y", "@sedis/mcp"],
      "env": {
        "SEDIS_API_KEY": "your-partnerapi-v2-key"
      }
    }
  }
}
  • Claude Desktop: add the block to claude_desktop_config.json.
  • Cursor / other clients: add it to the client's mcp.json (same shape).
  • After editing the config, fully restart the client — MCP servers are loaded at client startup (a new chat in the same window is not enough).

Maintainers build the bundle with npm run build:mcpb.

Configuration

Env var Required Default Purpose
SEDIS_API_KEY yes — Your PartnerAPI v2 key. Sent only as the X-Api-Key header; never logged.
SEDIS_API_BASE_URL no https://api.sedis.se Override the v2 base URL (e.g. a non-prod environment).
SEDIS_API_SESSION no — Optional startup seed for the session token (user-owned keys only); sent as X-Api-Session. Usually set at runtime via set_session instead — no restart needed.

The key is validated lazily: the server starts without it and returns a friendly, actionable error on the first tool call if it is missing or invalid. There is no startup ping.

Authentication & session tokens

Authentication uses the same model as the REST API (see Authentication).

  • Machine / org-wide keys (no owner) are headless — X-Api-Key only; you never set a session.

  • User-owned keys (issued to a named person) additionally require a short-lived session token, refreshed periodically via two-factor auth:

    1. On a 401 with reason session_expired / session_invalid, the tool error carries a reproveUrl. Open it in a browser, complete 2FA, and copy the freshly-minted sedis_sess_… token.
    2. Paste it with the set_session tool — it is carried as X-Api-Session on the very next call, no client restart. Use clear_session to sign out.

Tools

All tools are read-only and tenant-scoped: the "your …" tools only ever return data your key is entitled to, and a request for another tenant's object comes back as a friendly not found (never a 403 that would leak its existence).

Bolagsanalys — listed-company financials (shared reference data):

Tool What it does
bolagsanalys_list_companies Search the catalog of listed companies by name fragment.
bolagsanalys_find_parameter Discover the right financial parameter by name fragment.
bolagsanalys_get_data Fetch quarterly figures — pass one companyId, or omit it to get all companies for a parameter/quarter.
bolagsanalys_search_data Batch-fetch figures for a specific set of companies (companyIds[], max 50).

Fastighetsbenchmark — real-estate comparables (your tenant-scoped data):

Tool What it does
fastighetsbenchmark_find_parameter Discover the right benchmark parameter by name.
fastighetsbenchmark_search_property_units Find your property units (Fastighet) by exact name, name fragment, municipality, zone, or property-type (propertyTypeName, e.g. "Office"/"Kontor").
fastighetsbenchmark_list_samlingar List your collections (Samling) and their members.
fastighetsbenchmark_list_jamforelseobjekt List your comparison zones (Jämförelseobjekt).
fastighetsbenchmark_get_comp_timeseries Pull the actual CompDatum benchmarking time-series (self-describing values).
fastighetsbenchmark_list_reference_zones List the shared, Sedis-owned market reference zones (same for every key).
fastighetsbenchmark_list_municipalities Look up municipality ids for the municipalityId filter — by name or official code.
fastighetsbenchmark_list_property_types Look up property-type ids for the propertyType filter (the EB0 domain).

Session (user-owned keys only): set_session, clear_session.

Names and descriptions are English by default; pass lang: "sv" on the parameter-discovery and property-unit tools to get Swedish. Tool errors are mapped from PartnerAPI v2's RFC 7807 problem responses into short, friendly messages that carry a traceId for support — never the API key or a stack trace.

Example flow

Ask your assistant something like: "In Bolagsanalys, find the parameter for direktavkastning and get it for all companies for the latest quarter, highest first." The server chains bolagsanalys_find_parameter → bolagsanalys_get_data with a server-side sort=-figure. The canonical multi-step A6 flow in The Comp Composite & clone lineage is exactly the kind of flow the MCP server makes effortless.

Links & support

  • npm: @sedis/mcp
  • Source: github.com/sedis-ab/sedis-mcp
  • The server is a thin wrapper — the underlying endpoints, query conventions, multi-tenant isolation, geometry, error shapes, rate limits, and data freshness are documented in this guide and in the live OpenAPI spec at /openapi/v2.json. This page does not duplicate that reference.

Note: Use of Sedis data in AI/LLM contexts is subject to your Sedis agreement and the accompanying MCP data-use terms.

Clone this wiki locally