quantworlds-mcp 1.0.0__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.
@@ -0,0 +1 @@
1
+ """Proxy the hosted QuantWorlds tools over stdio MCP."""
@@ -0,0 +1,110 @@
1
+ """stdio MCP server that forwards tool calls to https://api.quantworlds.com."""
2
+
3
+ import os
4
+
5
+ import httpx
6
+ from mcp.server.mcpserver import MCPServer
7
+
8
+ API = os.environ.get("QUANTWORLDS_API", "https://api.quantworlds.com").rstrip("/")
9
+ mcp = MCPServer("QuantWorlds")
10
+
11
+
12
+ def _post(path: str, payload: dict) -> dict:
13
+ response = httpx.post(f"{API}{path}", json=payload, timeout=60)
14
+ try:
15
+ body = response.json()
16
+ except ValueError:
17
+ body = {"error": response.text}
18
+ if response.status_code >= 400:
19
+ body["http_status"] = response.status_code
20
+ return body
21
+
22
+
23
+ @mcp.tool(name="options_surface_pricer")
24
+ def options_surface_pricer(
25
+ spot: float,
26
+ strikes: list[float],
27
+ time_to_expiry_years: float,
28
+ risk_free_rate: float,
29
+ dividend_yield: float,
30
+ iv_array: list[float],
31
+ option_type: str = "call",
32
+ is_american: bool = True,
33
+ ) -> dict:
34
+ """Price an option surface. Supply spot, strikes, and implied volatilities."""
35
+ return _post("/v1/verify/options-surface", {
36
+ "spot": spot,
37
+ "strikes": strikes,
38
+ "time_to_expiry_years": time_to_expiry_years,
39
+ "risk_free_rate": risk_free_rate,
40
+ "dividend_yield": dividend_yield,
41
+ "iv_array": iv_array,
42
+ "option_type": option_type,
43
+ "is_american": is_american,
44
+ })
45
+
46
+
47
+ @mcp.tool(name="instant_signal_backtest")
48
+ def instant_signal_backtest(
49
+ prices: list[float],
50
+ raw_signals: list[float],
51
+ fee_bps: float = 2.0,
52
+ order_book_depth_usd: float = 500000.0,
53
+ trade_size_usd: float = 50000.0,
54
+ trials_tested_by_agent: int = 10,
55
+ ) -> dict:
56
+ """Backtest a signal against caller-supplied prices. The signal earns the next bar."""
57
+ return _post("/v1/verify/backtest", {
58
+ "prices": prices,
59
+ "raw_signals": raw_signals,
60
+ "fee_bps": fee_bps,
61
+ "order_book_depth_usd": order_book_depth_usd,
62
+ "trade_size_usd": trade_size_usd,
63
+ "trials_tested_by_agent": trials_tested_by_agent,
64
+ })
65
+
66
+
67
+ @mcp.tool(name="portfolio_stress_verifier")
68
+ def portfolio_stress_verifier(
69
+ current_weights: list[float],
70
+ proposed_weights: list[float],
71
+ asset_vols_annual: list[float],
72
+ asset_betas: list[float],
73
+ correlation_matrix: list[list[float]],
74
+ confidence_level: float = 0.99,
75
+ scenario: str = "2020_COVID_LIQUIDITY_CRASH",
76
+ ) -> dict:
77
+ """Parametric portfolio VaR, CVaR, and crisis shock from caller-supplied inputs."""
78
+ return _post("/v1/verify/portfolio-stress", {
79
+ "current_weights": current_weights,
80
+ "proposed_weights": proposed_weights,
81
+ "asset_vols_annual": asset_vols_annual,
82
+ "asset_betas": asset_betas,
83
+ "correlation_matrix": correlation_matrix,
84
+ "confidence_level": confidence_level,
85
+ "scenario": scenario,
86
+ })
87
+
88
+
89
+ @mcp.tool(name="microstructure_coint_test")
90
+ def microstructure_coint_test(
91
+ series_y: list[float],
92
+ series_x: list[float],
93
+ bid_volumes: list[float] | None = None,
94
+ ask_volumes: list[float] | None = None,
95
+ ) -> dict:
96
+ """Engle-Granger cointegration check for two caller-supplied price series."""
97
+ return _post("/v1/verify/cointegration", {
98
+ "series_y": series_y,
99
+ "series_x": series_x,
100
+ "bid_volumes": bid_volumes,
101
+ "ask_volumes": ask_volumes,
102
+ })
103
+
104
+
105
+ def main() -> None:
106
+ mcp.run(transport="stdio")
107
+
108
+
109
+ if __name__ == "__main__":
110
+ main()
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantworlds-mcp
3
+ Version: 1.0.0
4
+ Summary: MCP client for the QuantWorlds verification API.
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: mcp>=2.0.0
8
+ Requires-Dist: httpx>=0.27.0
9
+
10
+ # quantworlds-mcp
11
+
12
+ stdio MCP server that forwards the four QuantWorlds tools to `https://api.quantworlds.com`.
13
+
14
+ ```bash
15
+ pip install quantworlds-mcp
16
+ quantworlds-mcp
17
+ ```
18
+
19
+ The hosted remote endpoint is `https://api.quantworlds.com/mcp`. Publishing this package to PyPI requires a PyPI account on this machine.
@@ -0,0 +1,7 @@
1
+ quantworlds_mcp/__init__.py,sha256=C8WAgmSawaPbyhCGxWEjP1xkrZAYYxpnxqFS3SGHyNw,57
2
+ quantworlds_mcp/server.py,sha256=wWx8wlaEVhMEhDEGewII97HaK3k-GMHKnrRkJGKB2eM,3369
3
+ quantworlds_mcp-1.0.0.dist-info/METADATA,sha256=ixVO-74DGeqd6jh1zzvduOILLNpiYMGLHXud29z1XjE,544
4
+ quantworlds_mcp-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ quantworlds_mcp-1.0.0.dist-info/entry_points.txt,sha256=zy2Nph-9eVp5RaHn0eCWOQCfLHahg6v2BkvyKRu_UVE,64
6
+ quantworlds_mcp-1.0.0.dist-info/top_level.txt,sha256=ETpqqbm8gHKZsW_t8m8jlTfN-2HNOQrWuIUDABZKGrc,16
7
+ quantworlds_mcp-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ quantworlds-mcp = quantworlds_mcp.server:main
@@ -0,0 +1 @@
1
+ quantworlds_mcp