regon-mcp 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ # Copy to .env and adjust. The server reads these at startup.
2
+
3
+ # Your GUS BIR USER_KEY. Request one (free) from regon_bir@stat.gov.pl.
4
+ # Leave unset to use the public TEST key against the anonymized test database.
5
+ REGON_API_KEY=abcde12345abcde12345
6
+
7
+ # Which GUS environment to hit: "test" (anonymized data) or "prod" (live data).
8
+ # Use "test" with the public test key; switch to "prod" only with a real USER_KEY.
9
+ REGON_ENV=test
10
+
11
+ # HTTP timeout in seconds.
12
+ REGON_TIMEOUT=30
@@ -0,0 +1,64 @@
1
+ name: publish
2
+
3
+ # Publish to PyPI via Trusted Publishing (OIDC) — no API token is stored.
4
+ # Triggers on pushing a semver tag (v1.2.3), or manually for the first release.
5
+ on:
6
+ push:
7
+ tags:
8
+ - "v*.*.*"
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ build:
16
+ name: Build distributions
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v6
23
+
24
+ - name: Build sdist and wheel
25
+ run: uv build
26
+
27
+ - name: Ensure the git tag matches the package version
28
+ if: startsWith(github.ref, 'refs/tags/v')
29
+ run: |
30
+ tag="${GITHUB_REF_NAME#v}"
31
+ pkg="$(grep -m1 -E '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/')"
32
+ echo "git tag: $tag / pyproject: $pkg"
33
+ if [ "$tag" != "$pkg" ]; then
34
+ echo "::error::Git tag v$tag does not match pyproject version $pkg"
35
+ exit 1
36
+ fi
37
+
38
+ - name: Validate distribution metadata
39
+ run: uvx twine check dist/*
40
+
41
+ - name: Upload distributions
42
+ uses: actions/upload-artifact@v4
43
+ with:
44
+ name: dist
45
+ path: dist/
46
+
47
+ publish:
48
+ name: Publish to PyPI
49
+ needs: build
50
+ runs-on: ubuntu-latest
51
+ environment:
52
+ name: pypi
53
+ url: https://pypi.org/project/regon-mcp/
54
+ permissions:
55
+ id-token: write # required for OIDC / Trusted Publishing
56
+ steps:
57
+ - name: Download distributions
58
+ uses: actions/download-artifact@v4
59
+ with:
60
+ name: dist
61
+ path: dist/
62
+
63
+ - name: Publish to PyPI
64
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,25 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+
9
+ # Virtual envs / uv
10
+ .venv/
11
+
12
+ # Secrets / local config
13
+ .env
14
+ .env.*
15
+ !.env.example
16
+
17
+ # Tooling
18
+ .pytest_cache/
19
+ .ruff_cache/
20
+ .mypy_cache/
21
+
22
+ # OS / editor
23
+ .DS_Store
24
+ .idea/
25
+ .vscode/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Smart Mobile House
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: regon-mcp
3
+ Version: 0.2.0
4
+ Summary: Model Context Protocol server for the Polish GUS REGON business register (BIR1 API).
5
+ Project-URL: Homepage, https://smartmobilehouse.com
6
+ Project-URL: Repository, https://github.com/SmartMobileHouse/regon-mcp
7
+ Project-URL: Issues, https://github.com/SmartMobileHouse/regon-mcp/issues
8
+ Author: Smart Mobile House
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: bir,company-data,gus,kyc,mcp,model-context-protocol,poland,regon
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Office/Business
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: defusedxml>=0.7
17
+ Requires-Dist: httpx>=0.27
18
+ Requires-Dist: mcp<3,>=2.0.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # regon-mcp
22
+
23
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI
24
+ assistants clean, typed access to the **Polish REGON business register** (GUS
25
+ BIR1). Look up any Polish company by **NIP**, **REGON**, or **KRS** and get back
26
+ structured data — name, address, legal form, activity codes — without touching
27
+ the underlying SOAP API.
28
+
29
+ The official [GUS BIR1 API](https://api.stat.gov.pl/Home/RegonApi) is a WCF SOAP
30
+ service with WS-Addressing, MTOM multipart responses, an HTTP-header session
31
+ token, and XML-nested-inside-XML result payloads. `regon-mcp` hides all of that
32
+ behind a handful of simple tools.
33
+
34
+ > Built and maintained by [Smart Mobile House](https://smartmobilehouse.com) —
35
+ > secure AI implementation for enterprise.
36
+
37
+ ## Tools
38
+
39
+ | Tool | Description |
40
+ | --- | --- |
41
+ | `search_by_nip(nip)` | Look up an entity by 10-digit NIP (tax id). |
42
+ | `search_by_regon(regon)` | Look up an entity by 9- or 14-digit REGON. |
43
+ | `search_by_krs(krs)` | Look up an entity by 10-digit KRS (court register). |
44
+ | `search_bulk(identifiers, id_type)` | Look up up to 20 entities of one type at once. |
45
+ | `get_full_report(regon, report_type)` | Fetch a detailed report for one entity. |
46
+ | `list_report_types()` | List valid report names, with guidance on which to use. |
47
+
48
+ Every response includes a `source` block that names the register (REGON / GUS),
49
+ the environment, and a UTC `retrieved_at` timestamp — so downstream use can cite
50
+ the data correctly, as GUS requires.
51
+
52
+ ## Quick start
53
+
54
+ No install needed — run it straight from the repo with
55
+ [uv](https://docs.astral.sh/uv/):
56
+
57
+ ```bash
58
+ uvx --from git+https://github.com/SmartMobileHouse/regon-mcp regon-mcp
59
+ ```
60
+
61
+ By default it uses the **public test key** against the anonymized GUS test
62
+ database, so it runs with zero setup. For live data, request a free `USER_KEY`
63
+ from `regon_bir@stat.gov.pl` and set the environment variables below.
64
+
65
+ ### Use it in Claude Desktop / Claude Code
66
+
67
+ Add to your MCP config (e.g. `claude_desktop_config.json` or a project
68
+ `.mcp.json`):
69
+
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "regon": {
74
+ "command": "uvx",
75
+ "args": ["--from", "git+https://github.com/SmartMobileHouse/regon-mcp", "regon-mcp"],
76
+ "env": {
77
+ "REGON_API_KEY": "your-user-key",
78
+ "REGON_ENV": "prod"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ During development, point it at a local checkout instead:
86
+
87
+ ```json
88
+ {
89
+ "mcpServers": {
90
+ "regon": {
91
+ "command": "uvx",
92
+ "args": ["--from", "/absolute/path/to/regon-mcp", "regon-mcp"],
93
+ "env": { "REGON_API_KEY": "abcde12345abcde12345" }
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Configuration
100
+
101
+ | Variable | Default | Description |
102
+ | --- | --- | --- |
103
+ | `REGON_API_KEY` | public test key | Your GUS BIR `USER_KEY`. |
104
+ | `REGON_ENV` | `test` | `test` (anonymized data) or `prod` (live data). |
105
+ | `REGON_TIMEOUT` | `30` | HTTP timeout in seconds. |
106
+
107
+ Use `REGON_ENV=prod` only with a real `USER_KEY`; the test key works only
108
+ against the test environment.
109
+
110
+ ## Development
111
+
112
+ ```bash
113
+ git clone https://github.com/SmartMobileHouse/regon-mcp
114
+ cd regon-mcp
115
+ uv sync # create the venv and install deps
116
+ uv run pytest # offline tests: validation, parsing, mocked client,
117
+ # and an in-memory MCP tool-discovery smoke test.
118
+ # (network tests are deselected by default)
119
+ uv run regon-mcp # run the server over stdio
120
+
121
+ # Live tests against the GUS endpoint (deselected unless opted in):
122
+ REGON_RUN_NETWORK=1 uv run pytest -m network # session lifecycle (test env)
123
+ REGON_PROD_KEY=<your-key> uv run pytest -m network # positive-control on live data
124
+ ```
125
+
126
+ The client is a small hand-rolled SOAP layer over `httpx` (see
127
+ `src/regon_mcp/client.py`) — no heavyweight SOAP stack, no runtime WSDL fetch.
128
+
129
+ ## Notes & limitations
130
+
131
+ - The **GUS test database is anonymized** and returns little or no entity data.
132
+ Meaningful results require a production `USER_KEY` with `REGON_ENV=prod`.
133
+ - Respect the GUS terms of use and rate limits. This project is an independent
134
+ open-source client and is not affiliated with or endorsed by GUS.
135
+ - Data belongs to GUS. When you present it, cite **REGON / GUS** with the
136
+ retrieval date (surfaced in every response's `source` block).
137
+
138
+ ## License
139
+
140
+ [MIT](LICENSE) © Smart Mobile House
@@ -0,0 +1,120 @@
1
+ # regon-mcp
2
+
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI
4
+ assistants clean, typed access to the **Polish REGON business register** (GUS
5
+ BIR1). Look up any Polish company by **NIP**, **REGON**, or **KRS** and get back
6
+ structured data — name, address, legal form, activity codes — without touching
7
+ the underlying SOAP API.
8
+
9
+ The official [GUS BIR1 API](https://api.stat.gov.pl/Home/RegonApi) is a WCF SOAP
10
+ service with WS-Addressing, MTOM multipart responses, an HTTP-header session
11
+ token, and XML-nested-inside-XML result payloads. `regon-mcp` hides all of that
12
+ behind a handful of simple tools.
13
+
14
+ > Built and maintained by [Smart Mobile House](https://smartmobilehouse.com) —
15
+ > secure AI implementation for enterprise.
16
+
17
+ ## Tools
18
+
19
+ | Tool | Description |
20
+ | --- | --- |
21
+ | `search_by_nip(nip)` | Look up an entity by 10-digit NIP (tax id). |
22
+ | `search_by_regon(regon)` | Look up an entity by 9- or 14-digit REGON. |
23
+ | `search_by_krs(krs)` | Look up an entity by 10-digit KRS (court register). |
24
+ | `search_bulk(identifiers, id_type)` | Look up up to 20 entities of one type at once. |
25
+ | `get_full_report(regon, report_type)` | Fetch a detailed report for one entity. |
26
+ | `list_report_types()` | List valid report names, with guidance on which to use. |
27
+
28
+ Every response includes a `source` block that names the register (REGON / GUS),
29
+ the environment, and a UTC `retrieved_at` timestamp — so downstream use can cite
30
+ the data correctly, as GUS requires.
31
+
32
+ ## Quick start
33
+
34
+ No install needed — run it straight from the repo with
35
+ [uv](https://docs.astral.sh/uv/):
36
+
37
+ ```bash
38
+ uvx --from git+https://github.com/SmartMobileHouse/regon-mcp regon-mcp
39
+ ```
40
+
41
+ By default it uses the **public test key** against the anonymized GUS test
42
+ database, so it runs with zero setup. For live data, request a free `USER_KEY`
43
+ from `regon_bir@stat.gov.pl` and set the environment variables below.
44
+
45
+ ### Use it in Claude Desktop / Claude Code
46
+
47
+ Add to your MCP config (e.g. `claude_desktop_config.json` or a project
48
+ `.mcp.json`):
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "regon": {
54
+ "command": "uvx",
55
+ "args": ["--from", "git+https://github.com/SmartMobileHouse/regon-mcp", "regon-mcp"],
56
+ "env": {
57
+ "REGON_API_KEY": "your-user-key",
58
+ "REGON_ENV": "prod"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ During development, point it at a local checkout instead:
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "regon": {
71
+ "command": "uvx",
72
+ "args": ["--from", "/absolute/path/to/regon-mcp", "regon-mcp"],
73
+ "env": { "REGON_API_KEY": "abcde12345abcde12345" }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## Configuration
80
+
81
+ | Variable | Default | Description |
82
+ | --- | --- | --- |
83
+ | `REGON_API_KEY` | public test key | Your GUS BIR `USER_KEY`. |
84
+ | `REGON_ENV` | `test` | `test` (anonymized data) or `prod` (live data). |
85
+ | `REGON_TIMEOUT` | `30` | HTTP timeout in seconds. |
86
+
87
+ Use `REGON_ENV=prod` only with a real `USER_KEY`; the test key works only
88
+ against the test environment.
89
+
90
+ ## Development
91
+
92
+ ```bash
93
+ git clone https://github.com/SmartMobileHouse/regon-mcp
94
+ cd regon-mcp
95
+ uv sync # create the venv and install deps
96
+ uv run pytest # offline tests: validation, parsing, mocked client,
97
+ # and an in-memory MCP tool-discovery smoke test.
98
+ # (network tests are deselected by default)
99
+ uv run regon-mcp # run the server over stdio
100
+
101
+ # Live tests against the GUS endpoint (deselected unless opted in):
102
+ REGON_RUN_NETWORK=1 uv run pytest -m network # session lifecycle (test env)
103
+ REGON_PROD_KEY=<your-key> uv run pytest -m network # positive-control on live data
104
+ ```
105
+
106
+ The client is a small hand-rolled SOAP layer over `httpx` (see
107
+ `src/regon_mcp/client.py`) — no heavyweight SOAP stack, no runtime WSDL fetch.
108
+
109
+ ## Notes & limitations
110
+
111
+ - The **GUS test database is anonymized** and returns little or no entity data.
112
+ Meaningful results require a production `USER_KEY` with `REGON_ENV=prod`.
113
+ - Respect the GUS terms of use and rate limits. This project is an independent
114
+ open-source client and is not affiliated with or endorsed by GUS.
115
+ - Data belongs to GUS. When you present it, cite **REGON / GUS** with the
116
+ retrieval date (surfaced in every response's `source` block).
117
+
118
+ ## License
119
+
120
+ [MIT](LICENSE) © Smart Mobile House
@@ -0,0 +1,53 @@
1
+ [project]
2
+ name = "regon-mcp"
3
+ version = "0.2.0"
4
+ description = "Model Context Protocol server for the Polish GUS REGON business register (BIR1 API)."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Smart Mobile House" }]
9
+ keywords = [
10
+ "mcp",
11
+ "model-context-protocol",
12
+ "regon",
13
+ "gus",
14
+ "bir",
15
+ "poland",
16
+ "company-data",
17
+ "kyc",
18
+ ]
19
+ classifiers = [
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Topic :: Office/Business",
23
+ ]
24
+ dependencies = [
25
+ # Cap the MCP SDK below the next major: the 1.x -> 2.x jump was breaking,
26
+ # so a future 3.x could be too. httpx is intentionally left unbounded.
27
+ "mcp>=2.0.0,<3",
28
+ "httpx>=0.27",
29
+ "defusedxml>=0.7",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://smartmobilehouse.com"
34
+ Repository = "https://github.com/SmartMobileHouse/regon-mcp"
35
+ Issues = "https://github.com/SmartMobileHouse/regon-mcp/issues"
36
+
37
+ [project.scripts]
38
+ regon-mcp = "regon_mcp.server:main"
39
+
40
+ [dependency-groups]
41
+ dev = ["pytest>=8"]
42
+
43
+ [build-system]
44
+ requires = ["hatchling"]
45
+ build-backend = "hatchling.build"
46
+
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["src/regon_mcp"]
49
+
50
+ [tool.pytest.ini_options]
51
+ markers = [
52
+ "network: integration tests that hit the live GUS BIR test endpoint",
53
+ ]
@@ -0,0 +1,3 @@
1
+ """regon-mcp — an MCP server for the Polish GUS REGON business register (BIR1)."""
2
+
3
+ __version__ = "0.2.0"
@@ -0,0 +1,4 @@
1
+ from .server import main
2
+
3
+ if __name__ == "__main__":
4
+ main()