Metadata-Version: 2.5
Name: ares-gov-cz-mcp
Version: 0.1.0
Summary: Read-only MCP server for the ARES (Czech business register) public REST API
Project-URL: Homepage, https://github.com/iquest/ares-mcp
Project-URL: Repository, https://github.com/iquest/ares-mcp
Project-URL: Issues, https://github.com/iquest/ares-mcp/issues
License-Expression: MIT
License-File: LICENSE
Keywords: ares,business-register,czech,ico,mcp,model-context-protocol
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: httpx<0.29,>=0.28
Requires-Dist: mcp[cli]<3,>=2
Description-Content-Type: text/markdown

# ares-gov-cz-mcp

<!-- mcp-name: io.github.iquest/ares-mcp -->

A read-only [MCP](https://modelcontextprotocol.io) server for **ARES**, the Czech register of
economic entities. It lets an AI assistant look up companies by IČO, search by name and other
criteria, and read the source registers behind ARES. It needs no credentials.

It targets ARES REST API **version 1.4** and covers **all 26 operations** of that API through
8 tools. Results keep ARES's own (Czech) field names.

## Install and start

Requires [uv](https://docs.astral.sh/uv/). Run it from PyPI, with no checkout (uv downloads and
caches it):

```bash
uvx ares-gov-cz-mcp    # serves MCP over stdio
```

To run the latest unreleased code from GitHub instead (this also needs `git`):

```bash
uvx --from git+https://github.com/iquest/ares-mcp ares-gov-cz-mcp
```

To work on the code, clone it (Python 3.10+):

```bash
git clone https://github.com/iquest/ares-mcp.git && cd ares-mcp
uv sync
uv run python -m ares_mcp
```

## Connect an MCP client

Add this to the client's MCP configuration:

```json
{
  "mcpServers": {
    "ares": {
      "command": "uvx",
      "args": ["ares-gov-cz-mcp"]
    }
  }
}
```

For Claude Code: `claude mcp add ares -- uvx ares-gov-cz-mcp`

To pin a version, use `"ares-gov-cz-mcp==0.1.0"`. To update, run `uvx --refresh ares-gov-cz-mcp`.
To run a local checkout instead, use
`uv --directory /absolute/path/to/ares-mcp run python -m ares_mcp` as the command.

## Tools

All tools are read-only.

| Tool | What it does | Example call |
|------|--------------|--------------|
| `get_entity` | Basic record of one entity by IČO | `{"ico": "27082440"}` |
| `search_entities` | Search entities by name, address, legal form, ... (paged) | `{"filter": {"obchodniJmeno": "Seznam"}, "count": 5}` |
| `get_register_record` | Record of one entity in one source register | `{"register": "vr", "ico": "27082440"}` |
| `search_register` | Search one source register (paged) | `{"register": "vr", "filter": {"ico": ["27082440"]}}` |
| `search_code_lists` | Find valid codes for filters (paged) | `{"filter": {"kodCiselniku": "PravniForma"}}` |
| `search_addresses` | Resolve a partial address to standardised candidates | `{"filter": {"textovaAdresa": "Praha, Hlavní 1"}}` |
| `search_notification_batches` | List notification batches (paged) | `{"filter": {"datovyZdroj": "vr"}, "count": 10}` |
| `get_notification_batch` | Fetch one notification batch | `{"data_source": "vr", "batch_number": "7"}` |

Registers: `vr`, `res`, `rzp`, `nrpzs`, `rpsh`, `rcns`, `szr`, `rs`, `ros`, `ceu`.

- An IČO may contain spaces or lack leading zeros: `"123456"` is looked up as `00123456`.
- Searches return `total`, `start`, `count`, `items` and `next_start`. Pass `next_start` as
  `start` to get the next page. `next_start` is null on the last page. ARES does not page the
  notification batch list, so the server pages it locally and `total` is its length.
- `count` defaults to 20 and is at most 100.
- ARES refuses any search that matches more than 1000 results. Narrow the filter.
- `search_code_lists` needs at least one filter field. `search_addresses` sends
  `typStandardizaceAdresy`, default `VYHOVUJICI_ADRESY` (the other value is `UPLNA_STANDARDIZACE`).

### Errors

A failed call returns an MCP tool error whose text contains one tag:

| Tag | Meaning |
|-----|---------|
| `[not_found]` | ARES has no such record |
| `[invalid_input]` | Bad input (IČO, register, paging) or ARES rejected the request |
| `[registry_unavailable]` | Timeout, connection error, rate limit or ARES server error. Retry later |
| `[registry_refused]` | ARES refused the request (HTTP 401 or 403) |

The SDK puts the tool name in front of the tag. Raw ARES error payloads are never forwarded.
If a typed field gets the wrong JSON type (for example `start` as text), the SDK rejects the call
before the tool runs and the error has no tag.

## Configuration

Set these environment variables in the client's server entry (all optional):

| Variable | Default | Meaning |
|----------|---------|---------|
| `ARES_BASE_URL` | `https://ares.gov.cz/ekonomicke-subjekty-v-be/rest` | ARES API base URL |
| `ARES_TIMEOUT_SECONDS` | `10` | Total timeout per request |
| `ARES_MAX_CONCURRENCY` | `5` | Most requests in flight at once |
| `ARES_DEFAULT_COUNT` | `20` | Page size when `count` is omitted |
| `ARES_MAX_COUNT` | `100` | Largest accepted `count` |

GET requests are retried once on a connection error or HTTP 502/503. POST requests are never
retried.

## Develop

```bash
uv run ruff check .
uv run pytest tests/unit tests/contract      # no network
uv run pytest -m live                        # real ARES; see below
```

Live tests need `tests/fixtures/expected-entities.json` to hold at least 20 IČOs with their name
and legal form, copied by hand from the public ARES website. Do not generate them from the API.

`tests/fixtures/ares-openapi.json` is a snapshot of the ARES OpenAPI document. A test checks that
every operation in it is reachable through one of the 8 tools.

## Release

Pushing a tag `vX.Y.Z` runs `.github/workflows/release.yml`. It checks that the tag,
`pyproject.toml` and `server.json` carry the same version, runs ruff and the offline tests,
builds, publishes to PyPI (trusted publishing), then publishes `server.json` to the
[MCP Registry](https://registry.modelcontextprotocol.io) (GitHub OIDC). To release, change the
version in `pyproject.toml` and in both places in `server.json`, commit, then tag and push.

One-time setup:

- On pypi.org, add a *pending* trusted publisher: project `ares-gov-cz-mcp`, owner `iquest`,
  repository `ares-mcp`, workflow `release.yml`, environment `pypi`.
- In the GitHub repository settings, create an environment named `pypi`.
- The `<!-- mcp-name: ... -->` line at the top of this file proves to the registry that the PyPI
  package belongs to `io.github.iquest/ares-mcp`. Keep it in sync with `server.json`.
