Skip to main content

UK Companies House data via MCP — company search, profiles, officers, beneficial owners, and filings with cleaning and deduplication.

Project description

UK Companies House MCP Server

Clean, structured UK company data for AI agents — via the Model Context Protocol.

What this does

This MCP server gives agents access to UK Companies House data — company search, profiles, officer records, beneficial ownership, and filing history — with data cleaning that the raw API doesn't provide.

Companies House data has known quality issues: officer names appear in multiple formats creating ~614K duplicate records, corporate entities get filed as natural persons in PSC (beneficial ownership) data, and addresses arrive in inconsistent formats. This server fixes those problems before the data reaches your agent.

What the cleaning layer does:

  • Officer deduplication — fuzzy name matching merges records like "SMITH, John David" and "John Smith" when they share the same role and company.
  • PSC entity classification — flags corporate entities incorrectly filed as natural persons, using identification fields and name pattern detection.
  • Address normalisation — consistent formatting, postcode standardisation, single-line formatted output.
  • Filing descriptions — converts Companies House's hyphenated codes (like termination-director-company-with-name-termination-date) into readable text.
  • Company number normalisation — agents can send 445790 and the server correctly zero-pads it to 00445790.
  • Full officer pagination — fetches all pages automatically, not just the first 50.
  • Data quality annotations — every cleaned record carries _cleaning metadata so agents can see what was changed and why.

Quick start

Works out of the box — no API key needed.

# Install
pip install bartram-companies-house

# Run the MCP server
bartram-companies-house

Or with uvx:

uvx bartram-companies-house

For heavy usage or production workloads, register your own Companies House API key and set it as an environment variable:

export COMPANIES_HOUSE_API_KEY="your-key-here"

Configure with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "companies-house": {
      "command": "uvx",
      "args": ["bartram-companies-house"]
    }
  }
}

Tools

Tool Description
uk_company_search Search for UK companies by name or number
uk_company_profile Get company details — address, status, SIC codes, key dates
uk_company_officers Get officers with name deduplication
uk_company_psc Get beneficial owners with entity classification
uk_company_filings Get filing history with readable descriptions

See SCHEMA.md for full parameter and response documentation with examples.

Example

Ask your agent: "Who are the directors of Tesco?"

The agent calls uk_company_search with query: "Tesco", gets the company number, then calls uk_company_officers with that number. The response includes deduplicated officer records with cleaning metadata:

{
  "data": {
    "items": [
      {
        "name": "MURPHY, Ken",
        "officer_role": "director",
        "appointed_on": "2020-10-01",
        "nationality": "Irish",
        "_cleaning": {
          "deduplicated": true,
          "duplicate_count": 2,
          "original_names": ["MURPHY, Kenneth", "MURPHY, Ken"],
          "note": "Merged 2 records with similar names. Showing most recently appointed."
        }
      }
    ],
    "_cleaning": {
      "original_count": 45,
      "deduplicated_count": 38,
      "duplicates_removed": 7
    }
  },
  "metadata": {
    "source": "Companies House",
    "licence": "OGL v3.0",
    "endpoint": "/company/00445790/officers"
  }
}

Every response includes a metadata envelope with source attribution, licence information, and retrieval timestamp.

Data source

All data comes from the Companies House API and is published under the Open Government Licence v3.0. Crown copyright.

Caching

Responses are cached locally in SQLite to reduce API calls and improve latency:

Endpoint TTL
Company search 1 hour
Company profile 24 hours
Officers 6 hours
PSC 6 hours
Filing history 1 hour

Cache is stored in ~/.bartram/cache.db by default. Set BARTRAM_DATA_DIR to change the location.

Development

git clone https://github.com/RobertAlsop/bartram_foundry.git
cd bartram_foundry
uv sync --all-extras
uv run pytest
uv run ruff check .

Licence

MIT


Built by Bartram Foundry — production-grade MCP tools for UK public data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bartram_companies_house-0.1.0.tar.gz (100.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bartram_companies_house-0.1.0-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file bartram_companies_house-0.1.0.tar.gz.

File metadata

  • Download URL: bartram_companies_house-0.1.0.tar.gz
  • Upload date:
  • Size: 100.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bartram_companies_house-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50cb54373f7b2e325100136b7b04a5b087ab1e2d8676b84f7e5f6e4cea57d83a
MD5 f7c4d861c950e88885422afd8de7fc38
BLAKE2b-256 4e9fb79a75f7f6b84060ff8069473f4ef393fc143414ff882c6eae8fb11f7ea5

See more details on using hashes here.

File details

Details for the file bartram_companies_house-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bartram_companies_house-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bartram_companies_house-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65b11a0b4b66b46ba18ddfa09d82a55a249f5b1649647a2189d662d683e0ab08
MD5 6f6d654521b51b20ce026d52e38e9847
BLAKE2b-256 51daccaa5eaa43c0a8a77fb70976e68b8c46e700dba5211610e2852326b707ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page