jgrants-util-mcp-server 0.1.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,220 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GotoAI Inc.
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,121 @@
1
+ Metadata-Version: 2.5
2
+ Name: jgrants-util-mcp-server
3
+ Version: 0.1.0
4
+ Summary: A skill-style MCP server for the Jグランツ (jGrants) public subsidy API
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: httpx>=0.27
9
+ Requires-Dist: mcp<3,>=2.3
10
+ Requires-Dist: pypdf>=5
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
13
+ Requires-Dist: pytest>=8; extra == 'dev'
14
+ Requires-Dist: ruff>=0.6; extra == 'dev'
15
+ Description-Content-Type: text/markdown
16
+
17
+ # jgrants-util-mcp-server
18
+
19
+ An MCP server for the public API of [Jグランツ (jGrants)](https://www.jgrants-portal.go.jp/),
20
+ Japan's government subsidy portal: search subsidies, read their details, and read the text
21
+ of their application guidelines.
22
+
23
+ Jグランツの公開APIを使って、補助金の検索・詳細の確認・公募要領の閲覧ができる MCP サーバーです。
24
+
25
+ > **Unofficial.** This project is not affiliated with or endorsed by the Digital Agency
26
+ > (デジタル庁), which operates Jグランツ. It is written from scratch against the
27
+ > [published API specification](https://developers.digital.go.jp/documents/jgrants/api/);
28
+ > it is not a fork of the Digital Agency's
29
+ > [jgrants-mcp-server](https://github.com/digital-go-jp/jgrants-mcp-server).
30
+
31
+ ## Tools
32
+
33
+ | Tool | What it does |
34
+ |---|---|
35
+ | `load_guideline` | The usage guideline for the whole tool set: search strategy, details, attachments, what Jグランツ covers, and the conditions of use. It takes no arguments and always returns the whole guideline. |
36
+ | `search_subsidies` | Search by one keyword plus filters (area, industry, purpose, employee count); paged. |
37
+ | `get_subsidy_detail` | One subsidy's overview, eligibility, rate, amounts, dates, portal URL and attachment list. |
38
+ | `read_attachment` | The text of a PDF attachment, in pieces, with `next_offset` to continue; image-only pages are listed in `pages_without_text`. |
39
+
40
+ The server follows a *skill-style* layout. Its MCP `instructions` are one sentence
41
+ saying what the tools are for and to call `load_guideline` first. Everything that
42
+ concerns the tool set as a whole — including the conditions of use — lives in the
43
+ guideline, and each tool's description covers only that tool. Agents that load many MCP
44
+ servers keep only a short entry per server in their prompt, and read the guideline when
45
+ they need it.
46
+
47
+ ## Run
48
+
49
+ Python 3.11 or later.
50
+
51
+ ```bash
52
+ pip install -e .
53
+ python -m jgrants_util_mcp_server # stdio, the default
54
+ jgrants-util-mcp-server --transport streamable-http --port 8000 # HTTP at /mcp
55
+ ```
56
+
57
+ stdio is the default because a client that installed the package starts the process
58
+ itself: no port, no host name, nothing to put behind a proxy. Serving it over HTTP is
59
+ the deliberate case, so it is the one that has to say so.
60
+
61
+ The package declares what to run in the `kari.mcp_servers` entry-point group, so a client
62
+ that installs the wheel can fill its own command field in — the distribution is named
63
+ `jgrants-util-mcp-server` while the module is `jgrants_util_mcp_server`, and guessing one
64
+ from the other is exactly the mistake that group avoids.
65
+
66
+ Behind a reverse proxy, accept the public host name as well; otherwise the server's DNS
67
+ rebinding protection rejects requests whose `Host` is not localhost:
68
+
69
+ ```bash
70
+ jgrants-util-mcp-server --transport streamable-http --host 127.0.0.1 --port 8000 \
71
+ --allowed-host demo.mcp.gotoai.com
72
+ ```
73
+
74
+ `--host`, `--port` and `--allowed-host` apply only to HTTP; given without
75
+ `--transport streamable-http`, the server refuses to start rather than ignore them.
76
+
77
+ When bound to a non-loopback address (for example `--host 0.0.0.0` on a LAN), that
78
+ protection is off; restrict access with a firewall or a proxy.
79
+
80
+ ### In Kari
81
+
82
+ Two ways, depending on whether the server runs on the user's own machine or on a host.
83
+
84
+ **As a Python package (the server runs on the user's machine).** Build a wheel with
85
+ `python -m build --wheel`, then in Kari: MCPサーバー追加 → type **Python パッケージ(STDIO)**
86
+ → ローカル wheel ファイル → the `.whl` → インストール. The command field fills itself in from
87
+ the entry-point group above. Kari installs it into its own bundled Python, so the user
88
+ needs no Python of their own. Once it is on PyPI, the pypi.org option takes the name
89
+ instead.
90
+
91
+ **Over HTTP (the server runs on a host).** Add a custom extension of type **Streamable
92
+ HTTP** with the URL `http://<host>:<port>/mcp`, and start the server with
93
+ `--transport streamable-http`.
94
+
95
+ Either way, give it an ASCII name such as `jgrants` — the name becomes part of every tool
96
+ name the agent sees.
97
+
98
+ ## Conditions of use
99
+
100
+ These are in the guideline the agent reads; they apply to anyone presenting the results:
101
+
102
+ - Credit the source as 「出典:Jグランツ(jGrants)」.
103
+ - Treat the information as a reference; confirm the latest details on the subsidy's
104
+ official page (`portal_url`) before applying.
105
+ - Avoid excessive repeated access to the API.
106
+
107
+ The Jグランツ API's own terms are published by the Digital Agency at
108
+ <https://www.jgrants-portal.go.jp/open-api>; they apply to whoever runs this server.
109
+
110
+ ## Development
111
+
112
+ ```bash
113
+ pip install -e ".[dev]"
114
+ pytest # offline tests
115
+ JGRANTS_LIVE=1 pytest # also the live test against the real API
116
+ ruff check src tests
117
+ ```
118
+
119
+ ## License
120
+
121
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,105 @@
1
+ # jgrants-util-mcp-server
2
+
3
+ An MCP server for the public API of [Jグランツ (jGrants)](https://www.jgrants-portal.go.jp/),
4
+ Japan's government subsidy portal: search subsidies, read their details, and read the text
5
+ of their application guidelines.
6
+
7
+ Jグランツの公開APIを使って、補助金の検索・詳細の確認・公募要領の閲覧ができる MCP サーバーです。
8
+
9
+ > **Unofficial.** This project is not affiliated with or endorsed by the Digital Agency
10
+ > (デジタル庁), which operates Jグランツ. It is written from scratch against the
11
+ > [published API specification](https://developers.digital.go.jp/documents/jgrants/api/);
12
+ > it is not a fork of the Digital Agency's
13
+ > [jgrants-mcp-server](https://github.com/digital-go-jp/jgrants-mcp-server).
14
+
15
+ ## Tools
16
+
17
+ | Tool | What it does |
18
+ |---|---|
19
+ | `load_guideline` | The usage guideline for the whole tool set: search strategy, details, attachments, what Jグランツ covers, and the conditions of use. It takes no arguments and always returns the whole guideline. |
20
+ | `search_subsidies` | Search by one keyword plus filters (area, industry, purpose, employee count); paged. |
21
+ | `get_subsidy_detail` | One subsidy's overview, eligibility, rate, amounts, dates, portal URL and attachment list. |
22
+ | `read_attachment` | The text of a PDF attachment, in pieces, with `next_offset` to continue; image-only pages are listed in `pages_without_text`. |
23
+
24
+ The server follows a *skill-style* layout. Its MCP `instructions` are one sentence
25
+ saying what the tools are for and to call `load_guideline` first. Everything that
26
+ concerns the tool set as a whole — including the conditions of use — lives in the
27
+ guideline, and each tool's description covers only that tool. Agents that load many MCP
28
+ servers keep only a short entry per server in their prompt, and read the guideline when
29
+ they need it.
30
+
31
+ ## Run
32
+
33
+ Python 3.11 or later.
34
+
35
+ ```bash
36
+ pip install -e .
37
+ python -m jgrants_util_mcp_server # stdio, the default
38
+ jgrants-util-mcp-server --transport streamable-http --port 8000 # HTTP at /mcp
39
+ ```
40
+
41
+ stdio is the default because a client that installed the package starts the process
42
+ itself: no port, no host name, nothing to put behind a proxy. Serving it over HTTP is
43
+ the deliberate case, so it is the one that has to say so.
44
+
45
+ The package declares what to run in the `kari.mcp_servers` entry-point group, so a client
46
+ that installs the wheel can fill its own command field in — the distribution is named
47
+ `jgrants-util-mcp-server` while the module is `jgrants_util_mcp_server`, and guessing one
48
+ from the other is exactly the mistake that group avoids.
49
+
50
+ Behind a reverse proxy, accept the public host name as well; otherwise the server's DNS
51
+ rebinding protection rejects requests whose `Host` is not localhost:
52
+
53
+ ```bash
54
+ jgrants-util-mcp-server --transport streamable-http --host 127.0.0.1 --port 8000 \
55
+ --allowed-host demo.mcp.gotoai.com
56
+ ```
57
+
58
+ `--host`, `--port` and `--allowed-host` apply only to HTTP; given without
59
+ `--transport streamable-http`, the server refuses to start rather than ignore them.
60
+
61
+ When bound to a non-loopback address (for example `--host 0.0.0.0` on a LAN), that
62
+ protection is off; restrict access with a firewall or a proxy.
63
+
64
+ ### In Kari
65
+
66
+ Two ways, depending on whether the server runs on the user's own machine or on a host.
67
+
68
+ **As a Python package (the server runs on the user's machine).** Build a wheel with
69
+ `python -m build --wheel`, then in Kari: MCPサーバー追加 → type **Python パッケージ(STDIO)**
70
+ → ローカル wheel ファイル → the `.whl` → インストール. The command field fills itself in from
71
+ the entry-point group above. Kari installs it into its own bundled Python, so the user
72
+ needs no Python of their own. Once it is on PyPI, the pypi.org option takes the name
73
+ instead.
74
+
75
+ **Over HTTP (the server runs on a host).** Add a custom extension of type **Streamable
76
+ HTTP** with the URL `http://<host>:<port>/mcp`, and start the server with
77
+ `--transport streamable-http`.
78
+
79
+ Either way, give it an ASCII name such as `jgrants` — the name becomes part of every tool
80
+ name the agent sees.
81
+
82
+ ## Conditions of use
83
+
84
+ These are in the guideline the agent reads; they apply to anyone presenting the results:
85
+
86
+ - Credit the source as 「出典:Jグランツ(jGrants)」.
87
+ - Treat the information as a reference; confirm the latest details on the subsidy's
88
+ official page (`portal_url`) before applying.
89
+ - Avoid excessive repeated access to the API.
90
+
91
+ The Jグランツ API's own terms are published by the Digital Agency at
92
+ <https://www.jgrants-portal.go.jp/open-api>; they apply to whoever runs this server.
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ pip install -e ".[dev]"
98
+ pytest # offline tests
99
+ JGRANTS_LIVE=1 pytest # also the live test against the real API
100
+ ruff check src tests
101
+ ```
102
+
103
+ ## License
104
+
105
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,46 @@
1
+ [project]
2
+ name = "jgrants-util-mcp-server"
3
+ version = "0.1.0"
4
+ description = "A skill-style MCP server for the Jグランツ (jGrants) public subsidy API"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.11"
9
+ dependencies = [
10
+ "mcp>=2.3,<3",
11
+ "httpx>=0.27",
12
+ "pypdf>=5",
13
+ ]
14
+
15
+ [project.optional-dependencies]
16
+ dev = [
17
+ "pytest>=8",
18
+ "pytest-asyncio>=0.24",
19
+ "ruff>=0.6",
20
+ ]
21
+
22
+ [project.scripts]
23
+ jgrants-util-mcp-server = "jgrants_util_mcp_server.server:main"
24
+
25
+ # What to run, declared so a client that installs this wheel does not have to be
26
+ # told. Kari reads this group after installing a Python Package MCP server and
27
+ # fills its command field from it; the module is runnable with `-m`, which is
28
+ # what that field holds.
29
+ [project.entry-points."kari.mcp_servers"]
30
+ default = "jgrants_util_mcp_server:main"
31
+
32
+ [build-system]
33
+ requires = ["hatchling>=1.26"]
34
+ build-backend = "hatchling.build"
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/jgrants_util_mcp_server"]
38
+
39
+ [tool.pytest.ini_options]
40
+ asyncio_mode = "auto"
41
+ testpaths = ["tests"]
42
+ markers = ["live: calls the real Jグランツ API (set JGRANTS_LIVE=1 to run)"]
43
+
44
+ [tool.ruff]
45
+ line-length = 100
46
+ target-version = "py311"
@@ -0,0 +1,5 @@
1
+ """A skill-style MCP server for the Jグランツ (jGrants) public subsidy API."""
2
+
3
+ from .server import main
4
+
5
+ __all__ = ["main"]
@@ -0,0 +1,7 @@
1
+ """`python -m jgrants_util_mcp_server`, which is how a client that installed the
2
+ wheel starts the server: no console script on PATH, no absolute path to bake into
3
+ a configuration file."""
4
+
5
+ from .server import main
6
+
7
+ main()