options-data-mcp 0.1.0
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.
- package/README.md +60 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +70 -0
- package/package.json +29 -0
- package/src/index.ts +133 -0
- package/tsconfig.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Options Data MCP Server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server that exposes Options Data API endpoints as native tools for AI agents.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y options-data-mcp@latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run from source:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/your-org/options-data-mcp
|
|
15
|
+
cd options-data-mcp
|
|
16
|
+
npm install && npm run build
|
|
17
|
+
npm run start
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Configure
|
|
21
|
+
|
|
22
|
+
Add to your agent's MCP config (e.g., Claude Desktop `claude_desktop_config.json`):
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"mcpServers": {
|
|
27
|
+
"options-data": {
|
|
28
|
+
"command": "npx",
|
|
29
|
+
"args": ["-y", "@optionsdata/mcp-server@latest"],
|
|
30
|
+
"env": {
|
|
31
|
+
"OPTIONS_DATA_API_KEY": "your_api_key_here"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Available Tools
|
|
39
|
+
|
|
40
|
+
| Tool | Description |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `get_gamma` | Gamma exposure profile — dealer positioning, flip zone, pin strikes |
|
|
43
|
+
| `get_vrp` | Volatility richness — ATM IV vs HV30, premium read |
|
|
44
|
+
| `get_term_structure` | IV term structure and skew across DTE buckets |
|
|
45
|
+
| `get_structure` | Full bundle — gamma + VRP + term structure |
|
|
46
|
+
| `get_regime` | GEX regime — stabilizing vs destabilizing |
|
|
47
|
+
| `get_strikes` | Strike recommendations — wheel/CC picks or GEX support/resistance |
|
|
48
|
+
| `get_credit_spread` | Credit spread setup — GEX-regime-gated with sizing |
|
|
49
|
+
| `get_screener` | Universe screener — IV, fundamentals, earnings filter |
|
|
50
|
+
|
|
51
|
+
## Environment Variables
|
|
52
|
+
|
|
53
|
+
| Variable | Default | Description |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `OPTIONS_DATA_API_KEY` | (empty) | API key for subscription access. Omit for x402 pay-per-call |
|
|
56
|
+
| `API_BASE` | `https://api.optionsdataapi.com` | API base URL |
|
|
57
|
+
|
|
58
|
+
## Pricing
|
|
59
|
+
|
|
60
|
+
See [api.optionsdataapi.com](https://api.optionsdataapi.com) for endpoint pricing and subscription tiers.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const API_BASE = process.env.API_BASE || "https://api.optionsdataapi.com";
|
|
6
|
+
const API_KEY = process.env.OPTIONS_DATA_API_KEY || "";
|
|
7
|
+
async function fetchEndpoint(path, params = {}) {
|
|
8
|
+
const qs = new URLSearchParams(params).toString();
|
|
9
|
+
const url = `${API_BASE}${path}${qs ? "?" + qs : ""}`;
|
|
10
|
+
const headers = { "Accept": "application/json" };
|
|
11
|
+
// If API key is set, use subscription auth (bypasses x402)
|
|
12
|
+
// If no API key, omit it — x402 will return 402 with payment instructions
|
|
13
|
+
if (API_KEY)
|
|
14
|
+
headers["X-API-Key"] = API_KEY;
|
|
15
|
+
const resp = await fetch(url, { headers });
|
|
16
|
+
if (!resp.ok) {
|
|
17
|
+
const body = await resp.text();
|
|
18
|
+
throw new Error(`API error ${resp.status}: ${body}`);
|
|
19
|
+
}
|
|
20
|
+
return resp.json();
|
|
21
|
+
}
|
|
22
|
+
const server = new McpServer({
|
|
23
|
+
name: "options-data",
|
|
24
|
+
version: "0.1.0",
|
|
25
|
+
});
|
|
26
|
+
function registerTool(name, description, inputSchema, handler) {
|
|
27
|
+
server.tool(name, description, Object.fromEntries(Object.entries(inputSchema.shape).map(([key, schema]) => [
|
|
28
|
+
key,
|
|
29
|
+
{ description: schema.description || "", type: "string" },
|
|
30
|
+
])), handler);
|
|
31
|
+
}
|
|
32
|
+
// Gamma exposure
|
|
33
|
+
registerTool("get_gamma", "Get gamma exposure profile for a ticker — shows dealer positioning, flip zone, and pin strikes", z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA, SPY") }), async ({ ticker }) => fetchEndpoint("/gamma", { ticker }));
|
|
34
|
+
// VRP
|
|
35
|
+
registerTool("get_vrp", "Get volatility richness premium — compares ATM IV to 30-day realized volatility", z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA") }), async ({ ticker }) => fetchEndpoint("/vrp", { ticker }));
|
|
36
|
+
// Term structure
|
|
37
|
+
registerTool("get_term_structure", "Get IV term structure and skew across multiple DTE buckets", z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, SPY") }), async ({ ticker }) => fetchEndpoint("/term-structure", { ticker }));
|
|
38
|
+
// Structure bundle
|
|
39
|
+
registerTool("get_structure", "Full structure bundle — gamma, VRP, and term structure in one call", z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA, SPY") }), async ({ ticker }) => fetchEndpoint("/structure", { ticker }));
|
|
40
|
+
// Regime
|
|
41
|
+
registerTool("get_regime", "Get GEX regime — stabilizing vs destabilizing, flip zone status", z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, SPY") }), async ({ ticker }) => fetchEndpoint("/regime", { ticker }));
|
|
42
|
+
// Strikes
|
|
43
|
+
registerTool("get_strikes", "Get recommended strikes — wheel/covered-call picks or GEX-based support/resistance", z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA") }), async ({ ticker }) => fetchEndpoint("/strikes", { ticker }));
|
|
44
|
+
// Credit spread
|
|
45
|
+
registerTool("get_credit_spread", "Get credit spread setup — GEX-regime-gated put/call spreads with sizing", z.object({ ticker: z.string().describe("Ticker symbol, e.g. SPY, QQQ") }), async ({ ticker }) => fetchEndpoint("/credit-spread", { ticker }));
|
|
46
|
+
// Screener
|
|
47
|
+
registerTool("get_screener", "Screen a universe of stocks by IV, fundamentals, earnings filter — returns ranked results", z.object({
|
|
48
|
+
ticker: z.string().optional().describe("Optional: filter to specific ticker. Omit for full universe scan"),
|
|
49
|
+
min_iv: z.string().optional().describe("Minimum IV percentage (default 60)"),
|
|
50
|
+
max_results: z.string().optional().describe("Max results to return (default 15)"),
|
|
51
|
+
}), async ({ ticker, min_iv, max_results }) => {
|
|
52
|
+
const params = {};
|
|
53
|
+
if (ticker)
|
|
54
|
+
params.ticker = ticker;
|
|
55
|
+
if (min_iv)
|
|
56
|
+
params.min_iv = min_iv;
|
|
57
|
+
if (max_results)
|
|
58
|
+
params.max_results = max_results;
|
|
59
|
+
return fetchEndpoint("/screener", params);
|
|
60
|
+
});
|
|
61
|
+
// Start server
|
|
62
|
+
async function main() {
|
|
63
|
+
const transport = new StdioServerTransport();
|
|
64
|
+
await server.connect(transport);
|
|
65
|
+
console.error("Options Data MCP server running on stdio");
|
|
66
|
+
}
|
|
67
|
+
main().catch((err) => {
|
|
68
|
+
console.error("Failed to start:", err);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "options-data-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Options Data API — gamma exposure, VRP, IV term structure, and more",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"options-data-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"start": "node dist/index.js",
|
|
13
|
+
"dev": "tsx src/index.ts"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
17
|
+
"zod": "^3.23.8"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.0.0",
|
|
21
|
+
"tsx": "^4.7.0",
|
|
22
|
+
"@types/node": "^20.0.0"
|
|
23
|
+
},
|
|
24
|
+
"keywords": ["mcp", "options", "gamma", "vrp", "trading", "ai-agent"],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
const API_BASE = process.env.API_BASE || "https://api.optionsdataapi.com";
|
|
7
|
+
const API_KEY = process.env.OPTIONS_DATA_API_KEY || "";
|
|
8
|
+
|
|
9
|
+
async function fetchEndpoint(path: string, params: Record<string, string> = {}) {
|
|
10
|
+
const qs = new URLSearchParams(params).toString();
|
|
11
|
+
const url = `${API_BASE}${path}${qs ? "?" + qs : ""}`;
|
|
12
|
+
const headers: Record<string, string> = { "Accept": "application/json" };
|
|
13
|
+
// If API key is set, use subscription auth (bypasses x402)
|
|
14
|
+
// If no API key, omit it — x402 will return 402 with payment instructions
|
|
15
|
+
if (API_KEY) headers["X-API-Key"] = API_KEY;
|
|
16
|
+
|
|
17
|
+
const resp = await fetch(url, { headers });
|
|
18
|
+
if (!resp.ok) {
|
|
19
|
+
const body = await resp.text();
|
|
20
|
+
throw new Error(`API error ${resp.status}: ${body}`);
|
|
21
|
+
}
|
|
22
|
+
return resp.json();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const server = new McpServer({
|
|
26
|
+
name: "options-data",
|
|
27
|
+
version: "0.1.0",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
function registerTool(
|
|
31
|
+
name: string,
|
|
32
|
+
description: string,
|
|
33
|
+
inputSchema: z.ZodObject<any>,
|
|
34
|
+
handler: (args: any) => Promise<any>
|
|
35
|
+
) {
|
|
36
|
+
server.tool(
|
|
37
|
+
name,
|
|
38
|
+
description,
|
|
39
|
+
Object.fromEntries(
|
|
40
|
+
Object.entries(inputSchema.shape).map(([key, schema]) => [
|
|
41
|
+
key,
|
|
42
|
+
{ description: (schema as any).description || "", type: "string" },
|
|
43
|
+
])
|
|
44
|
+
),
|
|
45
|
+
handler
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Gamma exposure
|
|
50
|
+
registerTool(
|
|
51
|
+
"get_gamma",
|
|
52
|
+
"Get gamma exposure profile for a ticker — shows dealer positioning, flip zone, and pin strikes",
|
|
53
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA, SPY") }),
|
|
54
|
+
async ({ ticker }) => fetchEndpoint("/gamma", { ticker })
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// VRP
|
|
58
|
+
registerTool(
|
|
59
|
+
"get_vrp",
|
|
60
|
+
"Get volatility richness premium — compares ATM IV to 30-day realized volatility",
|
|
61
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA") }),
|
|
62
|
+
async ({ ticker }) => fetchEndpoint("/vrp", { ticker })
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// Term structure
|
|
66
|
+
registerTool(
|
|
67
|
+
"get_term_structure",
|
|
68
|
+
"Get IV term structure and skew across multiple DTE buckets",
|
|
69
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, SPY") }),
|
|
70
|
+
async ({ ticker }) => fetchEndpoint("/term-structure", { ticker })
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// Structure bundle
|
|
74
|
+
registerTool(
|
|
75
|
+
"get_structure",
|
|
76
|
+
"Full structure bundle — gamma, VRP, and term structure in one call",
|
|
77
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA, SPY") }),
|
|
78
|
+
async ({ ticker }) => fetchEndpoint("/structure", { ticker })
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Regime
|
|
82
|
+
registerTool(
|
|
83
|
+
"get_regime",
|
|
84
|
+
"Get GEX regime — stabilizing vs destabilizing, flip zone status",
|
|
85
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, SPY") }),
|
|
86
|
+
async ({ ticker }) => fetchEndpoint("/regime", { ticker })
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// Strikes
|
|
90
|
+
registerTool(
|
|
91
|
+
"get_strikes",
|
|
92
|
+
"Get recommended strikes — wheel/covered-call picks or GEX-based support/resistance",
|
|
93
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. AAPL, TSLA") }),
|
|
94
|
+
async ({ ticker }) => fetchEndpoint("/strikes", { ticker })
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Credit spread
|
|
98
|
+
registerTool(
|
|
99
|
+
"get_credit_spread",
|
|
100
|
+
"Get credit spread setup — GEX-regime-gated put/call spreads with sizing",
|
|
101
|
+
z.object({ ticker: z.string().describe("Ticker symbol, e.g. SPY, QQQ") }),
|
|
102
|
+
async ({ ticker }) => fetchEndpoint("/credit-spread", { ticker })
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// Screener
|
|
106
|
+
registerTool(
|
|
107
|
+
"get_screener",
|
|
108
|
+
"Screen a universe of stocks by IV, fundamentals, earnings filter — returns ranked results",
|
|
109
|
+
z.object({
|
|
110
|
+
ticker: z.string().optional().describe("Optional: filter to specific ticker. Omit for full universe scan"),
|
|
111
|
+
min_iv: z.string().optional().describe("Minimum IV percentage (default 60)"),
|
|
112
|
+
max_results: z.string().optional().describe("Max results to return (default 15)"),
|
|
113
|
+
}),
|
|
114
|
+
async ({ ticker, min_iv, max_results }) => {
|
|
115
|
+
const params: Record<string, string> = {};
|
|
116
|
+
if (ticker) params.ticker = ticker;
|
|
117
|
+
if (min_iv) params.min_iv = min_iv;
|
|
118
|
+
if (max_results) params.max_results = max_results;
|
|
119
|
+
return fetchEndpoint("/screener", params);
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Start server
|
|
124
|
+
async function main() {
|
|
125
|
+
const transport = new StdioServerTransport();
|
|
126
|
+
await server.connect(transport);
|
|
127
|
+
console.error("Options Data MCP server running on stdio");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main().catch((err) => {
|
|
131
|
+
console.error("Failed to start:", err);
|
|
132
|
+
process.exit(1);
|
|
133
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"types": ["node"]
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*"],
|
|
17
|
+
"exclude": ["node_modules", "dist"]
|
|
18
|
+
}
|