joule-mcp 0.1.1__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 @@
1
+ Fractalworks (https://fractalworks.io)
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 (2026-12-02)
4
+
5
+ - Read tools: `list_pods`, `list_pod_members`, `list_usecases`, `list_transports`, `list_streams`, `usecase_status`,
6
+ `usecase_events` and `describe_usecase`.
7
+ - Resources: `joule://dsl/schema`, `joule://dsl/catalogue` and `joule://dsl/component/{key}`.
8
+ - Change tools, off unless `JOULE_MCP_ALLOW_WRITE=1`: `deploy_usecase`, `pause_usecase`, `resume_usecase` and
9
+ `undeploy_usecase` (needs `confirm`).
10
+ - API keys work as in the Joule UI: key format check at start-up, a `whoami` tool, a scope check before each call, and
11
+ readable messages for Guardian's `AUTH_*` refusals.
12
+ - Checked against Joule 1.3 on minikube.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fractalworks
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,227 @@
1
+ Metadata-Version: 2.3
2
+ Name: joule-mcp
3
+ Version: 0.1.1
4
+ Summary: MCP server that lets AI agents inspect and manage Joule use cases through the Guardian REST API
5
+ License: MIT
6
+ Keywords: joule,mcp,model-context-protocol,streaming,ai-agents
7
+ Author: Fractalworks
8
+ Requires-Python: >=3.10
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Classifier: Typing :: Typed
17
+ Requires-Dist: mcp (>=2.3,<3.0)
18
+ Requires-Dist: pyyaml (>=6.0,<7.0)
19
+ Requires-Dist: requests (>=2.33.0,<3.0.0)
20
+ Project-URL: Documentation, https://docs.fractalworks.io/joule
21
+ Project-URL: Homepage, https://getjoule.io/
22
+ Project-URL: changelog, https://gitlab.com/joule-platform/joule-mcp/-/blob/main/CHANGELOG.md
23
+ Project-URL: issues, https://gitlab.com/joule-platform/joule-mcp/-/issues
24
+ Project-URL: source, https://gitlab.com/joule-platform/joule-mcp
25
+ Description-Content-Type: text/markdown
26
+
27
+ # joule-mcp
28
+
29
+ <!-- mcp-name: io.fractalworks/joule-mcp -->
30
+
31
+ An MCP server that lets an AI agent inspect a Joule installation. It calls the Guardian REST API
32
+ (`/joule/management/*`). It is independent of `joulectl` and Guardian.
33
+
34
+ By default the server is read-only. The change tools exist only when you set `JOULE_MCP_ALLOW_WRITE=1`.
35
+
36
+ ## Tools
37
+
38
+ | Tool | Guardian route | Same as |
39
+ |---|---|---|
40
+ | `list_pods` | `pods/list` | `joulectl ls pods` |
41
+ | `list_pod_members` | `pods/connected` | `joulectl ls members POD` |
42
+ | `list_usecases` | `usecase/list` | `joulectl ls usecases` |
43
+ | `list_transports` | `transports/list` | `joulectl ls transports` |
44
+ | `list_streams` | `stream/list` | `joulectl ls streams` |
45
+ | `usecase_status` | `usecase/status` | `joulectl status usecase NAME` |
46
+ | `usecase_events(name, pod, limit)` | `usecase/status` | `joulectl status usecase NAME --events` |
47
+ | `whoami` | `apikeys/whoami` | the Joule UI's "who am I" |
48
+ | `describe_usecase` | `usecase/list`, `usecase/detail`, `usecase/status` | `joulectl inspect usecase NAME` and `status` |
49
+
50
+ Every tool carries the `readOnlyHint` annotation.
51
+
52
+ `usecase_events` returns the latest events a use case emitted, parsed from JSON, for each running process (`limit` 1 to
53
+ 100, default 10, newest last). Guardian keeps only a short sample in memory (`last_emitted_events`), so it is for
54
+ inspection, not a stream, and it is empty while a use case is paused or idle. The result gives `emitted_events` for
55
+ each process, so two calls show whether events are flowing.
56
+
57
+ ## Change tools
58
+
59
+ Off unless `JOULE_MCP_ALLOW_WRITE=1` is set. Guardian needs the `usecases:write` scope on the key.
60
+ `pod` is always required, so no change reaches every pod by accident.
61
+
62
+ | Tool | Guardian route | Same as |
63
+ |---|---|---|
64
+ | `deploy_usecase(pod, specification)` | `POST usecase/deploy` | `joulectl deploy usecase` |
65
+ | `pause_usecase(name, pod)` | `PUT usecase/pause` | `joulectl process pause` |
66
+ | `resume_usecase(name, pod)` | `PUT usecase/resume` | `joulectl process resume` |
67
+ | `undeploy_usecase(name, pod, confirm)` | `DELETE usecase/undeploy` | `joulectl undeploy usecase` |
68
+
69
+ - `specification` is an object, or JSON or YAML text. It is parsed with a safe loader and sent as JSON.
70
+ The root key is `use case`, and a use case needs at least one source and one sink. For example:
71
+ `{"use case": {"name": "x", "stream name": "s", "sources": ["a"], "sinks": ["b"]}}`.
72
+ - Guardian answers HTTP 200 with an empty body for a deploy the daemons rejected (the reason is only in the Guardian
73
+ log), for a duplicate deploy, and for pause, resume or undeploy of an unknown name. The server raises for a failure
74
+ in the envelope, maps service codes (for example 653 to `UNKNOWN_POD`), and never treats an empty reply as proof of
75
+ success.
76
+ - Before a change the server reads `usecase/list`. Deploy of a name already on the pod, and pause, resume or undeploy
77
+ of a name that is not on it, fail at once and send nothing.
78
+ - After a deploy the result has `verified: true` or `false` and the listed `state`. If the use case is not listed,
79
+ the note says the deployment most likely failed and points at the DSL schema and the daemon logs.
80
+ - Pause and resume return `state_before` and `state_after` from `usecase/list` (`RUNNING`, `SUSPENDED`), and the live
81
+ status rows.
82
+ - `undeploy_usecase` removes the use case and cannot be undone. `confirm` must equal `name` exactly. If it does not,
83
+ the error tells the agent to ask the user, and no request is sent. After the call the server checks `usecase/list`
84
+ and returns `removed: true` or `false`.
85
+ - A change is never retried.
86
+ - Every change tool is annotated as not read-only. `undeploy_usecase` is annotated destructive; the others are not. `pause_usecase` and `resume_usecase` are idempotent.
87
+
88
+ ## Resources
89
+
90
+ An agent should read these before it writes a use case specification.
91
+
92
+ | Resource | Guardian route | Content |
93
+ |---|---|---|
94
+ | `joule://dsl/schema` | `dsl/schema` | JSON Schema (2020-12) for the Joule DSL, as `application/schema+json` |
95
+ | `joule://dsl/catalogue` | `dsl/catalogue` | Every component with its key, properties and example, plus analytic and aggregate functions |
96
+ | `joule://dsl/component/{key}` | `dsl/catalogue` | One component by its DSL key (not case sensitive). Much smaller than the full catalogue |
97
+
98
+ The key needs the `dsl:read` scope. Guardian caches both routes for 5 minutes.
99
+
100
+ ## Install
101
+
102
+ Needs Python 3.10 or newer. After the first release on PyPI:
103
+
104
+ ```bash
105
+ pipx install joule-mcp # or: pip install joule-mcp
106
+ joule-mcp --help # starts the stdio server; an MCP client launches it for you
107
+ ```
108
+
109
+ Without installing anything, with `uv`:
110
+
111
+ ```bash
112
+ claude mcp add joule -- uvx joule-mcp
113
+ ```
114
+
115
+ From a source checkout:
116
+
117
+ ```bash
118
+ python3 -m venv .venv
119
+ .venv/bin/pip install -e ".[test]" # or: poetry install
120
+ .venv/bin/joule-mcp
121
+ ```
122
+
123
+ Upgrade with `pipx upgrade joule-mcp` or `pip install --upgrade joule-mcp`.
124
+
125
+ ## API keys
126
+
127
+ The server follows the same rules as the Joule UI. Guardian refuses any request without a valid `X-API-Key`, so the server
128
+ needs a key unless Guardian runs with authentication off.
129
+
130
+ | Situation | What the server does |
131
+ |---|---|
132
+ | Key is malformed (not 8 to 200 printable characters, no spaces) | Stops at start-up with a message. The key is not repeated. |
133
+ | Guardian wants a key and none is set | Every tool and resource answers "Guardian requires an API key" with how to set one. Nothing else is sent. |
134
+ | Guardian rejects the key (`AUTH_INVALID`, `AUTH_EXPIRED`, `AUTH_REVOKED`) | Every call says so and tells you to get a new key and restart. |
135
+ | Key is valid but lacks a scope | The call is refused before it is sent, and the message names the scope and the key's owner. |
136
+ | Guardian uses no keys (its `apikeys/whoami` does not exist) | Calls go through. |
137
+ | Guardian cannot be reached | The call itself reports that. |
138
+
139
+ Each tool states the scope it needs, the same as its Guardian route: `pods:read`, `usecases:read`, `transports:read`,
140
+ `streams:read`, `usecases:write` (deploy, pause, resume, undeploy) and `dsl:read` (the resources). A higher level
141
+ covers a lower one, so `usecases:write` includes `usecases:read`. Guardian stays the authority. The server's check only
142
+ saves a request that Guardian would refuse, and it never grants anything.
143
+
144
+ Use the `whoami` tool first when a call is refused. It says whether Guardian wants a key, whether this key is accepted,
145
+ who owns it, its scopes and when it ends. It never returns the key.
146
+
147
+ Get a key from the Joule UI (API keys) or joulectl. A `viewer` key is enough for the read tools, and an `operator` key adds
148
+ the change tools. Put the key in a file, set `JOULE_API_KEY_FILE` to its path, and keep the file private (`chmod 600`).
149
+ The server reads the key when it starts, so restart it after you change the key.
150
+
151
+ ## Settings
152
+
153
+ | Setting | Source, highest first |
154
+ |---|---|
155
+ | Guardian host | `JOULE_HOST`, `joule_host` in `~/.config/joule/config.json`, `127.0.0.1:9080` |
156
+ | API key | `JOULE_API_KEY_FILE`, `JOULE_API_KEY`, the key `joulectl` stored for that host |
157
+ | Change tools | `JOULE_MCP_ALLOW_WRITE=1` (default off) |
158
+ | Timeout | `JOULE_TIMEOUT`, default 30 seconds |
159
+ | Private CA | `JOULE_CA_BUNDLE` |
160
+
161
+ The key is sent as `X-API-Key`. It is never a tool argument, and it is not logged. Redirects are
162
+ refused so the key cannot be forwarded. A key with only `*:read` scopes keeps the agent read-only
163
+ at Guardian too.
164
+
165
+ ## Use with Claude Code
166
+
167
+ ```bash
168
+ claude mcp add joule -- joule-mcp
169
+ claude mcp add joule -e JOULE_MCP_ALLOW_WRITE=1 -- joule-mcp # with change tools
170
+ ```
171
+
172
+ ## Checked against a real Guardian
173
+
174
+ Run on 2026-12-02 against Joule 1.3 on minikube, through `kubectl port-forward`, with the key from joulectl's config:
175
+ all read tools and resources; pause and resume of a running use case (`RUNNING` to `SUSPENDED` and back, on both
176
+ daemons); deploy, refused duplicate and undeploy of a throwaway use case; and the refusal paths.
177
+
178
+ ## Release
179
+
180
+ Same process as joulectl (`.gitlab-ci.yml` here follows `fractalworks-joule-cli/.gitlab-ci.yml`).
181
+
182
+ 1. Set `version` in `pyproject.toml` and add the entry to `CHANGELOG.md`.
183
+ 2. Check: `poetry install && poetry run pytest --cov --cov-fail-under=95`, then `poetry build && twine check dist/*`.
184
+ 3. Tag with `release/release.sh <version> joule-mcp`, then push the tag yourself. The tag must be `vX.Y.Z` and equal
185
+ `version`, or the pipeline stops.
186
+ 4. The pipeline runs tests on Python 3.10 and 3.13, the security gates (pip-audit, bandit, secret detection), builds,
187
+ signs with Sigstore, then waits. Publish to TestPyPI first, then PyPI, each with a manual click.
188
+
189
+ ### Releasing from your own machine
190
+
191
+ `scripts/release_local.py` does the same checks and the same build as the pipeline, then uploads if you ask. Use one route
192
+ for each version: an index accepts a version once.
193
+
194
+ ```bash
195
+ git tag -a v0.1.0 -m "Release v0.1.0" # on a clean tree; the script never tags or pushes
196
+ python scripts/release_local.py # dry run: tests, build, twine check. Uploads nothing.
197
+ python scripts/release_local.py --upload testpypi # then try it: pip install -i https://test.pypi.org/simple/ joule-mcp
198
+ python scripts/release_local.py --upload pypi # needs the version on TestPyPI first; you type the tag to confirm
199
+ ```
200
+
201
+ Trusted Publishing works only from CI, so a local upload uses an API token. Put it in `TESTPYPI_TOKEN` or `PYPI_TOKEN`
202
+ (never on the command line), or leave it unset and twine reads `~/.pypirc`, your keyring, or asks. The first upload of a new
203
+ project needs a token for the whole account; replace it with one scoped to `joule-mcp` afterwards. A local upload has no
204
+ Sigstore signature and no SBOM: those come from the pipeline.
205
+
206
+ One-time setup, by the maintainers: create the GitLab project and add it to `repos.txt`; register a Trusted Publisher
207
+ (or a pending publisher for the first upload) for `joule-mcp` on pypi.org and test.pypi.org; protect `v*` tags and the
208
+ `pypi` environment. Details are at the top of `.gitlab-ci.yml`.
209
+
210
+ ## Test
211
+
212
+ ```bash
213
+ .venv/bin/python -m pytest
214
+ ```
215
+
216
+ ## Next
217
+
218
+ 1. Streamable HTTP transport.
219
+
220
+ ## Known risk: shared streams
221
+
222
+ On the Joule 1.3 test install (2026-12-02), deploying a second use case on the same stream as a running one worked.
223
+ Undeploying it then shut down the shared stream processors (`cleanMarketData` and the select step). The first use
224
+ case stayed `RUNNING` and kept receiving events, but processed and emitted none, and Guardian reported no error.
225
+ `undeploy_usecase` now refuses when another use case on the pod uses the same stream, and `deploy_usecase` returns a
226
+ `warning` in that case. Treat this as a Joule platform issue to confirm, not as a rule.
227
+
@@ -0,0 +1,200 @@
1
+ # joule-mcp
2
+
3
+ <!-- mcp-name: io.fractalworks/joule-mcp -->
4
+
5
+ An MCP server that lets an AI agent inspect a Joule installation. It calls the Guardian REST API
6
+ (`/joule/management/*`). It is independent of `joulectl` and Guardian.
7
+
8
+ By default the server is read-only. The change tools exist only when you set `JOULE_MCP_ALLOW_WRITE=1`.
9
+
10
+ ## Tools
11
+
12
+ | Tool | Guardian route | Same as |
13
+ |---|---|---|
14
+ | `list_pods` | `pods/list` | `joulectl ls pods` |
15
+ | `list_pod_members` | `pods/connected` | `joulectl ls members POD` |
16
+ | `list_usecases` | `usecase/list` | `joulectl ls usecases` |
17
+ | `list_transports` | `transports/list` | `joulectl ls transports` |
18
+ | `list_streams` | `stream/list` | `joulectl ls streams` |
19
+ | `usecase_status` | `usecase/status` | `joulectl status usecase NAME` |
20
+ | `usecase_events(name, pod, limit)` | `usecase/status` | `joulectl status usecase NAME --events` |
21
+ | `whoami` | `apikeys/whoami` | the Joule UI's "who am I" |
22
+ | `describe_usecase` | `usecase/list`, `usecase/detail`, `usecase/status` | `joulectl inspect usecase NAME` and `status` |
23
+
24
+ Every tool carries the `readOnlyHint` annotation.
25
+
26
+ `usecase_events` returns the latest events a use case emitted, parsed from JSON, for each running process (`limit` 1 to
27
+ 100, default 10, newest last). Guardian keeps only a short sample in memory (`last_emitted_events`), so it is for
28
+ inspection, not a stream, and it is empty while a use case is paused or idle. The result gives `emitted_events` for
29
+ each process, so two calls show whether events are flowing.
30
+
31
+ ## Change tools
32
+
33
+ Off unless `JOULE_MCP_ALLOW_WRITE=1` is set. Guardian needs the `usecases:write` scope on the key.
34
+ `pod` is always required, so no change reaches every pod by accident.
35
+
36
+ | Tool | Guardian route | Same as |
37
+ |---|---|---|
38
+ | `deploy_usecase(pod, specification)` | `POST usecase/deploy` | `joulectl deploy usecase` |
39
+ | `pause_usecase(name, pod)` | `PUT usecase/pause` | `joulectl process pause` |
40
+ | `resume_usecase(name, pod)` | `PUT usecase/resume` | `joulectl process resume` |
41
+ | `undeploy_usecase(name, pod, confirm)` | `DELETE usecase/undeploy` | `joulectl undeploy usecase` |
42
+
43
+ - `specification` is an object, or JSON or YAML text. It is parsed with a safe loader and sent as JSON.
44
+ The root key is `use case`, and a use case needs at least one source and one sink. For example:
45
+ `{"use case": {"name": "x", "stream name": "s", "sources": ["a"], "sinks": ["b"]}}`.
46
+ - Guardian answers HTTP 200 with an empty body for a deploy the daemons rejected (the reason is only in the Guardian
47
+ log), for a duplicate deploy, and for pause, resume or undeploy of an unknown name. The server raises for a failure
48
+ in the envelope, maps service codes (for example 653 to `UNKNOWN_POD`), and never treats an empty reply as proof of
49
+ success.
50
+ - Before a change the server reads `usecase/list`. Deploy of a name already on the pod, and pause, resume or undeploy
51
+ of a name that is not on it, fail at once and send nothing.
52
+ - After a deploy the result has `verified: true` or `false` and the listed `state`. If the use case is not listed,
53
+ the note says the deployment most likely failed and points at the DSL schema and the daemon logs.
54
+ - Pause and resume return `state_before` and `state_after` from `usecase/list` (`RUNNING`, `SUSPENDED`), and the live
55
+ status rows.
56
+ - `undeploy_usecase` removes the use case and cannot be undone. `confirm` must equal `name` exactly. If it does not,
57
+ the error tells the agent to ask the user, and no request is sent. After the call the server checks `usecase/list`
58
+ and returns `removed: true` or `false`.
59
+ - A change is never retried.
60
+ - Every change tool is annotated as not read-only. `undeploy_usecase` is annotated destructive; the others are not. `pause_usecase` and `resume_usecase` are idempotent.
61
+
62
+ ## Resources
63
+
64
+ An agent should read these before it writes a use case specification.
65
+
66
+ | Resource | Guardian route | Content |
67
+ |---|---|---|
68
+ | `joule://dsl/schema` | `dsl/schema` | JSON Schema (2020-12) for the Joule DSL, as `application/schema+json` |
69
+ | `joule://dsl/catalogue` | `dsl/catalogue` | Every component with its key, properties and example, plus analytic and aggregate functions |
70
+ | `joule://dsl/component/{key}` | `dsl/catalogue` | One component by its DSL key (not case sensitive). Much smaller than the full catalogue |
71
+
72
+ The key needs the `dsl:read` scope. Guardian caches both routes for 5 minutes.
73
+
74
+ ## Install
75
+
76
+ Needs Python 3.10 or newer. After the first release on PyPI:
77
+
78
+ ```bash
79
+ pipx install joule-mcp # or: pip install joule-mcp
80
+ joule-mcp --help # starts the stdio server; an MCP client launches it for you
81
+ ```
82
+
83
+ Without installing anything, with `uv`:
84
+
85
+ ```bash
86
+ claude mcp add joule -- uvx joule-mcp
87
+ ```
88
+
89
+ From a source checkout:
90
+
91
+ ```bash
92
+ python3 -m venv .venv
93
+ .venv/bin/pip install -e ".[test]" # or: poetry install
94
+ .venv/bin/joule-mcp
95
+ ```
96
+
97
+ Upgrade with `pipx upgrade joule-mcp` or `pip install --upgrade joule-mcp`.
98
+
99
+ ## API keys
100
+
101
+ The server follows the same rules as the Joule UI. Guardian refuses any request without a valid `X-API-Key`, so the server
102
+ needs a key unless Guardian runs with authentication off.
103
+
104
+ | Situation | What the server does |
105
+ |---|---|
106
+ | Key is malformed (not 8 to 200 printable characters, no spaces) | Stops at start-up with a message. The key is not repeated. |
107
+ | Guardian wants a key and none is set | Every tool and resource answers "Guardian requires an API key" with how to set one. Nothing else is sent. |
108
+ | Guardian rejects the key (`AUTH_INVALID`, `AUTH_EXPIRED`, `AUTH_REVOKED`) | Every call says so and tells you to get a new key and restart. |
109
+ | Key is valid but lacks a scope | The call is refused before it is sent, and the message names the scope and the key's owner. |
110
+ | Guardian uses no keys (its `apikeys/whoami` does not exist) | Calls go through. |
111
+ | Guardian cannot be reached | The call itself reports that. |
112
+
113
+ Each tool states the scope it needs, the same as its Guardian route: `pods:read`, `usecases:read`, `transports:read`,
114
+ `streams:read`, `usecases:write` (deploy, pause, resume, undeploy) and `dsl:read` (the resources). A higher level
115
+ covers a lower one, so `usecases:write` includes `usecases:read`. Guardian stays the authority. The server's check only
116
+ saves a request that Guardian would refuse, and it never grants anything.
117
+
118
+ Use the `whoami` tool first when a call is refused. It says whether Guardian wants a key, whether this key is accepted,
119
+ who owns it, its scopes and when it ends. It never returns the key.
120
+
121
+ Get a key from the Joule UI (API keys) or joulectl. A `viewer` key is enough for the read tools, and an `operator` key adds
122
+ the change tools. Put the key in a file, set `JOULE_API_KEY_FILE` to its path, and keep the file private (`chmod 600`).
123
+ The server reads the key when it starts, so restart it after you change the key.
124
+
125
+ ## Settings
126
+
127
+ | Setting | Source, highest first |
128
+ |---|---|
129
+ | Guardian host | `JOULE_HOST`, `joule_host` in `~/.config/joule/config.json`, `127.0.0.1:9080` |
130
+ | API key | `JOULE_API_KEY_FILE`, `JOULE_API_KEY`, the key `joulectl` stored for that host |
131
+ | Change tools | `JOULE_MCP_ALLOW_WRITE=1` (default off) |
132
+ | Timeout | `JOULE_TIMEOUT`, default 30 seconds |
133
+ | Private CA | `JOULE_CA_BUNDLE` |
134
+
135
+ The key is sent as `X-API-Key`. It is never a tool argument, and it is not logged. Redirects are
136
+ refused so the key cannot be forwarded. A key with only `*:read` scopes keeps the agent read-only
137
+ at Guardian too.
138
+
139
+ ## Use with Claude Code
140
+
141
+ ```bash
142
+ claude mcp add joule -- joule-mcp
143
+ claude mcp add joule -e JOULE_MCP_ALLOW_WRITE=1 -- joule-mcp # with change tools
144
+ ```
145
+
146
+ ## Checked against a real Guardian
147
+
148
+ Run on 2026-12-02 against Joule 1.3 on minikube, through `kubectl port-forward`, with the key from joulectl's config:
149
+ all read tools and resources; pause and resume of a running use case (`RUNNING` to `SUSPENDED` and back, on both
150
+ daemons); deploy, refused duplicate and undeploy of a throwaway use case; and the refusal paths.
151
+
152
+ ## Release
153
+
154
+ Same process as joulectl (`.gitlab-ci.yml` here follows `fractalworks-joule-cli/.gitlab-ci.yml`).
155
+
156
+ 1. Set `version` in `pyproject.toml` and add the entry to `CHANGELOG.md`.
157
+ 2. Check: `poetry install && poetry run pytest --cov --cov-fail-under=95`, then `poetry build && twine check dist/*`.
158
+ 3. Tag with `release/release.sh <version> joule-mcp`, then push the tag yourself. The tag must be `vX.Y.Z` and equal
159
+ `version`, or the pipeline stops.
160
+ 4. The pipeline runs tests on Python 3.10 and 3.13, the security gates (pip-audit, bandit, secret detection), builds,
161
+ signs with Sigstore, then waits. Publish to TestPyPI first, then PyPI, each with a manual click.
162
+
163
+ ### Releasing from your own machine
164
+
165
+ `scripts/release_local.py` does the same checks and the same build as the pipeline, then uploads if you ask. Use one route
166
+ for each version: an index accepts a version once.
167
+
168
+ ```bash
169
+ git tag -a v0.1.0 -m "Release v0.1.0" # on a clean tree; the script never tags or pushes
170
+ python scripts/release_local.py # dry run: tests, build, twine check. Uploads nothing.
171
+ python scripts/release_local.py --upload testpypi # then try it: pip install -i https://test.pypi.org/simple/ joule-mcp
172
+ python scripts/release_local.py --upload pypi # needs the version on TestPyPI first; you type the tag to confirm
173
+ ```
174
+
175
+ Trusted Publishing works only from CI, so a local upload uses an API token. Put it in `TESTPYPI_TOKEN` or `PYPI_TOKEN`
176
+ (never on the command line), or leave it unset and twine reads `~/.pypirc`, your keyring, or asks. The first upload of a new
177
+ project needs a token for the whole account; replace it with one scoped to `joule-mcp` afterwards. A local upload has no
178
+ Sigstore signature and no SBOM: those come from the pipeline.
179
+
180
+ One-time setup, by the maintainers: create the GitLab project and add it to `repos.txt`; register a Trusted Publisher
181
+ (or a pending publisher for the first upload) for `joule-mcp` on pypi.org and test.pypi.org; protect `v*` tags and the
182
+ `pypi` environment. Details are at the top of `.gitlab-ci.yml`.
183
+
184
+ ## Test
185
+
186
+ ```bash
187
+ .venv/bin/python -m pytest
188
+ ```
189
+
190
+ ## Next
191
+
192
+ 1. Streamable HTTP transport.
193
+
194
+ ## Known risk: shared streams
195
+
196
+ On the Joule 1.3 test install (2026-12-02), deploying a second use case on the same stream as a running one worked.
197
+ Undeploying it then shut down the shared stream processors (`cleanMarketData` and the select step). The first use
198
+ case stayed `RUNNING` and kept receiving events, but processed and emitted none, and Guardian reported no error.
199
+ `undeploy_usecase` now refuses when another use case on the pod uses the same stream, and `deploy_usecase` returns a
200
+ `warning` in that case. Treat this as a Joule platform issue to confirm, not as a rule.
@@ -0,0 +1,42 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ **Do not open a public issue for a security problem.** Report it privately to the Fractalworks security contact.
6
+
7
+ > Maintainers: lyndon.adams@fractalworks.io
8
+
9
+ Please include what you found, how to reproduce it, the `joule-mcp` version and what an attacker could do with it.
10
+ We aim to acknowledge a report within 3 working days and to say what we plan to do within 10.
11
+
12
+ ## Supported versions
13
+
14
+ Only the latest release receives security fixes.
15
+
16
+ ## What joule-mcp does to protect you
17
+
18
+ - Change tools do not exist unless `JOULE_MCP_ALLOW_WRITE=1` is set. Without it the server is read-only.
19
+ - `undeploy_usecase` sends nothing unless `confirm` equals the use case name, and it refuses when another use case on
20
+ the pod shares the stream.
21
+ - The API key is read from a file or the environment. It is never a tool argument, and it is not logged or returned in an
22
+ error.
23
+ - Requests never follow redirects, so the key cannot be forwarded to another host. A host value with a user, path or
24
+ query is rejected. The client warns when it sends a key over plain HTTP to a host that is not this machine.
25
+ - Every tool and resource is checked against the scope of its Guardian route before it is sent, so a key without a scope
26
+ cannot make the server send that call. Guardian still enforces the scopes itself.
27
+ - A change is never retried.
28
+ - Dependencies are audited in CI and pinned by `poetry.lock`. CI base images are pinned by digest.
29
+
30
+ ## Known limitations
31
+
32
+ - The server has the rights of the API key it is given. Use a key with only the scopes you need, for example only `*:read`
33
+ scopes for an agent that must not change anything.
34
+ - Guardian can answer HTTP 200 with an empty body for a request the daemons rejected. `joule-mcp` checks the result with a
35
+ follow-up read, but it can only report what Guardian shows.
36
+ - On the Joule 1.3 test install, undeploying a use case stopped another use case that shared its stream from processing
37
+ events. See the README, "Known risk: shared streams".
38
+
39
+ ## Verifying a release
40
+
41
+ Release artifacts are built in CI from a tag `vX.Y.Z` that equals the `version` in `pyproject.toml`. Each wheel and sdist
42
+ has a Sigstore bundle next to it (job `sign`).
@@ -0,0 +1,7 @@
1
+ """Joule MCP server: inspect and manage Joule through the Guardian REST API."""
2
+ from importlib.metadata import PackageNotFoundError, version
3
+
4
+ try:
5
+ __version__ = version("joule-mcp")
6
+ except PackageNotFoundError: # running from a source tree that is not installed
7
+ __version__ = "dev"