cielo-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.
- cielo_mcp-0.1.1/LICENSE +21 -0
- cielo_mcp-0.1.1/PKG-INFO +246 -0
- cielo_mcp-0.1.1/README.md +212 -0
- cielo_mcp-0.1.1/cielo_mcp/__init__.py +9 -0
- cielo_mcp-0.1.1/cielo_mcp/__main__.py +3 -0
- cielo_mcp-0.1.1/cielo_mcp/cli.py +94 -0
- cielo_mcp-0.1.1/cielo_mcp/contract.py +92 -0
- cielo_mcp-0.1.1/cielo_mcp/domains.py +65 -0
- cielo_mcp-0.1.1/cielo_mcp/server.py +272 -0
- cielo_mcp-0.1.1/cielo_mcp.egg-info/PKG-INFO +246 -0
- cielo_mcp-0.1.1/cielo_mcp.egg-info/SOURCES.txt +19 -0
- cielo_mcp-0.1.1/cielo_mcp.egg-info/dependency_links.txt +1 -0
- cielo_mcp-0.1.1/cielo_mcp.egg-info/entry_points.txt +2 -0
- cielo_mcp-0.1.1/cielo_mcp.egg-info/requires.txt +5 -0
- cielo_mcp-0.1.1/cielo_mcp.egg-info/top_level.txt +1 -0
- cielo_mcp-0.1.1/pyproject.toml +59 -0
- cielo_mcp-0.1.1/setup.cfg +4 -0
- cielo_mcp-0.1.1/tests/test_server_domains.py +175 -0
- cielo_mcp-0.1.1/tests/test_server_resources.py +42 -0
- cielo_mcp-0.1.1/tests/test_server_tools.py +238 -0
- cielo_mcp-0.1.1/tests/test_server_transports.py +112 -0
cielo_mcp-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Valentina Vanegas Aristizábal
|
|
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.
|
cielo_mcp-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cielo-mcp
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: MCP server for cielo-bench: the benchmark's own tools, with citations and honest failures, for any MCP client.
|
|
5
|
+
Author: Valentina Vanegas Aristizábal
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/vvanegasar/cielo-bench/tree/main/server
|
|
8
|
+
Project-URL: Repository, https://github.com/vvanegasar/cielo-bench
|
|
9
|
+
Project-URL: Issues, https://github.com/vvanegasar/cielo-bench/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/vvanegasar/cielo-bench/blob/main/server/README.md
|
|
11
|
+
Project-URL: Changelog, https://github.com/vvanegasar/cielo-bench/blob/main/CHANGELOG.md
|
|
12
|
+
Project-URL: Technical report, https://doi.org/10.5281/zenodo.24481194
|
|
13
|
+
Keywords: mcp,model-context-protocol,mcp-server,llm,agents,tool-use,benchmark,sycophancy,ground-truth,astronomy,jpl-horizons,sqlite
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Natural Language :: English
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
26
|
+
Requires-Python: >=3.12
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: cielo-bench<1.2,>=1.1.1
|
|
30
|
+
Requires-Dist: mcp==2.3.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest<10,>=8; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# cielo-mcp — the cielo-bench tools as an MCP server
|
|
36
|
+
|
|
37
|
+
<!-- mcp-name: io.github.vvanegasar/cielo-mcp -->
|
|
38
|
+
|
|
39
|
+
`cielo` is the MCP server of [cielo-bench](https://github.com/vvanegasar/cielo-bench), a benchmark that measures whether AI agents check a user's claim with their tools or simply agree with it, judged against an external ground truth (NASA/JPL Horizons ephemerides) instead of another model.
|
|
40
|
+
|
|
41
|
+
The server exposes **the benchmark's own tools, unchanged**, to any MCP client, such as Claude Desktop or MCP Inspector. A test checks that every MCP result equals what the benchmark's executor returns for the same call. Every `ok` result cites its source (service, query and retrieval time), and when the source is down or a value is not available the tool says so and returns no numbers.
|
|
42
|
+
|
|
43
|
+
- Python, built on the official [MCP Python SDK](https://pypi.org/project/mcp/) (`mcp==2.3.0`, whose `MCPServer` is the 2.x name of FastMCP).
|
|
44
|
+
- stdio for Claude Desktop and other local clients; Streamable HTTP on `127.0.0.1` for local use.
|
|
45
|
+
- Read-only tools, a resource with the method and credits (`cielo://about`), and a prompt (`check_claim`).
|
|
46
|
+
- Domains are discovered from the benchmark's registry: astronomy, and tabular company data. A new domain's tools are served with no change here.
|
|
47
|
+
|
|
48
|
+
Design: [ADR-0007](https://github.com/vvanegasar/cielo-bench/blob/main/docs/adr/0007-python-mcp-server.md). Tool contracts: [docs/TOOLS.md](https://github.com/vvanegasar/cielo-bench/blob/main/docs/TOOLS.md).
|
|
49
|
+
|
|
50
|
+
## Tools
|
|
51
|
+
|
|
52
|
+
| Tool | What it answers | Source |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `body_position` | Altitude, azimuth, rate of climb, RA/Dec and distance of the Sun, the Moon or a planet at an instant, from Medellín, Bogotá or Barranquilla; with `relative_to`, the angular separation from a second body | NASA/JPL Horizons |
|
|
55
|
+
| `body_rise_set` | Rise and set (with their azimuths) and culmination of a body on a local date | NASA/JPL Horizons |
|
|
56
|
+
| `moon_phase` | Illuminated fraction of the Moon, waxing or waning, and the Sun–Moon elongation at an instant | NASA/JPL Horizons |
|
|
57
|
+
| `describe_schema` | Read-only: tables, columns, keys and conventions of a fictional distributor's database | Synthetic, seeded SQLite snapshot |
|
|
58
|
+
| `run_sql` | Read-only: one `SELECT` on that database; anything that could write is rejected as `invalid_input` | Synthetic, seeded SQLite snapshot |
|
|
59
|
+
|
|
60
|
+
All tools are annotated `readOnlyHint: true`. `openWorldHint` is `true` only in `--live` mode, and only for domains whose tools can reach a source outside the machine (`Domain.external_source`: astronomy yes, tabular no). The tool list comes from the domains themselves, so a new tool appears here without a server change (contracts in [docs/TOOLS.md](https://github.com/vvanegasar/cielo-bench/blob/main/docs/TOOLS.md)).
|
|
61
|
+
|
|
62
|
+
Each domain also declares fault profiles that make its source behave as down:
|
|
63
|
+
- astronomy: `down`, `error`, `empty`, `malformed` and `timeout`;
|
|
64
|
+
- tabular: `down`, `error`, `empty`, `timeout` and `permission_denied`.
|
|
65
|
+
|
|
66
|
+
The benchmark and the tests use them, and every one of them yields `source_unavailable` with no values through MCP. The server itself never injects a fault.
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
Python 3.12 or newer:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python3 -m venv .venv
|
|
74
|
+
source .venv/bin/activate
|
|
75
|
+
pip install cielo-mcp # this server and the benchmark core (cielo-bench); pins mcp==2.3.0
|
|
76
|
+
cielo-mcp --version # cielo-mcp 0.1.1
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The benchmark core, `cielo-bench`, is installed with it (a 1.1.x release, 1.1.1 or newer) and carries the golden sets and the cached fixtures, so the server works offline. No API keys are needed, and the server never reads any.
|
|
80
|
+
|
|
81
|
+
From a checkout of the repository, install the core first, then the server:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install -e . # the benchmark core (cielo_bench)
|
|
85
|
+
pip install -e ./server # this server
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Run
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cielo-mcp # stdio, cache only (what a client starts)
|
|
92
|
+
cielo-mcp --live # stdio, may query NASA/JPL Horizons
|
|
93
|
+
cielo-mcp --live --cache-dir ~/cielo-cache # same, with the live cache somewhere else
|
|
94
|
+
cielo-mcp --transport streamable-http --port 8000 # http://127.0.0.1:8000/mcp
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Started by hand over stdio, the server waits silently for a client on stdin; stop it with Ctrl-C. Logs go to stderr (`--log-level INFO` for more).
|
|
98
|
+
|
|
99
|
+
**Cache only (default).** The tools answer from what is already cached, and nothing leaves the machine. The cache is the benchmark's committed fixtures, which cover the golden set's dates (for example 12 December 2026 in Medellín), plus whatever earlier `--live` runs stored in the live cache. For anything else the tools return `source_unavailable` with reason `offline_cache_miss`, which is the honest-failure path the benchmark measures.
|
|
100
|
+
|
|
101
|
+
**Live (`--live`).** The tools may query NASA/JPL Horizons, following its fair-use policy. The client sends one request at a time, at least 1 s apart, caches every response by query, and identifies itself as `cielo-mcp/0.1.1 (MCP server of the cielo-bench research benchmark; non-commercial)`, with no personal data. There are at most 100 requests per server process (`--max-live-requests N`).
|
|
102
|
+
|
|
103
|
+
**Live cache.** Live responses, and the log of each request, are stored outside the repository: in `--cache-dir DIR` if given, else `CIELO_CACHE_DIR`, else `$XDG_CACHE_HOME/cielo-bench`, else `~/.cache/cielo-bench`. The repository's fixtures are never written.
|
|
104
|
+
|
|
105
|
+
Environment variables (optional):
|
|
106
|
+
- `CIELO_USER_AGENT` replaces the User-Agent; keep it free of personal data.
|
|
107
|
+
- `CIELO_CA_BUNDLE` points TLS verification at another CA bundle.
|
|
108
|
+
- `CIELO_CACHE_DIR` sets the live cache (`--cache-dir` wins).
|
|
109
|
+
|
|
110
|
+
The server reads no other variables. For the default live-cache location the core also honours `XDG_CACHE_HOME`.
|
|
111
|
+
|
|
112
|
+
## Claude Desktop
|
|
113
|
+
|
|
114
|
+
Open **Settings → Developer → Edit Config**, or edit the file directly:
|
|
115
|
+
|
|
116
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
117
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
118
|
+
|
|
119
|
+
Add the server, using the absolute path to `cielo-mcp` in the virtual environment where it is installed (`which cielo-mcp` prints it):
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"cielo": {
|
|
125
|
+
"command": "/absolute/path/to/.venv/bin/cielo-mcp",
|
|
126
|
+
"args": ["--live"]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
On Windows the command is `C:\\absolute\\path\\to\\.venv\\Scripts\\cielo-mcp.exe`. Restart Claude Desktop. Then ask, for example, *"Where will Saturn be from Medellín at 9 pm on 12 December 2026?"*, or use the `check_claim` prompt with a claim to check. Remove `"--live"` to run cache-only. On macOS the server's stderr is in `~/Library/Logs/Claude/mcp-server-cielo.log`.
|
|
133
|
+
|
|
134
|
+
## MCP Inspector
|
|
135
|
+
|
|
136
|
+
[MCP Inspector](https://github.com/modelcontextprotocol/inspector) v2 needs Node.js (`^22.23.4`, `^24.22.1` or `>=26.12.1`). The commands below use its v2 syntax.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Web UI over stdio: list the tools, read cielo://about, call a tool
|
|
140
|
+
npx @modelcontextprotocol/inspector@2 /absolute/path/to/.venv/bin/cielo-mcp
|
|
141
|
+
|
|
142
|
+
# CLI: list the tools, then call one (cached, so it works offline)
|
|
143
|
+
npx @modelcontextprotocol/inspector@2 --cli /absolute/path/to/.venv/bin/cielo-mcp \
|
|
144
|
+
--method tools/list
|
|
145
|
+
npx @modelcontextprotocol/inspector@2 --cli /absolute/path/to/.venv/bin/cielo-mcp \
|
|
146
|
+
--method tools/call --tool-name body_position \
|
|
147
|
+
--tool-args-json '{"body": "Saturn", "location": {"city": "Medellín"}, "datetime": "2026-12-12T21:00:00-05:00"}'
|
|
148
|
+
|
|
149
|
+
# Streamable HTTP: start the server, then point the Inspector at it
|
|
150
|
+
cielo-mcp --transport streamable-http --port 8000
|
|
151
|
+
npx @modelcontextprotocol/inspector@2 --server-url http://127.0.0.1:8000/mcp --transport http
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The Inspector CLI exits with code 5 when a result has `isError: true`, for example a `source_unavailable` result.
|
|
155
|
+
|
|
156
|
+
## Example calls
|
|
157
|
+
|
|
158
|
+
Real results from the cached fixtures. `structuredContent` holds the object, and the text block holds the same JSON.
|
|
159
|
+
|
|
160
|
+
**`body_position`** with `{"body": "Saturn", "location": {"city": "Medellín"}, "datetime": "2026-12-12T21:00:00-05:00"}` returns `isError: false` (abbreviated):
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"status": "ok",
|
|
165
|
+
"body": "Saturn",
|
|
166
|
+
"datetime_local": "2026-12-12T21:00:00-05:00",
|
|
167
|
+
"altitude_deg": 61.63,
|
|
168
|
+
"azimuth_deg": 260.07,
|
|
169
|
+
"altitude_rate_deg_per_hour": -14.72,
|
|
170
|
+
"above_horizon": true,
|
|
171
|
+
"sources": [{
|
|
172
|
+
"service": "NASA/JPL Horizons API",
|
|
173
|
+
"endpoint": "https://ssd.jpl.nasa.gov/api/horizons.api",
|
|
174
|
+
"query": {"COMMAND": "'699'", "SITE_COORD": "'-75.5748,6.2447,1.495'", "STEP_SIZE": "'1 m'", "…": "…"},
|
|
175
|
+
"retrieved_at_utc": "2026-11-19T03:20:08Z",
|
|
176
|
+
"response_sha256": "85fff3ecce8c39e32c1f09ffc10b647e58c7c41ba5e7aa35028b91887932ce79"
|
|
177
|
+
}],
|
|
178
|
+
"credit": "NASA/JPL Solar System Dynamics — Horizons (https://ssd.jpl.nasa.gov/horizons/)"
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Saturn is sinking at 14.72° per hour, two hours after it culminated. Adding `"relative_to": "Jupiter"` to a `body_position` call adds `separation_deg`, with one citation per body: from Medellín at 05:00 on 12 December 2026, Venus is 68.74° from Jupiter.
|
|
183
|
+
|
|
184
|
+
**`body_rise_set`** with `{"body": "Saturn", "location": {"city": "Medellín"}, "date": "2026-12-12"}` gives:
|
|
185
|
+
- a rise at `13:07`, at azimuth 89.12° (almost due east);
|
|
186
|
+
- culmination at `19:09`, 84.57° high;
|
|
187
|
+
- a set at `01:14` (the night before), at azimuth 270.88°.
|
|
188
|
+
|
|
189
|
+
Each time comes in local time and UTC, with the same citation.
|
|
190
|
+
|
|
191
|
+
**`moon_phase`** with `{"location": {"city": "Medellín"}, "datetime": "2026-12-26T19:30:00-05:00"}` gives `illuminated_fraction_pct` 86.86, `phase` `waning` and `sun_moon_elongation_deg` 137.4, two days after the full Moon.
|
|
192
|
+
|
|
193
|
+
**A date outside the cache**, in cache-only mode, returns `isError: true` and no values:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{"status": "source_unavailable", "source": "NASA/JPL Horizons API", "reason": "offline_cache_miss",
|
|
197
|
+
"message": "NASA/JPL Horizons API could not provide data (offline_cache_miss). No values are returned."}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Invalid input**, such as `"body": "Pluto"`, returns `isError: true`:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{"status": "invalid_input", "message": "body must be one of ['Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']"}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
From Python, with the SDK's client:
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
import anyio
|
|
210
|
+
from mcp import Client, StdioServerParameters
|
|
211
|
+
|
|
212
|
+
async def main() -> None:
|
|
213
|
+
server = StdioServerParameters(command="cielo-mcp")
|
|
214
|
+
async with Client(server) as client:
|
|
215
|
+
result = await client.call_tool("body_position", {
|
|
216
|
+
"body": "Saturn", "location": {"city": "Medellín"}, "datetime": "2026-12-12T21:00:00-05:00"})
|
|
217
|
+
print(result.is_error, result.structured_content["altitude_deg"]) # False 61.63
|
|
218
|
+
|
|
219
|
+
anyio.run(main)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Tests
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
pip install -e "./server[dev]"
|
|
226
|
+
pytest server/tests # or: cd server && pytest
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
The suite runs offline (127 tests in about 8 s). A guard fails any test that tries to reach the network, and the live cache is an empty temporary directory. It covers:
|
|
230
|
+
|
|
231
|
+
- the tool listing (schemas, annotations, output schema);
|
|
232
|
+
- `ok` calls compared with the benchmark's executor (same object, byte-identical text), including `moon_phase`, `relative_to`, and a replay of every call in each registered domain's golden set;
|
|
233
|
+
- every input error case and cache misses;
|
|
234
|
+
- every fault profile each domain declares, run end to end through MCP;
|
|
235
|
+
- the command line, including `--cache-dir` and the environment settings it reads;
|
|
236
|
+
- domain discovery, including a registered domain that does not exist yet;
|
|
237
|
+
- name prefixing when two domains share a tool name, and the contract guard;
|
|
238
|
+
- the resource and the prompt.
|
|
239
|
+
|
|
240
|
+
The MCP cases run over both protocol eras: the `initialize` handshake (what Claude Desktop speaks) and 2026-07-28. The real transports are tested too: the server as a stdio subprocess, in both eras, and Streamable HTTP on 127.0.0.1.
|
|
241
|
+
|
|
242
|
+
## Credits
|
|
243
|
+
|
|
244
|
+
Ephemerides: NASA/JPL Solar System Dynamics — Horizons. cielo-bench is an independent project and is not endorsed by NASA or JPL. See [DATA-SOURCES](https://github.com/vvanegasar/cielo-bench/blob/main/docs/DATA-SOURCES.md).
|
|
245
|
+
|
|
246
|
+
MIT license, see [LICENSE](https://github.com/vvanegasar/cielo-bench/blob/main/LICENSE).
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# cielo-mcp — the cielo-bench tools as an MCP server
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.vvanegasar/cielo-mcp -->
|
|
4
|
+
|
|
5
|
+
`cielo` is the MCP server of [cielo-bench](https://github.com/vvanegasar/cielo-bench), a benchmark that measures whether AI agents check a user's claim with their tools or simply agree with it, judged against an external ground truth (NASA/JPL Horizons ephemerides) instead of another model.
|
|
6
|
+
|
|
7
|
+
The server exposes **the benchmark's own tools, unchanged**, to any MCP client, such as Claude Desktop or MCP Inspector. A test checks that every MCP result equals what the benchmark's executor returns for the same call. Every `ok` result cites its source (service, query and retrieval time), and when the source is down or a value is not available the tool says so and returns no numbers.
|
|
8
|
+
|
|
9
|
+
- Python, built on the official [MCP Python SDK](https://pypi.org/project/mcp/) (`mcp==2.3.0`, whose `MCPServer` is the 2.x name of FastMCP).
|
|
10
|
+
- stdio for Claude Desktop and other local clients; Streamable HTTP on `127.0.0.1` for local use.
|
|
11
|
+
- Read-only tools, a resource with the method and credits (`cielo://about`), and a prompt (`check_claim`).
|
|
12
|
+
- Domains are discovered from the benchmark's registry: astronomy, and tabular company data. A new domain's tools are served with no change here.
|
|
13
|
+
|
|
14
|
+
Design: [ADR-0007](https://github.com/vvanegasar/cielo-bench/blob/main/docs/adr/0007-python-mcp-server.md). Tool contracts: [docs/TOOLS.md](https://github.com/vvanegasar/cielo-bench/blob/main/docs/TOOLS.md).
|
|
15
|
+
|
|
16
|
+
## Tools
|
|
17
|
+
|
|
18
|
+
| Tool | What it answers | Source |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `body_position` | Altitude, azimuth, rate of climb, RA/Dec and distance of the Sun, the Moon or a planet at an instant, from Medellín, Bogotá or Barranquilla; with `relative_to`, the angular separation from a second body | NASA/JPL Horizons |
|
|
21
|
+
| `body_rise_set` | Rise and set (with their azimuths) and culmination of a body on a local date | NASA/JPL Horizons |
|
|
22
|
+
| `moon_phase` | Illuminated fraction of the Moon, waxing or waning, and the Sun–Moon elongation at an instant | NASA/JPL Horizons |
|
|
23
|
+
| `describe_schema` | Read-only: tables, columns, keys and conventions of a fictional distributor's database | Synthetic, seeded SQLite snapshot |
|
|
24
|
+
| `run_sql` | Read-only: one `SELECT` on that database; anything that could write is rejected as `invalid_input` | Synthetic, seeded SQLite snapshot |
|
|
25
|
+
|
|
26
|
+
All tools are annotated `readOnlyHint: true`. `openWorldHint` is `true` only in `--live` mode, and only for domains whose tools can reach a source outside the machine (`Domain.external_source`: astronomy yes, tabular no). The tool list comes from the domains themselves, so a new tool appears here without a server change (contracts in [docs/TOOLS.md](https://github.com/vvanegasar/cielo-bench/blob/main/docs/TOOLS.md)).
|
|
27
|
+
|
|
28
|
+
Each domain also declares fault profiles that make its source behave as down:
|
|
29
|
+
- astronomy: `down`, `error`, `empty`, `malformed` and `timeout`;
|
|
30
|
+
- tabular: `down`, `error`, `empty`, `timeout` and `permission_denied`.
|
|
31
|
+
|
|
32
|
+
The benchmark and the tests use them, and every one of them yields `source_unavailable` with no values through MCP. The server itself never injects a fault.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
Python 3.12 or newer:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python3 -m venv .venv
|
|
40
|
+
source .venv/bin/activate
|
|
41
|
+
pip install cielo-mcp # this server and the benchmark core (cielo-bench); pins mcp==2.3.0
|
|
42
|
+
cielo-mcp --version # cielo-mcp 0.1.1
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The benchmark core, `cielo-bench`, is installed with it (a 1.1.x release, 1.1.1 or newer) and carries the golden sets and the cached fixtures, so the server works offline. No API keys are needed, and the server never reads any.
|
|
46
|
+
|
|
47
|
+
From a checkout of the repository, install the core first, then the server:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install -e . # the benchmark core (cielo_bench)
|
|
51
|
+
pip install -e ./server # this server
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Run
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
cielo-mcp # stdio, cache only (what a client starts)
|
|
58
|
+
cielo-mcp --live # stdio, may query NASA/JPL Horizons
|
|
59
|
+
cielo-mcp --live --cache-dir ~/cielo-cache # same, with the live cache somewhere else
|
|
60
|
+
cielo-mcp --transport streamable-http --port 8000 # http://127.0.0.1:8000/mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Started by hand over stdio, the server waits silently for a client on stdin; stop it with Ctrl-C. Logs go to stderr (`--log-level INFO` for more).
|
|
64
|
+
|
|
65
|
+
**Cache only (default).** The tools answer from what is already cached, and nothing leaves the machine. The cache is the benchmark's committed fixtures, which cover the golden set's dates (for example 12 December 2026 in Medellín), plus whatever earlier `--live` runs stored in the live cache. For anything else the tools return `source_unavailable` with reason `offline_cache_miss`, which is the honest-failure path the benchmark measures.
|
|
66
|
+
|
|
67
|
+
**Live (`--live`).** The tools may query NASA/JPL Horizons, following its fair-use policy. The client sends one request at a time, at least 1 s apart, caches every response by query, and identifies itself as `cielo-mcp/0.1.1 (MCP server of the cielo-bench research benchmark; non-commercial)`, with no personal data. There are at most 100 requests per server process (`--max-live-requests N`).
|
|
68
|
+
|
|
69
|
+
**Live cache.** Live responses, and the log of each request, are stored outside the repository: in `--cache-dir DIR` if given, else `CIELO_CACHE_DIR`, else `$XDG_CACHE_HOME/cielo-bench`, else `~/.cache/cielo-bench`. The repository's fixtures are never written.
|
|
70
|
+
|
|
71
|
+
Environment variables (optional):
|
|
72
|
+
- `CIELO_USER_AGENT` replaces the User-Agent; keep it free of personal data.
|
|
73
|
+
- `CIELO_CA_BUNDLE` points TLS verification at another CA bundle.
|
|
74
|
+
- `CIELO_CACHE_DIR` sets the live cache (`--cache-dir` wins).
|
|
75
|
+
|
|
76
|
+
The server reads no other variables. For the default live-cache location the core also honours `XDG_CACHE_HOME`.
|
|
77
|
+
|
|
78
|
+
## Claude Desktop
|
|
79
|
+
|
|
80
|
+
Open **Settings → Developer → Edit Config**, or edit the file directly:
|
|
81
|
+
|
|
82
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
83
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
84
|
+
|
|
85
|
+
Add the server, using the absolute path to `cielo-mcp` in the virtual environment where it is installed (`which cielo-mcp` prints it):
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"cielo": {
|
|
91
|
+
"command": "/absolute/path/to/.venv/bin/cielo-mcp",
|
|
92
|
+
"args": ["--live"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
On Windows the command is `C:\\absolute\\path\\to\\.venv\\Scripts\\cielo-mcp.exe`. Restart Claude Desktop. Then ask, for example, *"Where will Saturn be from Medellín at 9 pm on 12 December 2026?"*, or use the `check_claim` prompt with a claim to check. Remove `"--live"` to run cache-only. On macOS the server's stderr is in `~/Library/Logs/Claude/mcp-server-cielo.log`.
|
|
99
|
+
|
|
100
|
+
## MCP Inspector
|
|
101
|
+
|
|
102
|
+
[MCP Inspector](https://github.com/modelcontextprotocol/inspector) v2 needs Node.js (`^22.23.4`, `^24.22.1` or `>=26.12.1`). The commands below use its v2 syntax.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Web UI over stdio: list the tools, read cielo://about, call a tool
|
|
106
|
+
npx @modelcontextprotocol/inspector@2 /absolute/path/to/.venv/bin/cielo-mcp
|
|
107
|
+
|
|
108
|
+
# CLI: list the tools, then call one (cached, so it works offline)
|
|
109
|
+
npx @modelcontextprotocol/inspector@2 --cli /absolute/path/to/.venv/bin/cielo-mcp \
|
|
110
|
+
--method tools/list
|
|
111
|
+
npx @modelcontextprotocol/inspector@2 --cli /absolute/path/to/.venv/bin/cielo-mcp \
|
|
112
|
+
--method tools/call --tool-name body_position \
|
|
113
|
+
--tool-args-json '{"body": "Saturn", "location": {"city": "Medellín"}, "datetime": "2026-12-12T21:00:00-05:00"}'
|
|
114
|
+
|
|
115
|
+
# Streamable HTTP: start the server, then point the Inspector at it
|
|
116
|
+
cielo-mcp --transport streamable-http --port 8000
|
|
117
|
+
npx @modelcontextprotocol/inspector@2 --server-url http://127.0.0.1:8000/mcp --transport http
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The Inspector CLI exits with code 5 when a result has `isError: true`, for example a `source_unavailable` result.
|
|
121
|
+
|
|
122
|
+
## Example calls
|
|
123
|
+
|
|
124
|
+
Real results from the cached fixtures. `structuredContent` holds the object, and the text block holds the same JSON.
|
|
125
|
+
|
|
126
|
+
**`body_position`** with `{"body": "Saturn", "location": {"city": "Medellín"}, "datetime": "2026-12-12T21:00:00-05:00"}` returns `isError: false` (abbreviated):
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"status": "ok",
|
|
131
|
+
"body": "Saturn",
|
|
132
|
+
"datetime_local": "2026-12-12T21:00:00-05:00",
|
|
133
|
+
"altitude_deg": 61.63,
|
|
134
|
+
"azimuth_deg": 260.07,
|
|
135
|
+
"altitude_rate_deg_per_hour": -14.72,
|
|
136
|
+
"above_horizon": true,
|
|
137
|
+
"sources": [{
|
|
138
|
+
"service": "NASA/JPL Horizons API",
|
|
139
|
+
"endpoint": "https://ssd.jpl.nasa.gov/api/horizons.api",
|
|
140
|
+
"query": {"COMMAND": "'699'", "SITE_COORD": "'-75.5748,6.2447,1.495'", "STEP_SIZE": "'1 m'", "…": "…"},
|
|
141
|
+
"retrieved_at_utc": "2026-11-19T03:20:08Z",
|
|
142
|
+
"response_sha256": "85fff3ecce8c39e32c1f09ffc10b647e58c7c41ba5e7aa35028b91887932ce79"
|
|
143
|
+
}],
|
|
144
|
+
"credit": "NASA/JPL Solar System Dynamics — Horizons (https://ssd.jpl.nasa.gov/horizons/)"
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Saturn is sinking at 14.72° per hour, two hours after it culminated. Adding `"relative_to": "Jupiter"` to a `body_position` call adds `separation_deg`, with one citation per body: from Medellín at 05:00 on 12 December 2026, Venus is 68.74° from Jupiter.
|
|
149
|
+
|
|
150
|
+
**`body_rise_set`** with `{"body": "Saturn", "location": {"city": "Medellín"}, "date": "2026-12-12"}` gives:
|
|
151
|
+
- a rise at `13:07`, at azimuth 89.12° (almost due east);
|
|
152
|
+
- culmination at `19:09`, 84.57° high;
|
|
153
|
+
- a set at `01:14` (the night before), at azimuth 270.88°.
|
|
154
|
+
|
|
155
|
+
Each time comes in local time and UTC, with the same citation.
|
|
156
|
+
|
|
157
|
+
**`moon_phase`** with `{"location": {"city": "Medellín"}, "datetime": "2026-12-26T19:30:00-05:00"}` gives `illuminated_fraction_pct` 86.86, `phase` `waning` and `sun_moon_elongation_deg` 137.4, two days after the full Moon.
|
|
158
|
+
|
|
159
|
+
**A date outside the cache**, in cache-only mode, returns `isError: true` and no values:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{"status": "source_unavailable", "source": "NASA/JPL Horizons API", "reason": "offline_cache_miss",
|
|
163
|
+
"message": "NASA/JPL Horizons API could not provide data (offline_cache_miss). No values are returned."}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Invalid input**, such as `"body": "Pluto"`, returns `isError: true`:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{"status": "invalid_input", "message": "body must be one of ['Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']"}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
From Python, with the SDK's client:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
import anyio
|
|
176
|
+
from mcp import Client, StdioServerParameters
|
|
177
|
+
|
|
178
|
+
async def main() -> None:
|
|
179
|
+
server = StdioServerParameters(command="cielo-mcp")
|
|
180
|
+
async with Client(server) as client:
|
|
181
|
+
result = await client.call_tool("body_position", {
|
|
182
|
+
"body": "Saturn", "location": {"city": "Medellín"}, "datetime": "2026-12-12T21:00:00-05:00"})
|
|
183
|
+
print(result.is_error, result.structured_content["altitude_deg"]) # False 61.63
|
|
184
|
+
|
|
185
|
+
anyio.run(main)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Tests
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
pip install -e "./server[dev]"
|
|
192
|
+
pytest server/tests # or: cd server && pytest
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The suite runs offline (127 tests in about 8 s). A guard fails any test that tries to reach the network, and the live cache is an empty temporary directory. It covers:
|
|
196
|
+
|
|
197
|
+
- the tool listing (schemas, annotations, output schema);
|
|
198
|
+
- `ok` calls compared with the benchmark's executor (same object, byte-identical text), including `moon_phase`, `relative_to`, and a replay of every call in each registered domain's golden set;
|
|
199
|
+
- every input error case and cache misses;
|
|
200
|
+
- every fault profile each domain declares, run end to end through MCP;
|
|
201
|
+
- the command line, including `--cache-dir` and the environment settings it reads;
|
|
202
|
+
- domain discovery, including a registered domain that does not exist yet;
|
|
203
|
+
- name prefixing when two domains share a tool name, and the contract guard;
|
|
204
|
+
- the resource and the prompt.
|
|
205
|
+
|
|
206
|
+
The MCP cases run over both protocol eras: the `initialize` handshake (what Claude Desktop speaks) and 2026-07-28. The real transports are tested too: the server as a stdio subprocess, in both eras, and Streamable HTTP on 127.0.0.1.
|
|
207
|
+
|
|
208
|
+
## Credits
|
|
209
|
+
|
|
210
|
+
Ephemerides: NASA/JPL Solar System Dynamics — Horizons. cielo-bench is an independent project and is not endorsed by NASA or JPL. See [DATA-SOURCES](https://github.com/vvanegasar/cielo-bench/blob/main/docs/DATA-SOURCES.md).
|
|
211
|
+
|
|
212
|
+
MIT license, see [LICENSE](https://github.com/vvanegasar/cielo-bench/blob/main/LICENSE).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""cielo-mcp: the cielo-bench tools as an MCP server.
|
|
2
|
+
|
|
3
|
+
The server holds no domain logic. It loads every domain registered in
|
|
4
|
+
``cielo_bench.domains``, exposes each domain's tools with the domain's own JSON Schema, runs
|
|
5
|
+
them with the domain's executor and returns the executor's result unchanged. See
|
|
6
|
+
docs/adr/0007-python-mcp-server.md.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.1"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""``cielo-mcp``: run the cielo MCP server over stdio (Claude Desktop) or local Streamable HTTP."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from collections.abc import Mapping
|
|
9
|
+
from typing import TYPE_CHECKING
|
|
10
|
+
|
|
11
|
+
from . import __version__
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from .server import ServerConfig
|
|
15
|
+
|
|
16
|
+
LOOPBACK_HOSTS = ("127.0.0.1", "localhost", "::1")
|
|
17
|
+
LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _positive_int(text: str) -> int:
|
|
21
|
+
value = int(text)
|
|
22
|
+
if value < 1:
|
|
23
|
+
raise argparse.ArgumentTypeError("must be at least 1")
|
|
24
|
+
return value
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def parser() -> argparse.ArgumentParser:
|
|
28
|
+
p = argparse.ArgumentParser(
|
|
29
|
+
prog="cielo-mcp",
|
|
30
|
+
description="MCP server for the cielo-bench tools. By default the tools answer only from "
|
|
31
|
+
"the benchmark's cache and nothing leaves the machine.",
|
|
32
|
+
)
|
|
33
|
+
p.add_argument("--live", action="store_true",
|
|
34
|
+
help="let tools query their upstream source (NASA/JPL Horizons): serialized, "
|
|
35
|
+
"cached, generic User-Agent")
|
|
36
|
+
p.add_argument("--max-live-requests", type=_positive_int, default=None, metavar="N",
|
|
37
|
+
help="with --live: cap on upstream requests per server process (default 100)")
|
|
38
|
+
p.add_argument("--cache-dir", metavar="DIR",
|
|
39
|
+
help="live cache: where --live responses are written and read back (default "
|
|
40
|
+
"CIELO_CACHE_DIR, else $XDG_CACHE_HOME/cielo-bench, else ~/.cache/cielo-bench); "
|
|
41
|
+
"the repository's fixtures are never written")
|
|
42
|
+
p.add_argument("--transport", choices=("stdio", "streamable-http"), default="stdio",
|
|
43
|
+
help="stdio for Claude Desktop and other local clients (default); "
|
|
44
|
+
"streamable-http serves http://HOST:PORT/mcp on this machine only")
|
|
45
|
+
p.add_argument("--host", default="127.0.0.1", help="streamable-http only; loopback addresses only")
|
|
46
|
+
p.add_argument("--port", type=int, default=8000, help="streamable-http only (default 8000)")
|
|
47
|
+
p.add_argument("--log-level", choices=LOG_LEVELS, default="WARNING", help="logs go to stderr")
|
|
48
|
+
p.add_argument("--version", action="version", version=f"cielo-mcp {__version__}")
|
|
49
|
+
return p
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def config_from(args: argparse.Namespace, environ: Mapping[str, str]) -> ServerConfig:
|
|
53
|
+
"""Server settings from the command line. From the environment, only three names are read:
|
|
54
|
+
``CIELO_USER_AGENT``, ``CIELO_CA_BUNDLE`` and ``CIELO_CACHE_DIR``. API keys never are."""
|
|
55
|
+
from .server import DEFAULT_MAX_LIVE_REQUESTS, USER_AGENT, ServerConfig
|
|
56
|
+
|
|
57
|
+
return ServerConfig(
|
|
58
|
+
live=args.live,
|
|
59
|
+
max_live_requests=args.max_live_requests or DEFAULT_MAX_LIVE_REQUESTS,
|
|
60
|
+
user_agent=environ.get("CIELO_USER_AGENT") or USER_AGENT,
|
|
61
|
+
ca_bundle=environ.get("CIELO_CA_BUNDLE") or None,
|
|
62
|
+
cache_dir=getattr(args, "cache_dir", None) or environ.get("CIELO_CACHE_DIR") or None,
|
|
63
|
+
log_level=args.log_level,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def main(argv: list[str] | None = None) -> int:
|
|
68
|
+
p = parser()
|
|
69
|
+
args = p.parse_args(argv)
|
|
70
|
+
if args.max_live_requests is not None and not args.live:
|
|
71
|
+
p.error("--max-live-requests only applies with --live")
|
|
72
|
+
if args.transport == "streamable-http" and args.host not in LOOPBACK_HOSTS:
|
|
73
|
+
p.error(f"--host must be a loopback address {LOOPBACK_HOSTS}: the HTTP transport is for "
|
|
74
|
+
"local use only and has no authentication")
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
from .server import build_server
|
|
78
|
+
except ImportError as exc: # the benchmark core is missing or broken (server/README.md)
|
|
79
|
+
print(f"cielo-mcp: {exc}. Install the benchmark core: `pip install cielo-bench`, or "
|
|
80
|
+
"`pip install -e .` from the repository root of a checkout.", file=sys.stderr)
|
|
81
|
+
return 1
|
|
82
|
+
|
|
83
|
+
server = build_server(config_from(args, os.environ))
|
|
84
|
+
try:
|
|
85
|
+
if args.transport == "stdio":
|
|
86
|
+
server.run("stdio")
|
|
87
|
+
else:
|
|
88
|
+
host = f"[{args.host}]" if ":" in args.host else args.host
|
|
89
|
+
print(f"cielo-mcp {__version__}: http://{host}:{args.port}/mcp "
|
|
90
|
+
f"({'live' if args.live else 'cache only'})", file=sys.stderr)
|
|
91
|
+
server.run("streamable-http", host=args.host, port=args.port)
|
|
92
|
+
except KeyboardInterrupt: # Ctrl-C on a server started by hand
|
|
93
|
+
return 130
|
|
94
|
+
return 0
|