Skip to main content
Glama
firmaradar-mcp

firmaradar-mcp

Official
by bergverket
README.md
# firmaradar

**Look up, audit and rank Norwegian businesses using open public data.**
A command line tool, a Python library and an MCP server. Pure Python 3.10+, no dependencies, no API keys.

[Norsk versjon](README.no.md)

## What it does

| Command | What you get |
|---|---|
| `firmaradar lookup <orgnr>` | A company from **Enhetsregisteret**: name, form, industry (NACE), address, employees, website, founding date. `--accounts` adds the latest figures from **Regnskapsregisteret** (revenue, operating result, net result, equity). |
| `firmaradar search` | Search Enhetsregisteret by name, municipality, NACE prefix, organisation form and registration date. Newest first, paging and de-duplication handled. |
| `firmaradar audit <url>` | A quick audit of a website's front page: up, down or parked, platform (Shopify, Wix, WordPress, WooCommerce, Squarespace, Webflow ...), https, mobile viewport, online shop, copyright year, social links, and generic contact info. |
| `firmaradar prospect` | The whole pipeline: find companies, fetch accounts, audit their websites, score them 0–100 with plain-language reasons, and write a ranked CSV / JSON / Markdown list. |
| `firmaradar-mcp` | An MCP server (stdio) with the tools `lookup_company`, `search_companies`, `get_accounts` and `audit_website`, so AI assistants and agents can use the registers directly. |

We built this for our own small web agency in Stavanger to find local businesses that might need a new website or online store. The scoring is driven by a JSON **profile**, so you can retune it for any other purpose: an accountant looking for newly registered limited companies, a researcher tracking new businesses in a municipality, a sales team qualifying leads.

## Install

```bash
pip install git+https://github.com/bergverket/firmaradar
```

Or clone and run without installing:

```bash
git clone https://github.com/bergverket/firmaradar && cd firmaradar
PYTHONPATH=src python3 -m firmaradar --help
```

## Examples

```bash
# One company, with its latest annual accounts
firmaradar lookup 923609016 --accounts

# Newest hairdressers (NACE 96.02) in Oslo (0301), as JSON
firmaradar search --municipality 0301 --industry 96.02 --limit 20 --json

# Audit a website
firmaradar audit example.no

# Leads: companies registered in Stavanger the last 14 days, plus 200 established ones (1–10 years, with employees)
firmaradar prospect --municipality 1103 --days 14 --established 200 --markdown leads.md

# Same, with a draft first message in Norwegian signed by you
firmaradar prospect --municipality 1103 --sender "Eksempel Web, et lite nettbyrå i Stavanger"

# Your own scoring profile
firmaradar prospect --profile examples/accountant-profile.json --days 30
```

Municipality numbers: `0301` Oslo, `4601` Bergen, `5001` Trondheim, `1103` Stavanger. Full list at [SSB](https://www.ssb.no/klass/klassifikasjoner/131). NACE codes: [SSB SN2007](https://www.ssb.no/klass/klassifikasjoner/6).

More in [`examples/`](examples/): library use, a custom profile, an MCP config and a weekly GitHub Actions workflow.

### As a library

```python
from firmaradar import brreg, website

c = brreg.get_company("923609016")
acc = brreg.get_accounts(c.orgnr)          # Accounts(year, revenue, operating_result, net_result, equity, currency, kind)
audit = website.audit(c.website)           # WebsiteAudit(status, platform, https, mobile_viewport, ...)
```

### As an MCP server

Add this to your MCP client's config:

```json
{ "mcpServers": { "firmaradar": { "command": "firmaradar-mcp" } } }
```

Then ask things like *"Which bakeries were registered in Bergen this month, and do they have a website?"*

## How scoring works

Every lead gets points from signals in the profile and a list of reasons. An illustrative (made-up) example:

```
78  EKSEMPEL KLÆR AS
    Industry: Retail; 4 employees; Revenue NOK 3.2m (2025); Built with Wix; Not mobile friendly; Retail without online store
    Contact: Generic address, e-mail is OK
```

The bundled profile [`web-agency`](src/firmaradar/profiles/web-agency.json) gives points for industries that sell to consumers, 2–50 employees, NOK 1–50m revenue, and website problems (no site, down, parked, no https, not mobile friendly, outdated, site builder, retail without an online shop). It subtracts points for fuel stations, grocery chains, companies already on Shopify, very large companies and likely franchise chains. Copy the file and change the numbers to make your own.

## Respectful by design

- **Only open sources.** Brønnøysundregistrene's open APIs, the company's own public front page (plus one contact page), and optionally Google PageSpeed with your own key. We deliberately do **not** scrape 1881, Gule Sider, Proff, Facebook or Instagram, whose terms forbid it.
- **Nothing is ever sent.** The tool writes a list. You decide who to contact, and you write the message yourself.
- **Norwegian marketing law built in.** The Marketing Control Act § 15 requires consent for marketing e-mail to a named person, also at work. firmaradar only keeps generic role addresses (`post@`, `hei@`, `kontakt@` ...), never personal ones, and suggests calling sole proprietorships instead. This is a conservative heuristic, not legal advice. Also check the [Reservasjonsregisteret](https://www.brreg.no/om-oss/registrene-vare/om-reservasjonsregisteret/) before telemarketing.
- **Data minimisation (GDPR).** Store only what you need, and delete leads you will not contact. The JSON merge (`--merge`, `--keep-days`) drops old entries automatically.
- **Polite.** Identifies itself with a User-Agent (override with `FIRMARADAR_USER_AGENT`), pauses between API pages and fetches at most two pages per website.

## Data and licence

Company and accounts data come from [Brønnøysundregistrene](https://data.brreg.no/) and are licensed under the [Norwegian Licence for Open Government Data (NLOD 2.0)](https://data.norge.no/nlod/en/2.0). The code is MIT licensed, see [LICENSE](LICENSE).

firmaradar is not affiliated with Brønnøysundregistrene.

## Development

```bash
python3 -m unittest discover -s tests -v   # offline, no network needed
```

Issues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).

Made by [Bergverket](https://bergverket.no), Stavanger.

TDQS

A3.5/5.0

Scored across 4 tools

Disambiguation4/5

Each tool targets a distinct data source or action: single-company lookup, filtered search, financial accounts, and website inspection. lookup_company and search_companies both return company records and could be momentarily confused, but the descriptions make the lookup-by-orgnr vs. filter-search split clear.

Naming Consistency4/5

All four names follow the snake_case verb_noun pattern with resource-specific wording (lookup_/search_/get_/audit_). The verbs vary (lookup vs. search vs. get) slightly more than a strictly uniform convention would, but each verb accurately reflects its operation.

Tool Count4/5

Four tools is on the lean side but each maps to a clearly separate capability with no filler. A small read-only registry server is reasonably scoped at this size, though one or two more tools could be justified.

Completeness3/5

Core read paths are covered (identify, discover, financials, web presence), but the registry surface is partial: no role/board or ownership data, no historical multi-year accounts, and no way to retrieve other Enhetsregisteret attributes. Agents researching a firm would hit these gaps quickly.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues