aetherx-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aether-X
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,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: aetherx-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for the Aether-X Port Congestion Oracle API
5
+ Author: Aether-X
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://aether-x-oracle-production.up.railway.app
8
+ Project-URL: Repository, https://github.com/belegante-byte/aetherx-oracle
9
+ Project-URL: Documentation, https://aether-x-oracle-production.up.railway.app/docs
10
+ Project-URL: Terms, https://aether-x-oracle-production.up.railway.app/terms
11
+ Keywords: mcp,model-context-protocol,port,congestion,shipping,logistics,quant,agents,llm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: mcp<3,>=2.0.0
25
+ Requires-Dist: httpx>=0.24.0
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest>=7.0; extra == "test"
28
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
29
+ Dynamic: license-file
30
+
31
+ # aetherx-mcp
32
+
33
+ **MCP server for the [Aether-X Port Congestion Oracle](https://aether-x-oracle-production.up.railway.app)** — gives any MCP-compatible agent (Claude Desktop, Cursor, VS Code, custom LLM agents) predictive port congestion signals for global trade and quantitative finance.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install aetherx-mcp
39
+ # or run without installing (recommended for MCP clients):
40
+ uvx aetherx-mcp
41
+ ```
42
+
43
+ ## Configure your MCP client
44
+
45
+ ### Claude Desktop (`claude_desktop_config.json`)
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "aetherx-oracle": {
51
+ "command": "uvx",
52
+ "args": ["aetherx-mcp"],
53
+ "env": { "RAPIDAPI_KEY": "SUA_RAPIDAPI_KEY" }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Cursor (`~/.cursor/mcp.json`)
60
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "aetherx-oracle": {
65
+ "command": "uvx",
66
+ "args": ["aetherx-mcp"],
67
+ "env": { "RAPIDAPI_KEY": "SUA_RAPIDAPI_KEY" }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Tools
74
+
75
+ | Tool | Arguments | Returns |
76
+ |------|-----------|---------|
77
+ | `get_port_risk` | `port_id` (UN/LOCODE) | Congestion score, ETA delay, waiting vessels, freight volatility |
78
+ | `get_ports_risk` | `port_ids` (list) | Same, for a whole portfolio, fetched in parallel |
79
+ | `list_supported_ports` | — | The 15 pre-seeded ports (id, name, country) |
80
+
81
+ Every response is a typed payload:
82
+
83
+ ```json
84
+ {
85
+ "port_id": "BRSSZ",
86
+ "port_name": "Santos",
87
+ "country": "Brasil",
88
+ "congestion_score": 0.78,
89
+ "eta_delay_days": 1.6,
90
+ "waiting_vessels": 12,
91
+ "freight_volatility_index": 0.42,
92
+ "updated_at": "2026-09-17 15:46:53"
93
+ }
94
+ ```
95
+
96
+ ## Configuration
97
+
98
+ | Variable | Default | Description |
99
+ |----------|---------|-------------|
100
+ | `RAPIDAPI_KEY` | — | When set, requests are routed through the RapidAPI gateway (metered billing) |
101
+ | `RAPIDAPI_HOST` | `aether-x-port-congestion-oracle.p.rapidapi.com` | RapidAPI host |
102
+ | `AETHERX_BASE_URL` | `https://aether-x-oracle-production.up.railway.app` | Direct API base URL |
103
+
104
+ Without `RAPIDAPI_KEY`, the server calls the public production API directly.
105
+
106
+ ## Example agent prompts
107
+
108
+ - *"What's the congestion risk at Santos right now?"*
109
+ - *"Rank these ports by congestion: BRSSZ, CNSHA, NLRTM, USLAX."*
110
+ - *"Which of my Asian ports has the highest freight volatility index?"*
111
+
112
+ ## License
113
+
114
+ MIT — see [LICENSE](LICENSE). The signals are provided "AS IS" and do not constitute investment advice. See the [Terms of Service](https://aether-x-oracle-production.up.railway.app/terms).
@@ -0,0 +1,84 @@
1
+ # aetherx-mcp
2
+
3
+ **MCP server for the [Aether-X Port Congestion Oracle](https://aether-x-oracle-production.up.railway.app)** — gives any MCP-compatible agent (Claude Desktop, Cursor, VS Code, custom LLM agents) predictive port congestion signals for global trade and quantitative finance.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install aetherx-mcp
9
+ # or run without installing (recommended for MCP clients):
10
+ uvx aetherx-mcp
11
+ ```
12
+
13
+ ## Configure your MCP client
14
+
15
+ ### Claude Desktop (`claude_desktop_config.json`)
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "aetherx-oracle": {
21
+ "command": "uvx",
22
+ "args": ["aetherx-mcp"],
23
+ "env": { "RAPIDAPI_KEY": "SUA_RAPIDAPI_KEY" }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ ### Cursor (`~/.cursor/mcp.json`)
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "aetherx-oracle": {
35
+ "command": "uvx",
36
+ "args": ["aetherx-mcp"],
37
+ "env": { "RAPIDAPI_KEY": "SUA_RAPIDAPI_KEY" }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Tools
44
+
45
+ | Tool | Arguments | Returns |
46
+ |------|-----------|---------|
47
+ | `get_port_risk` | `port_id` (UN/LOCODE) | Congestion score, ETA delay, waiting vessels, freight volatility |
48
+ | `get_ports_risk` | `port_ids` (list) | Same, for a whole portfolio, fetched in parallel |
49
+ | `list_supported_ports` | — | The 15 pre-seeded ports (id, name, country) |
50
+
51
+ Every response is a typed payload:
52
+
53
+ ```json
54
+ {
55
+ "port_id": "BRSSZ",
56
+ "port_name": "Santos",
57
+ "country": "Brasil",
58
+ "congestion_score": 0.78,
59
+ "eta_delay_days": 1.6,
60
+ "waiting_vessels": 12,
61
+ "freight_volatility_index": 0.42,
62
+ "updated_at": "2026-09-17 15:46:53"
63
+ }
64
+ ```
65
+
66
+ ## Configuration
67
+
68
+ | Variable | Default | Description |
69
+ |----------|---------|-------------|
70
+ | `RAPIDAPI_KEY` | — | When set, requests are routed through the RapidAPI gateway (metered billing) |
71
+ | `RAPIDAPI_HOST` | `aether-x-port-congestion-oracle.p.rapidapi.com` | RapidAPI host |
72
+ | `AETHERX_BASE_URL` | `https://aether-x-oracle-production.up.railway.app` | Direct API base URL |
73
+
74
+ Without `RAPIDAPI_KEY`, the server calls the public production API directly.
75
+
76
+ ## Example agent prompts
77
+
78
+ - *"What's the congestion risk at Santos right now?"*
79
+ - *"Rank these ports by congestion: BRSSZ, CNSHA, NLRTM, USLAX."*
80
+ - *"Which of my Asian ports has the highest freight volatility index?"*
81
+
82
+ ## License
83
+
84
+ MIT — see [LICENSE](LICENSE). The signals are provided "AS IS" and do not constitute investment advice. See the [Terms of Service](https://aether-x-oracle-production.up.railway.app/terms).
@@ -0,0 +1,5 @@
1
+ """Aether-X Oracle MCP server package."""
2
+ from aetherx_mcp.server import mcp
3
+
4
+ __all__ = ["mcp"]
5
+ __version__ = "0.1.0"
@@ -0,0 +1,120 @@
1
+ """Aether-X Oracle MCP server.
2
+
3
+ Exposes the Aether-X Port Congestion Oracle to MCP-compatible agents
4
+ (Claude Desktop, Cursor, VS Code, custom LLM agents).
5
+
6
+ Run (stdio):
7
+
8
+ RAPIDAPI_KEY=xxxx aetherx-mcp
9
+
10
+ By default it calls the public production API. When ``RAPIDAPI_KEY`` is set,
11
+ requests are routed through the RapidAPI gateway (metered billing).
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import asyncio
16
+ import os
17
+ from typing import Any
18
+
19
+ import httpx
20
+ from mcp.server.mcpserver import MCPServer
21
+
22
+ PRODUCTION_URL = "https://aether-x-oracle-production.up.railway.app"
23
+ DEFAULT_RAPIDAPI_HOST = "aether-x-port-congestion-oracle.p.rapidapi.com"
24
+
25
+ SUPPORTED_PORTS: list[dict[str, str]] = [
26
+ {"port_id": "AEDXB", "port_name": "Dubai / Jebel Ali", "country": "EAU"},
27
+ {"port_id": "BRRIO", "port_name": "Rio de Janeiro", "country": "Brasil"},
28
+ {"port_id": "BRSSZ", "port_name": "Santos", "country": "Brasil"},
29
+ {"port_id": "CNNGB", "port_name": "Ningbo-Zhoushan", "country": "China"},
30
+ {"port_id": "CNSHA", "port_name": "Shanghai", "country": "China"},
31
+ {"port_id": "DEHAM", "port_name": "Hamburg", "country": "Alemanha"},
32
+ {"port_id": "GBLGP", "port_name": "London Gateway", "country": "Reino Unido"},
33
+ {"port_id": "KRPUS", "port_name": "Busan", "country": "Coreia do Sul"},
34
+ {"port_id": "MPTNG", "port_name": "Tanger Med", "country": "Marrocos"},
35
+ {"port_id": "MXZLO", "port_name": "Manzanillo", "country": "México"},
36
+ {"port_id": "NLRTM", "port_name": "Rotterdam", "country": "Holanda"},
37
+ {"port_id": "SGSIN", "port_name": "Singapore", "country": "Cingapura"},
38
+ {"port_id": "USLAX", "port_name": "Los Angeles", "country": "EUA"},
39
+ {"port_id": "USNYC", "port_name": "New York", "country": "EUA"},
40
+ {"port_id": "ZACPT", "port_name": "Cape Town", "country": "África do Sul"},
41
+ ]
42
+
43
+ mcp = MCPServer(
44
+ "aetherx-oracle",
45
+ title="Aether-X Port Congestion Oracle",
46
+ description=(
47
+ "Predictive port congestion signals for global trade, supply chain and "
48
+ "quantitative finance."
49
+ ),
50
+ instructions=(
51
+ "Predictive port congestion signals for global trade, supply chain and "
52
+ "quantitative finance. Use get_port_risk for a single port and "
53
+ "get_ports_risk to scan a portfolio of ports in parallel."
54
+ ),
55
+ version="0.1.0",
56
+ website_url="https://aether-x-oracle-production.up.railway.app",
57
+ )
58
+
59
+
60
+ def _base_url() -> str:
61
+ return os.getenv("AETHERX_BASE_URL", PRODUCTION_URL).rstrip("/")
62
+
63
+
64
+ def _headers() -> dict[str, str]:
65
+ key = os.getenv("RAPIDAPI_KEY")
66
+ if not key:
67
+ return {}
68
+ return {
69
+ "X-RapidAPI-Key": key,
70
+ "X-RapidAPI-Host": os.getenv("RAPIDAPI_HOST", DEFAULT_RAPIDAPI_HOST),
71
+ }
72
+
73
+
74
+ def _client() -> httpx.AsyncClient:
75
+ return httpx.AsyncClient(timeout=30.0)
76
+
77
+
78
+ async def _fetch(port_id: str) -> dict[str, Any]:
79
+ url = f"{_base_url()}/v1/port-risk"
80
+ async with _client() as client:
81
+ resp = await client.get(
82
+ url, params={"port_id": port_id}, headers=_headers()
83
+ )
84
+ resp.raise_for_status()
85
+ return resp.json()
86
+
87
+
88
+ @mcp.tool()
89
+ async def get_port_risk(port_id: str) -> dict[str, Any]:
90
+ """Return the predictive congestion signal for a single port.
91
+
92
+ Args:
93
+ port_id: UN/LOCODE of the port, e.g. "BRSSZ" (Santos), "CNSHA" (Shanghai).
94
+ """
95
+ return await _fetch(port_id.strip().upper())
96
+
97
+
98
+ @mcp.tool()
99
+ async def get_ports_risk(port_ids: list[str]) -> list[dict[str, Any]]:
100
+ """Return congestion signals for several ports in parallel.
101
+
102
+ Args:
103
+ port_ids: list of UN/LOCODEs, e.g. ["BRSSZ", "CNSHA", "NLRTM"].
104
+ """
105
+ ids = [p.strip().upper() for p in port_ids if p and p.strip()]
106
+ return list(await asyncio.gather(*(_fetch(p) for p in ids)))
107
+
108
+
109
+ @mcp.tool()
110
+ def list_supported_ports() -> list[dict[str, str]]:
111
+ """List the 15 ports pre-seeded in the oracle (id, name, country)."""
112
+ return SUPPORTED_PORTS
113
+
114
+
115
+ def main() -> None:
116
+ mcp.run()
117
+
118
+
119
+ if __name__ == "__main__":
120
+ main()
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: aetherx-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for the Aether-X Port Congestion Oracle API
5
+ Author: Aether-X
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://aether-x-oracle-production.up.railway.app
8
+ Project-URL: Repository, https://github.com/belegante-byte/aetherx-oracle
9
+ Project-URL: Documentation, https://aether-x-oracle-production.up.railway.app/docs
10
+ Project-URL: Terms, https://aether-x-oracle-production.up.railway.app/terms
11
+ Keywords: mcp,model-context-protocol,port,congestion,shipping,logistics,quant,agents,llm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: mcp<3,>=2.0.0
25
+ Requires-Dist: httpx>=0.24.0
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest>=7.0; extra == "test"
28
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
29
+ Dynamic: license-file
30
+
31
+ # aetherx-mcp
32
+
33
+ **MCP server for the [Aether-X Port Congestion Oracle](https://aether-x-oracle-production.up.railway.app)** — gives any MCP-compatible agent (Claude Desktop, Cursor, VS Code, custom LLM agents) predictive port congestion signals for global trade and quantitative finance.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install aetherx-mcp
39
+ # or run without installing (recommended for MCP clients):
40
+ uvx aetherx-mcp
41
+ ```
42
+
43
+ ## Configure your MCP client
44
+
45
+ ### Claude Desktop (`claude_desktop_config.json`)
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "aetherx-oracle": {
51
+ "command": "uvx",
52
+ "args": ["aetherx-mcp"],
53
+ "env": { "RAPIDAPI_KEY": "SUA_RAPIDAPI_KEY" }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Cursor (`~/.cursor/mcp.json`)
60
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "aetherx-oracle": {
65
+ "command": "uvx",
66
+ "args": ["aetherx-mcp"],
67
+ "env": { "RAPIDAPI_KEY": "SUA_RAPIDAPI_KEY" }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Tools
74
+
75
+ | Tool | Arguments | Returns |
76
+ |------|-----------|---------|
77
+ | `get_port_risk` | `port_id` (UN/LOCODE) | Congestion score, ETA delay, waiting vessels, freight volatility |
78
+ | `get_ports_risk` | `port_ids` (list) | Same, for a whole portfolio, fetched in parallel |
79
+ | `list_supported_ports` | — | The 15 pre-seeded ports (id, name, country) |
80
+
81
+ Every response is a typed payload:
82
+
83
+ ```json
84
+ {
85
+ "port_id": "BRSSZ",
86
+ "port_name": "Santos",
87
+ "country": "Brasil",
88
+ "congestion_score": 0.78,
89
+ "eta_delay_days": 1.6,
90
+ "waiting_vessels": 12,
91
+ "freight_volatility_index": 0.42,
92
+ "updated_at": "2026-09-17 15:46:53"
93
+ }
94
+ ```
95
+
96
+ ## Configuration
97
+
98
+ | Variable | Default | Description |
99
+ |----------|---------|-------------|
100
+ | `RAPIDAPI_KEY` | — | When set, requests are routed through the RapidAPI gateway (metered billing) |
101
+ | `RAPIDAPI_HOST` | `aether-x-port-congestion-oracle.p.rapidapi.com` | RapidAPI host |
102
+ | `AETHERX_BASE_URL` | `https://aether-x-oracle-production.up.railway.app` | Direct API base URL |
103
+
104
+ Without `RAPIDAPI_KEY`, the server calls the public production API directly.
105
+
106
+ ## Example agent prompts
107
+
108
+ - *"What's the congestion risk at Santos right now?"*
109
+ - *"Rank these ports by congestion: BRSSZ, CNSHA, NLRTM, USLAX."*
110
+ - *"Which of my Asian ports has the highest freight volatility index?"*
111
+
112
+ ## License
113
+
114
+ MIT — see [LICENSE](LICENSE). The signals are provided "AS IS" and do not constitute investment advice. See the [Terms of Service](https://aether-x-oracle-production.up.railway.app/terms).
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ aetherx_mcp/__init__.py
5
+ aetherx_mcp/server.py
6
+ aetherx_mcp.egg-info/PKG-INFO
7
+ aetherx_mcp.egg-info/SOURCES.txt
8
+ aetherx_mcp.egg-info/dependency_links.txt
9
+ aetherx_mcp.egg-info/entry_points.txt
10
+ aetherx_mcp.egg-info/requires.txt
11
+ aetherx_mcp.egg-info/top_level.txt
12
+ tests/test_server.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aetherx-mcp = aetherx_mcp.server:main
@@ -0,0 +1,6 @@
1
+ mcp<3,>=2.0.0
2
+ httpx>=0.24.0
3
+
4
+ [test]
5
+ pytest>=7.0
6
+ pytest-asyncio>=0.23
@@ -0,0 +1 @@
1
+ aetherx_mcp
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aetherx-mcp"
7
+ version = "0.1.0"
8
+ description = "MCP server for the Aether-X Port Congestion Oracle API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Aether-X" }]
14
+ keywords = [
15
+ "mcp",
16
+ "model-context-protocol",
17
+ "port",
18
+ "congestion",
19
+ "shipping",
20
+ "logistics",
21
+ "quant",
22
+ "agents",
23
+ "llm",
24
+ ]
25
+ dependencies = [
26
+ "mcp>=2.0.0,<3",
27
+ "httpx>=0.24.0",
28
+ ]
29
+ classifiers = [
30
+ "Development Status :: 4 - Beta",
31
+ "Intended Audience :: Developers",
32
+ "Intended Audience :: Financial and Insurance Industry",
33
+ "Programming Language :: Python :: 3",
34
+ "Programming Language :: Python :: 3.10",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ "Topic :: Office/Business :: Financial",
38
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ test = ["pytest>=7.0", "pytest-asyncio>=0.23"]
43
+
44
+ [project.scripts]
45
+ aetherx-mcp = "aetherx_mcp.server:main"
46
+
47
+ [project.urls]
48
+ Homepage = "https://aether-x-oracle-production.up.railway.app"
49
+ Repository = "https://github.com/belegante-byte/aetherx-oracle"
50
+ Documentation = "https://aether-x-oracle-production.up.railway.app/docs"
51
+ Terms = "https://aether-x-oracle-production.up.railway.app/terms"
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = ["."]
55
+ include = ["aetherx_mcp*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,59 @@
1
+ import asyncio
2
+
3
+ import httpx
4
+
5
+ from aetherx_mcp import server
6
+
7
+
8
+ def _mock_transport() -> httpx.MockTransport:
9
+ def handler(request: httpx.Request) -> httpx.Response:
10
+ port = request.url.params.get("port_id", "")
11
+ return httpx.Response(
12
+ 200,
13
+ json={
14
+ "port_id": port,
15
+ "port_name": "Santos",
16
+ "country": "Brasil",
17
+ "congestion_score": 0.78,
18
+ "eta_delay_days": 1.6,
19
+ "waiting_vessels": 12,
20
+ "freight_volatility_index": 0.42,
21
+ "updated_at": "2026-09-17 15:46:53",
22
+ },
23
+ )
24
+
25
+ return httpx.MockTransport(handler)
26
+
27
+
28
+ def test_list_supported_ports_returns_fifteen() -> None:
29
+ ports = server.list_supported_ports()
30
+ assert len(ports) == 15
31
+ assert any(p["port_id"] == "BRSSZ" for p in ports)
32
+
33
+
34
+ def test_get_port_risk_normalizes_locode(monkeypatch) -> None:
35
+ transport = _mock_transport()
36
+ monkeypatch.setattr(
37
+ server, "_client", lambda: httpx.AsyncClient(transport=transport)
38
+ )
39
+ result = asyncio.run(server.get_port_risk(" brssz "))
40
+ assert result["port_id"] == "BRSSZ"
41
+ assert result["congestion_score"] == 0.78
42
+
43
+
44
+ def test_get_ports_risk_batch(monkeypatch) -> None:
45
+ transport = _mock_transport()
46
+ monkeypatch.setattr(
47
+ server, "_client", lambda: httpx.AsyncClient(transport=transport)
48
+ )
49
+ results = asyncio.run(server.get_ports_risk(["BRSSZ", "CNSHA", "NLRTM"]))
50
+ assert [r["port_id"] for r in results] == ["BRSSZ", "CNSHA", "NLRTM"]
51
+
52
+
53
+ def test_rapidapi_headers_only_when_key_present(monkeypatch) -> None:
54
+ monkeypatch.delenv("RAPIDAPI_KEY", raising=False)
55
+ assert server._headers() == {}
56
+ monkeypatch.setenv("RAPIDAPI_KEY", "secret")
57
+ headers = server._headers()
58
+ assert headers["X-RapidAPI-Key"] == "secret"
59
+ assert "X-RapidAPI-Host" in headers