cielo-mcp 0.1.1__py3-none-any.whl
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/__init__.py +9 -0
- cielo_mcp/__main__.py +3 -0
- cielo_mcp/cli.py +94 -0
- cielo_mcp/contract.py +92 -0
- cielo_mcp/domains.py +65 -0
- cielo_mcp/server.py +272 -0
- cielo_mcp-0.1.1.dist-info/METADATA +246 -0
- cielo_mcp-0.1.1.dist-info/RECORD +12 -0
- cielo_mcp-0.1.1.dist-info/WHEEL +5 -0
- cielo_mcp-0.1.1.dist-info/entry_points.txt +2 -0
- cielo_mcp-0.1.1.dist-info/licenses/LICENSE +21 -0
- cielo_mcp-0.1.1.dist-info/top_level.txt +1 -0
cielo_mcp/__init__.py
ADDED
|
@@ -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"
|
cielo_mcp/__main__.py
ADDED
cielo_mcp/cli.py
ADDED
|
@@ -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
|
cielo_mcp/contract.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""The tool-result contract shared by every cielo-bench domain, and its MCP form.
|
|
2
|
+
|
|
3
|
+
A domain executor returns a JSON object whose ``status`` is ``ok``, ``invalid_input``,
|
|
4
|
+
``source_unavailable`` or ``out_of_scope`` (``cielo_bench.domain``). Over MCP that object is
|
|
5
|
+
sent unchanged:
|
|
6
|
+
|
|
7
|
+
* ``structuredContent`` is the object itself;
|
|
8
|
+
* the text block is ``json.dumps(result, ensure_ascii=False)``, the same text the benchmark
|
|
9
|
+
hands to models (``cielo_bench.providers``);
|
|
10
|
+
* ``isError`` is true for every status except ``ok``.
|
|
11
|
+
|
|
12
|
+
Before a result leaves the server, the two rules that matter most are checked, and the server
|
|
13
|
+
fails closed if a domain breaks either one: an ``ok`` result cites its sources (service, query
|
|
14
|
+
and retrieval time), and any other result carries no values.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
from mcp_types import CallToolResult, TextContent
|
|
23
|
+
|
|
24
|
+
from cielo_bench.domain import TOOL_STATUSES
|
|
25
|
+
|
|
26
|
+
# What a non-ok result may contain (docs/TOOLS.md): no values, ever.
|
|
27
|
+
FAILURE_KEYS = frozenset({"status", "source", "reason", "message"})
|
|
28
|
+
# What every citation in an ok result must name.
|
|
29
|
+
CITATION_KEYS = ("service", "query", "retrieved_at_utc")
|
|
30
|
+
|
|
31
|
+
# Advertised as each tool's outputSchema. It describes the contract, not a domain's fields,
|
|
32
|
+
# so it holds for every domain; clients validate ok results against it.
|
|
33
|
+
RESULT_SCHEMA: dict[str, Any] = {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"description": (
|
|
36
|
+
"cielo-bench tool result. status 'ok' carries the values and sources[]; any other "
|
|
37
|
+
"status carries no values, only a message (plus source and reason when a source failed)."
|
|
38
|
+
),
|
|
39
|
+
"properties": {
|
|
40
|
+
"status": {"type": "string", "enum": list(TOOL_STATUSES)},
|
|
41
|
+
"sources": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"minItems": 1,
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"service": {"type": "string"},
|
|
48
|
+
"query": {"description": "The query sent to the source, as the source received it."},
|
|
49
|
+
"retrieved_at_utc": {"type": "string"},
|
|
50
|
+
},
|
|
51
|
+
"required": list(CITATION_KEYS),
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
"required": ["status"],
|
|
56
|
+
"if": {"properties": {"status": {"const": "ok"}}},
|
|
57
|
+
"then": {"required": ["sources"]},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ContractViolation(RuntimeError):
|
|
62
|
+
"""A domain returned a result that breaks the shared contract. It is never sent."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def check_result(result: Any) -> dict[str, Any]:
|
|
66
|
+
"""Return the result if it honours the contract; raise ``ContractViolation`` otherwise."""
|
|
67
|
+
if not isinstance(result, dict):
|
|
68
|
+
raise ContractViolation(f"a tool result must be a JSON object, got {type(result).__name__}")
|
|
69
|
+
status = result.get("status")
|
|
70
|
+
if status not in TOOL_STATUSES:
|
|
71
|
+
raise ContractViolation(f"unknown status {status!r}")
|
|
72
|
+
if status == "ok":
|
|
73
|
+
sources = result.get("sources")
|
|
74
|
+
cited = isinstance(sources, list) and bool(sources) and all(
|
|
75
|
+
isinstance(source, dict) and all(source.get(key) for key in CITATION_KEYS)
|
|
76
|
+
for source in sources
|
|
77
|
+
)
|
|
78
|
+
if not cited:
|
|
79
|
+
raise ContractViolation("an ok result must cite its sources: service, query, retrieved_at_utc")
|
|
80
|
+
elif extra := sorted(set(result) - FAILURE_KEYS):
|
|
81
|
+
raise ContractViolation(f"a {status} result must carry no values, found {extra}")
|
|
82
|
+
return result
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def to_call_tool_result(result: Any) -> CallToolResult:
|
|
86
|
+
"""The MCP form of a domain result: unchanged, with ``isError`` for every non-ok status."""
|
|
87
|
+
checked = check_result(result)
|
|
88
|
+
return CallToolResult(
|
|
89
|
+
content=[TextContent(type="text", text=json.dumps(checked, ensure_ascii=False))],
|
|
90
|
+
structured_content=checked,
|
|
91
|
+
is_error=checked["status"] != "ok",
|
|
92
|
+
)
|
cielo_mcp/domains.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Find the benchmark's domains and give each of their tools an MCP name.
|
|
2
|
+
|
|
3
|
+
The server has no domain knowledge of its own. Every domain registered in
|
|
4
|
+
``cielo_bench.domains.REGISTRY`` is loaded with the core's own loader, and a domain's tools are
|
|
5
|
+
exactly its ``tool_specs()``. A registered domain that cannot be loaded (for example one that is
|
|
6
|
+
still being built) is skipped with a warning, so the other domains are still served.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import logging
|
|
12
|
+
from collections import Counter
|
|
13
|
+
from collections.abc import Mapping, Sequence
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from cielo_bench import domains as registry
|
|
18
|
+
from cielo_bench.domain import Domain
|
|
19
|
+
|
|
20
|
+
log = logging.getLogger(__name__)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def skip_reason(exc: BaseException) -> str:
|
|
24
|
+
"""Short reason shown to clients; the full error goes to the server log (stderr)."""
|
|
25
|
+
return f"could not be loaded ({type(exc).__name__})"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def load_domains() -> tuple[dict[str, Domain], dict[str, str]]:
|
|
29
|
+
"""Every registered domain that loads, and why each of the others was skipped."""
|
|
30
|
+
loaded: dict[str, Domain] = {}
|
|
31
|
+
skipped: dict[str, str] = {}
|
|
32
|
+
for name in registry.REGISTRY:
|
|
33
|
+
try:
|
|
34
|
+
loaded[name] = registry.get_domain(name)
|
|
35
|
+
except Exception as exc: # one domain that does not load must not take the others down
|
|
36
|
+
log.warning("domain %r is registered but could not be loaded, skipping it: %r", name, exc)
|
|
37
|
+
skipped[name] = skip_reason(exc)
|
|
38
|
+
return loaded, skipped
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class ToolBinding:
|
|
43
|
+
"""One MCP tool: the name clients see, and the domain tool it runs."""
|
|
44
|
+
|
|
45
|
+
name: str # the domain's own tool name, or "<domain>_<tool>" when two domains share it
|
|
46
|
+
domain: str
|
|
47
|
+
tool: str # the name the domain's executor expects
|
|
48
|
+
spec: Mapping[str, Any]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def bind_tools(specs: Mapping[str, Sequence[Mapping[str, Any]]]) -> list[ToolBinding]:
|
|
52
|
+
"""Name every tool. A name used by more than one domain gets the domain as a prefix."""
|
|
53
|
+
uses = Counter(spec["name"] for domain_specs in specs.values() for spec in domain_specs)
|
|
54
|
+
bindings = [
|
|
55
|
+
ToolBinding(
|
|
56
|
+
name=f"{domain}_{spec['name']}" if uses[spec["name"]] > 1 else spec["name"],
|
|
57
|
+
domain=domain, tool=spec["name"], spec=spec,
|
|
58
|
+
)
|
|
59
|
+
for domain, domain_specs in specs.items()
|
|
60
|
+
for spec in domain_specs
|
|
61
|
+
]
|
|
62
|
+
clashes = sorted(name for name, n in Counter(b.name for b in bindings).items() if n > 1)
|
|
63
|
+
if clashes:
|
|
64
|
+
raise ValueError(f"tool names collide even with the domain prefix: {clashes}")
|
|
65
|
+
return bindings
|
cielo_mcp/server.py
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"""Build the cielo MCP server from the benchmark's domains.
|
|
2
|
+
|
|
3
|
+
Each tool is registered from its domain's provider-neutral spec (name, description, JSON Schema)
|
|
4
|
+
and runs through the domain's own executor, so nothing about a domain is restated here and the
|
|
5
|
+
server cannot drift from what the benchmark measures.
|
|
6
|
+
|
|
7
|
+
The SDK's ``MCPServer`` (the 2.x name of FastMCP) normally derives a tool's schema from a Python
|
|
8
|
+
signature. Here the schema already exists, so each tool is a ``Tool`` built directly from the
|
|
9
|
+
spec, with argument metadata that hands the client's arguments to the executor as received.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import copy
|
|
15
|
+
import logging
|
|
16
|
+
from collections.abc import Callable, Mapping
|
|
17
|
+
from dataclasses import dataclass
|
|
18
|
+
from typing import Annotated, Any, Literal
|
|
19
|
+
|
|
20
|
+
from mcp.server import MCPServer
|
|
21
|
+
from mcp.server.mcpserver.resources import TextResource
|
|
22
|
+
from mcp.server.mcpserver.tools import Tool
|
|
23
|
+
from mcp.server.mcpserver.utilities.func_metadata import ArgModelBase, FuncMetadata
|
|
24
|
+
from mcp.shared.tool_name_validation import validate_and_warn_tool_name
|
|
25
|
+
from mcp_types import CallToolResult, ToolAnnotations
|
|
26
|
+
from pydantic import Field
|
|
27
|
+
|
|
28
|
+
from cielo_bench.domain import Domain, ToolExecutor
|
|
29
|
+
|
|
30
|
+
from . import __version__
|
|
31
|
+
from .contract import RESULT_SCHEMA, to_call_tool_result
|
|
32
|
+
from .domains import ToolBinding, bind_tools, load_domains, skip_reason
|
|
33
|
+
|
|
34
|
+
log = logging.getLogger(__name__)
|
|
35
|
+
|
|
36
|
+
SERVER_NAME = "cielo"
|
|
37
|
+
ABOUT_URI = "cielo://about"
|
|
38
|
+
# Honest and generic (JPL fair-use policy, ADR-0005 §8): software name, version and purpose,
|
|
39
|
+
# no personal data. The repository URL can be added once the repository is public.
|
|
40
|
+
USER_AGENT = f"cielo-mcp/{__version__} (MCP server of the cielo-bench research benchmark; non-commercial)"
|
|
41
|
+
DEFAULT_MAX_LIVE_REQUESTS = 100
|
|
42
|
+
|
|
43
|
+
LogLevel = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
|
|
44
|
+
ExecutorFactory = Callable[[Domain], ToolExecutor]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class ServerConfig:
|
|
49
|
+
"""How the server may reach upstream sources. The default never leaves the machine."""
|
|
50
|
+
|
|
51
|
+
live: bool = False # False: answer only from what is already cached
|
|
52
|
+
max_live_requests: int = DEFAULT_MAX_LIVE_REQUESTS # per server process, live mode only
|
|
53
|
+
user_agent: str = USER_AGENT
|
|
54
|
+
ca_bundle: str | None = None # PEM bundle for TLS verification (default: certifi's)
|
|
55
|
+
# Live cache, outside the repository. None: the core's default (CIELO_CACHE_DIR, else
|
|
56
|
+
# $XDG_CACHE_HOME/cielo-bench, else ~/.cache/cielo-bench). The fixtures are never written.
|
|
57
|
+
cache_dir: str | None = None
|
|
58
|
+
log_level: LogLevel = "WARNING"
|
|
59
|
+
|
|
60
|
+
def settings(self) -> dict[str, str]:
|
|
61
|
+
"""The only settings a domain executor receives. API keys are never passed on."""
|
|
62
|
+
settings = {"CIELO_USER_AGENT": self.user_agent}
|
|
63
|
+
if self.ca_bundle:
|
|
64
|
+
settings["CIELO_CA_BUNDLE"] = self.ca_bundle
|
|
65
|
+
if self.cache_dir:
|
|
66
|
+
settings["CIELO_CACHE_DIR"] = self.cache_dir
|
|
67
|
+
return settings
|
|
68
|
+
|
|
69
|
+
def make_executor(self, domain: Domain) -> ToolExecutor:
|
|
70
|
+
return domain.make_executor(
|
|
71
|
+
fault_profile=None, # the server never injects faults
|
|
72
|
+
offline=not self.live,
|
|
73
|
+
max_live_requests=self.max_live_requests if self.live else 0,
|
|
74
|
+
settings=self.settings(),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@dataclass(frozen=True)
|
|
79
|
+
class _Served:
|
|
80
|
+
domain: Domain
|
|
81
|
+
specs: list[dict[str, Any]]
|
|
82
|
+
executor: ToolExecutor
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class _CallArguments(ArgModelBase):
|
|
86
|
+
arguments: dict[str, Any]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class _AsReceived(FuncMetadata):
|
|
90
|
+
"""Hands a call's arguments to the tool function exactly as the client sent them.
|
|
91
|
+
|
|
92
|
+
The domain executor validates them and answers ``invalid_input`` in the shared contract,
|
|
93
|
+
as it does in the benchmark; the server adds no validation rules of its own.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
def validate_arguments(self, arguments_to_validate: dict[str, Any]) -> dict[str, Any]:
|
|
97
|
+
return {"arguments": dict(arguments_to_validate)}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def make_tool(binding: ToolBinding, executor: ToolExecutor, *, open_world: bool) -> Tool:
|
|
101
|
+
"""An MCP tool for one domain tool: the domain's own schema, run by the domain's executor."""
|
|
102
|
+
validate_and_warn_tool_name(binding.name)
|
|
103
|
+
title = binding.spec.get("title") # only if the domain gives one; clients then show the name
|
|
104
|
+
|
|
105
|
+
def run(arguments: dict[str, Any]) -> CallToolResult:
|
|
106
|
+
return to_call_tool_result(executor.execute(binding.tool, arguments))
|
|
107
|
+
|
|
108
|
+
return Tool(
|
|
109
|
+
fn=run,
|
|
110
|
+
name=binding.name,
|
|
111
|
+
title=title,
|
|
112
|
+
description=str(binding.spec.get("description") or ""),
|
|
113
|
+
parameters=copy.deepcopy(dict(binding.spec["parameters"])),
|
|
114
|
+
fn_metadata=_AsReceived(arg_model=_CallArguments, output_schema=RESULT_SCHEMA),
|
|
115
|
+
is_async=False, # the executor blocks on I/O, so the SDK runs it on a worker thread
|
|
116
|
+
annotations=ToolAnnotations(title=title, read_only_hint=True, open_world_hint=open_world),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def build_server(
|
|
121
|
+
config: ServerConfig | None = None,
|
|
122
|
+
*,
|
|
123
|
+
domains: Mapping[str, Domain] | None = None,
|
|
124
|
+
executor_factory: ExecutorFactory | None = None,
|
|
125
|
+
) -> MCPServer:
|
|
126
|
+
"""The cielo MCP server, serving every domain that can be set up.
|
|
127
|
+
|
|
128
|
+
``domains`` defaults to every domain in the benchmark's registry. ``executor_factory``
|
|
129
|
+
replaces how executors are made; the tests use it to put a source down end to end, which
|
|
130
|
+
the server itself never does.
|
|
131
|
+
"""
|
|
132
|
+
config = config or ServerConfig()
|
|
133
|
+
skipped: dict[str, str] = {}
|
|
134
|
+
if domains is None:
|
|
135
|
+
domains, skipped = load_domains()
|
|
136
|
+
make_executor = executor_factory or config.make_executor
|
|
137
|
+
served: dict[str, _Served] = {}
|
|
138
|
+
for name, domain in domains.items():
|
|
139
|
+
try:
|
|
140
|
+
served[name] = _Served(domain, list(domain.tool_specs()), make_executor(domain))
|
|
141
|
+
except Exception as exc: # same isolation as loading: skip this domain, serve the rest
|
|
142
|
+
log.warning("domain %r could not be set up, skipping it: %r", name, exc)
|
|
143
|
+
skipped[name] = skip_reason(exc)
|
|
144
|
+
if not served:
|
|
145
|
+
raise RuntimeError(f"no cielo-bench domain could be served; skipped: {skipped or 'none registered'}")
|
|
146
|
+
|
|
147
|
+
bindings = bind_tools({name: s.specs for name, s in served.items()})
|
|
148
|
+
server = MCPServer(
|
|
149
|
+
SERVER_NAME,
|
|
150
|
+
title="cielo-bench",
|
|
151
|
+
version=__version__,
|
|
152
|
+
instructions=_instructions(config),
|
|
153
|
+
tools=[
|
|
154
|
+
make_tool(
|
|
155
|
+
b,
|
|
156
|
+
served[b.domain].executor,
|
|
157
|
+
# open world only when live AND the domain has a source outside the machine
|
|
158
|
+
open_world=config.live and getattr(served[b.domain].domain, "external_source", True),
|
|
159
|
+
)
|
|
160
|
+
for b in bindings
|
|
161
|
+
],
|
|
162
|
+
log_level=config.log_level,
|
|
163
|
+
)
|
|
164
|
+
server.add_resource(TextResource(
|
|
165
|
+
uri=ABOUT_URI,
|
|
166
|
+
name="about",
|
|
167
|
+
title="About cielo: tools, method and credits",
|
|
168
|
+
description=(
|
|
169
|
+
"What this server serves, how its results are shaped, how the benchmark uses them, and the data credits."
|
|
170
|
+
),
|
|
171
|
+
mime_type="text/markdown",
|
|
172
|
+
text=about_text(config, served, bindings, skipped),
|
|
173
|
+
))
|
|
174
|
+
_add_prompts(server)
|
|
175
|
+
return server
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _mode(config: ServerConfig) -> str:
|
|
179
|
+
if config.live:
|
|
180
|
+
return (f"Live: a tool may query its upstream source, one request at a time, at most "
|
|
181
|
+
f"{config.max_live_requests} per server process. Every response is cached in a "
|
|
182
|
+
"live cache outside the repository.")
|
|
183
|
+
return ("Cache only (the default): tools answer only from data already cached (the benchmark's "
|
|
184
|
+
"fixtures and any earlier live lookups), and the server never contacts an upstream "
|
|
185
|
+
"source. Anything outside the cache returns status source_unavailable.")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _instructions(config: ServerConfig) -> str:
|
|
189
|
+
# Factual on purpose: whether a model checks a claim on its own is what the benchmark
|
|
190
|
+
# measures, so the server describes its tools and never tells the model to verify.
|
|
191
|
+
return (
|
|
192
|
+
"Tools from the cielo-bench benchmark, each backed by an external source of truth (for "
|
|
193
|
+
"example NASA/JPL Horizons ephemerides). Every result is a JSON object with a status: ok, "
|
|
194
|
+
"invalid_input, source_unavailable or out_of_scope. An ok result cites its sources "
|
|
195
|
+
"(service, query and retrieval time in UTC); any other status carries no values. "
|
|
196
|
+
f"{_mode(config)} The resource {ABOUT_URI} lists the domains, the method and the data credits."
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def about_text(config: ServerConfig, served: Mapping[str, _Served], bindings: list[ToolBinding],
|
|
201
|
+
skipped: Mapping[str, str]) -> str:
|
|
202
|
+
lines = [
|
|
203
|
+
"# cielo: the cielo-bench tools over MCP",
|
|
204
|
+
"",
|
|
205
|
+
"cielo-bench measures whether a tool-using AI agent checks a user's claim with its tools or "
|
|
206
|
+
"simply agrees, judged against an external ground truth rather than by another model. This "
|
|
207
|
+
"server exposes the benchmark's own tools unchanged: the same input schemas, the same "
|
|
208
|
+
"executors and the same results the benchmark scores.",
|
|
209
|
+
"",
|
|
210
|
+
"## Mode",
|
|
211
|
+
"",
|
|
212
|
+
_mode(config),
|
|
213
|
+
"",
|
|
214
|
+
"## Domains and tools",
|
|
215
|
+
]
|
|
216
|
+
for name, s in served.items():
|
|
217
|
+
lines += ["", f"### {name}: {s.domain.title}" if s.domain.title else f"### {name}", ""]
|
|
218
|
+
lines += [f"- `{b.name}`" + (f" (the domain's `{b.tool}`)" if b.name != b.tool else "")
|
|
219
|
+
for b in bindings if b.domain == name]
|
|
220
|
+
lines += [f"\nCredit: {credit}" for credit in s.domain.credits]
|
|
221
|
+
if skipped:
|
|
222
|
+
lines += ["", "## Registered but not served", ""]
|
|
223
|
+
lines += [f"- `{name}`: {why}" for name, why in skipped.items()]
|
|
224
|
+
lines += [
|
|
225
|
+
"",
|
|
226
|
+
"## Result contract",
|
|
227
|
+
"",
|
|
228
|
+
"- Every result is a JSON object with `status`: `ok`, `invalid_input`, `source_unavailable` or `out_of_scope`.",
|
|
229
|
+
"- An `ok` result cites its sources in `sources[]`: `service`, `query` and `retrieved_at_utc` (UTC), "
|
|
230
|
+
"plus the endpoint and a hash of the response when the source has them.",
|
|
231
|
+
"- Any other status carries no values: only a `message`, plus the `source` and the `reason` when "
|
|
232
|
+
"a source failed. MCP `isError` is set.",
|
|
233
|
+
"- `structuredContent` is the result object, and the text block is the same object as JSON.",
|
|
234
|
+
"",
|
|
235
|
+
"## Method",
|
|
236
|
+
"",
|
|
237
|
+
"Each benchmark item is a pair of questions that differ only in whether the user's premise is true "
|
|
238
|
+
"or false, asked with more or less social pressure. Models answer without these tools, with them, "
|
|
239
|
+
"and with the source made unavailable. The headline metric, agree-after-check, is how often a "
|
|
240
|
+
"model still agrees with a false premise after a tool has returned contrary evidence. Ground "
|
|
241
|
+
"truth comes from the source, cached and hashed, and scoring is deterministic. Details: "
|
|
242
|
+
"docs/EVALS.md in the repository.",
|
|
243
|
+
"",
|
|
244
|
+
"## Upstream use",
|
|
245
|
+
"",
|
|
246
|
+
"Live requests are made one at a time per server process, cached by query, and identify the "
|
|
247
|
+
f"client as `{config.user_agent}`, with no personal data.",
|
|
248
|
+
"",
|
|
249
|
+
"cielo-bench is an independent research project, not endorsed by the providers of its data.",
|
|
250
|
+
]
|
|
251
|
+
return "\n".join(lines) + "\n"
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def _add_prompts(server: MCPServer) -> None:
|
|
255
|
+
@server.prompt(
|
|
256
|
+
name="check_claim",
|
|
257
|
+
title="Check a claim",
|
|
258
|
+
description=(
|
|
259
|
+
"Ask the assistant to check a claim with the cielo tools before answering, and to cite the sources."
|
|
260
|
+
),
|
|
261
|
+
)
|
|
262
|
+
def check_claim(
|
|
263
|
+
claim: Annotated[str, Field(description="The claim to check, for example "
|
|
264
|
+
"'Saturn sets after midnight in Medellín on 12 December 2026'.")],
|
|
265
|
+
) -> str:
|
|
266
|
+
return (
|
|
267
|
+
f"Check this claim with the cielo tools before answering:\n\n{claim}\n\n"
|
|
268
|
+
"Call the tool or tools that can settle it instead of answering from memory. Then say "
|
|
269
|
+
"whether the claim is true, false or could not be checked, give the values the tools "
|
|
270
|
+
"returned, and cite each source (service, query and retrieval time). If a tool returns "
|
|
271
|
+
"status source_unavailable, say that the claim could not be checked and give no number."
|
|
272
|
+
)
|
|
@@ -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,12 @@
|
|
|
1
|
+
cielo_mcp/__init__.py,sha256=owHHi6XmR6A8FrWGWvo5YekWoo3y-plNtCfTffzxYww,362
|
|
2
|
+
cielo_mcp/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
|
|
3
|
+
cielo_mcp/cli.py,sha256=c_-5se3NuGPi2xNlKlepwxa7DmaWoelxw_9kxzOR3i8,4366
|
|
4
|
+
cielo_mcp/contract.py,sha256=J6f0I3TS18ns5vbABk24gczvzny8Gj8eX69CysJahUw,3813
|
|
5
|
+
cielo_mcp/domains.py,sha256=YIHnsaSP6eaWp13rZQhBrlqNq9MC4n9R9ZDR825ujBs,2606
|
|
6
|
+
cielo_mcp/server.py,sha256=Qce-v6omyl7Uo_fy8xIBWtJPC0ADh5lH7BDO0arB4p8,12333
|
|
7
|
+
cielo_mcp-0.1.1.dist-info/licenses/LICENSE,sha256=Xnr7Rhd2tJPn-8-2pzVCiAXX1wNE-ZXswEQmzvILGjE,1087
|
|
8
|
+
cielo_mcp-0.1.1.dist-info/METADATA,sha256=JN6GOdE5YZVe1DveqzAlifL7yu4FG1C-qsL7xFIYZDM,13761
|
|
9
|
+
cielo_mcp-0.1.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
10
|
+
cielo_mcp-0.1.1.dist-info/entry_points.txt,sha256=besVwfHe4LxSd_1NM7rNV0ABLwWP4Bqfdg4c8Dr9CpQ,49
|
|
11
|
+
cielo_mcp-0.1.1.dist-info/top_level.txt,sha256=mt6XZDRYQgQ-I29siBywHnzUkFMWUjpF3QDF1CFT52I,10
|
|
12
|
+
cielo_mcp-0.1.1.dist-info/RECORD,,
|
|
@@ -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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cielo_mcp
|