mcp-server-fine-print 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,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-server-fine-print
3
+ Version: 0.1.0
4
+ Summary: Fine Print Analytics NBA data server for Claude Desktop and other MCP clients
5
+ Author: Fine Print Analytics
6
+ License: MIT
7
+ Keywords: analytics,betting,claude,mcp,nba
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: httpx>=0.27.0
10
+ Requires-Dist: mcp>=1.2.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ # mcp-server-fine-print
14
+
15
+ NBA analytics data for Claude Desktop, Cursor, Windsurf, and other MCP clients — powered by [Fine Print Analytics](https://fineprintanalytics.com).
16
+
17
+ Ask Claude about referee tendencies, pace mismatches, travel fatigue, team form, and player streaks. The server queries the Fine Print API in real time.
18
+
19
+ ## Setup
20
+
21
+ 1. Get an API key at https://fineprintanalytics.com/mcp
22
+ 2. Add to your `claude_desktop_config.json`:
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "fine-print": {
28
+ "command": "uvx",
29
+ "args": ["mcp-server-fine-print"],
30
+ "env": {
31
+ "FINE_PRINT_API_KEY": "YOUR_API_KEY"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ 3. Restart Claude Desktop.
39
+
40
+ ## Available tools
41
+
42
+ - `get_team_record` — win/loss with home/away splits
43
+ - `get_team_pace` — pace (possessions/game) with rolling averages
44
+ - `get_team_rolling_averages` — last 5 / last 10 form
45
+ - `get_head_to_head` — head-to-head records
46
+ - `get_referee_tendencies` — referee home win % and over/under rates
47
+ - `get_team_referee_record` — team ATS record by referee
48
+ - `get_travel_data` — travel distance, timezone lag, back-to-backs
49
+ - `get_player_streaks` — hot/cold streak data
50
+ - `get_game_ats_results` — historical ATS and over/under outcomes
51
+
52
+ ## License
53
+
54
+ MIT
@@ -0,0 +1,42 @@
1
+ # mcp-server-fine-print
2
+
3
+ NBA analytics data for Claude Desktop, Cursor, Windsurf, and other MCP clients — powered by [Fine Print Analytics](https://fineprintanalytics.com).
4
+
5
+ Ask Claude about referee tendencies, pace mismatches, travel fatigue, team form, and player streaks. The server queries the Fine Print API in real time.
6
+
7
+ ## Setup
8
+
9
+ 1. Get an API key at https://fineprintanalytics.com/mcp
10
+ 2. Add to your `claude_desktop_config.json`:
11
+
12
+ ```json
13
+ {
14
+ "mcpServers": {
15
+ "fine-print": {
16
+ "command": "uvx",
17
+ "args": ["mcp-server-fine-print"],
18
+ "env": {
19
+ "FINE_PRINT_API_KEY": "YOUR_API_KEY"
20
+ }
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ 3. Restart Claude Desktop.
27
+
28
+ ## Available tools
29
+
30
+ - `get_team_record` — win/loss with home/away splits
31
+ - `get_team_pace` — pace (possessions/game) with rolling averages
32
+ - `get_team_rolling_averages` — last 5 / last 10 form
33
+ - `get_head_to_head` — head-to-head records
34
+ - `get_referee_tendencies` — referee home win % and over/under rates
35
+ - `get_team_referee_record` — team ATS record by referee
36
+ - `get_travel_data` — travel distance, timezone lag, back-to-backs
37
+ - `get_player_streaks` — hot/cold streak data
38
+ - `get_game_ats_results` — historical ATS and over/under outcomes
39
+
40
+ ## License
41
+
42
+ MIT
@@ -0,0 +1,12 @@
1
+ import asyncio
2
+
3
+ from .server import serve
4
+
5
+
6
+ def main() -> None:
7
+ """Entry point for the mcp-server-fine-print command."""
8
+ asyncio.run(serve())
9
+
10
+
11
+ if __name__ == "__main__":
12
+ main()
@@ -0,0 +1,388 @@
1
+ """
2
+ Fine Print Analytics MCP Server.
3
+
4
+ Exposes the Fine Print NBA analytics API as MCP tools so Claude Desktop
5
+ (and other MCP clients like Cursor / Windsurf) can query NBA data directly.
6
+
7
+ Design:
8
+ - Every tool maps to one HTTP GET against the Fine Print API.
9
+ - The user's API key (env: FINE_PRINT_API_KEY) is sent on every request so the
10
+ API's auth middleware can validate and meter usage.
11
+ - All tools are declared in the ENDPOINTS list below. To add/edit a tool,
12
+ edit that one list -- nothing else needs to change.
13
+ """
14
+
15
+ import os
16
+ import json
17
+ from typing import Any
18
+
19
+ import httpx
20
+ from mcp.server import Server
21
+ from mcp.server.stdio import stdio_server
22
+ from mcp.types import Tool, TextContent
23
+
24
+ # ---------------------------------------------------------------------------
25
+ # Configuration
26
+ # ---------------------------------------------------------------------------
27
+
28
+ API_BASE = os.environ.get(
29
+ "FINE_PRINT_API_BASE",
30
+ "https://nba-fine-print-api-1020739541265.us-central1.run.app",
31
+ ).rstrip("/")
32
+
33
+ API_KEY = os.environ.get("FINE_PRINT_API_KEY", "")
34
+
35
+ # Direct MCP customers authenticate with our own key header (validated by our
36
+ # own middleware), separate from RapidAPI's X-RapidAPI-Key.
37
+ AUTH_HEADER = "X-Fine-Print-Key"
38
+
39
+ # ---------------------------------------------------------------------------
40
+ # Tool / endpoint definitions (all 18 live endpoints)
41
+ # ---------------------------------------------------------------------------
42
+
43
+ ENDPOINTS: list[dict[str, Any]] = [
44
+ # ---- Basic / Free ----
45
+ {
46
+ "name": "get_team_record",
47
+ "description": (
48
+ "Get a team's win/loss record by season, including home record, away record, and overall "
49
+ "win percentage. Use to assess how a team performs at home vs on the road before evaluating a spread."
50
+ ),
51
+ "path": "/v1/teams/record",
52
+ "params": {
53
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation, e.g. 'DET'. Optional."},
54
+ "season": {"type": "integer", "description": "Season year, e.g. 2026. Defaults to current."},
55
+ },
56
+ "required": [],
57
+ },
58
+ {
59
+ "name": "get_team_pace",
60
+ "description": (
61
+ "Get game pace and possession data by team: average possessions per game and pace ranking relative "
62
+ "to the league. Use for pace-mismatch analysis -- a high-pace team vs a slow defensive team often "
63
+ "produces pace suppression the total line misses."
64
+ ),
65
+ "path": "/v1/teams/pace",
66
+ "params": {
67
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation, e.g. 'DET'. Required."},
68
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
69
+ "game_date": {"type": "string", "description": "Filter to a specific game date, YYYY-MM-DD."},
70
+ },
71
+ "required": ["team_id"],
72
+ },
73
+ {
74
+ "name": "get_team_rest",
75
+ "description": (
76
+ "Get rest days and back-to-back flags per game by team, including days since last game for both "
77
+ "home and away teams. Use to identify back-to-back disadvantages across the slate."
78
+ ),
79
+ "path": "/v1/teams/rest",
80
+ "params": {
81
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
82
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
83
+ "game_date": {"type": "string", "description": "Filter to a specific game date, YYYY-MM-DD."},
84
+ },
85
+ "required": ["team_id"],
86
+ },
87
+ {
88
+ "name": "get_head_to_head",
89
+ "description": (
90
+ "Get the all-time head-to-head record between two teams across all available seasons. "
91
+ "Use to identify persistent matchup tendencies the market may underweight."
92
+ ),
93
+ "path": "/v1/teams/head-to-head",
94
+ "params": {
95
+ "team_a": {"type": "string", "description": "First team abbreviation, e.g. 'DET'. Required."},
96
+ "team_b": {"type": "string", "description": "Second team abbreviation, e.g. 'LAL'. Required."},
97
+ },
98
+ "required": ["team_a", "team_b"],
99
+ },
100
+ # ---- Pro ----
101
+ {
102
+ "name": "get_referee_tendencies",
103
+ "description": (
104
+ "Get historical referee game tendencies: average pace, total fouls called, free throw rate, and "
105
+ "home team win percentage. Omit referee_name to get the leaderboard. Use to factor tonight's "
106
+ "referee assignment into a model before the line moves."
107
+ ),
108
+ "path": "/v1/referees/tendencies",
109
+ "params": {
110
+ "referee_name": {"type": "string", "description": "Full referee name, e.g. 'Scott Foster'. Optional -- omit for leaderboard."},
111
+ "min_games": {"type": "integer", "description": "Minimum games officiated. Defaults to 20."},
112
+ },
113
+ "required": [],
114
+ },
115
+ {
116
+ "name": "get_referee_ats",
117
+ "description": (
118
+ "Get historical ATS and over/under splits for each referee: home team ATS percentage, over "
119
+ "percentage, and average ATS margin. Use to find officials whose foul-calling style inflates or "
120
+ "suppresses scoring."
121
+ ),
122
+ "path": "/v1/referees/ats",
123
+ "params": {
124
+ "referee_name": {"type": "string", "description": "Full referee name. Optional."},
125
+ "min_games": {"type": "integer", "description": "Minimum games threshold. Defaults to 20."},
126
+ },
127
+ "required": [],
128
+ },
129
+ {
130
+ "name": "get_team_referee_record",
131
+ "description": (
132
+ "Get a team's win/loss record split by individual referee. Surfaces which officials a specific "
133
+ "team consistently performs well or poorly with."
134
+ ),
135
+ "path": "/v1/teams/referee-record",
136
+ "params": {
137
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
138
+ "referee_name": {"type": "string", "description": "Filter to a specific referee. Optional."},
139
+ },
140
+ "required": ["team_id"],
141
+ },
142
+ {
143
+ "name": "get_team_referee_ats",
144
+ "description": (
145
+ "Get a team's ATS record and over/under splits broken down by referee. Use to build a lookup of "
146
+ "team/referee ATS combinations -- e.g. does a team cover more often with a specific official."
147
+ ),
148
+ "path": "/v1/teams/referee-ats",
149
+ "params": {
150
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
151
+ "referee_name": {"type": "string", "description": "Filter to a specific referee. Optional."},
152
+ },
153
+ "required": ["team_id"],
154
+ },
155
+ {
156
+ "name": "get_travel_data",
157
+ "description": (
158
+ "Get travel distance and direction per game for both home and away teams, including miles traveled "
159
+ "and whether the team crossed significant time zones. Use to identify structural travel disadvantages."
160
+ ),
161
+ "path": "/v1/games/travel",
162
+ "params": {
163
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
164
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
165
+ "game_date": {"type": "string", "description": "Filter to a specific game date, YYYY-MM-DD."},
166
+ },
167
+ "required": ["team_id"],
168
+ },
169
+ {
170
+ "name": "get_timezone_lag",
171
+ "description": (
172
+ "Get timezone shift data per game including home and away timezone changes from the previous game "
173
+ "location and an overall lag advantage score. Use to find body-clock disadvantages, e.g. a West "
174
+ "Coast team playing an early East Coast road game."
175
+ ),
176
+ "path": "/v1/games/timezone-lag",
177
+ "params": {
178
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
179
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
180
+ "game_date": {"type": "string", "description": "Filter to a specific game date, YYYY-MM-DD."},
181
+ },
182
+ "required": ["team_id"],
183
+ },
184
+ # ---- Ultra ----
185
+ {
186
+ "name": "get_game_ats_results",
187
+ "description": (
188
+ "Get game against-the-spread results: home line, over/under, ATS result, and line source. Covers "
189
+ "3+ seasons. Use for backtesting historical cover rates in specific situations."
190
+ ),
191
+ "path": "/v1/games/ats",
192
+ "params": {
193
+ "team_id": {"type": "string", "description": "Filter to a specific team. Optional."},
194
+ "season": {"type": "integer", "description": "Season year. Historical requires Ultra tier."},
195
+ "game_date": {"type": "string", "description": "Filter to a specific date, YYYY-MM-DD."},
196
+ },
197
+ "required": [],
198
+ },
199
+ {
200
+ "name": "get_altitude_fatigue",
201
+ "description": (
202
+ "Get altitude fatigue data per game: arena altitude, the away team's previous game altitude, and "
203
+ "the altitude change they're experiencing. Use for totals analysis in Denver and Salt Lake City."
204
+ ),
205
+ "path": "/v1/games/altitude-fatigue",
206
+ "params": {
207
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
208
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
209
+ "game_date": {"type": "string", "description": "Filter to a specific date, YYYY-MM-DD."},
210
+ },
211
+ "required": ["team_id"],
212
+ },
213
+ {
214
+ "name": "get_team_streaks",
215
+ "description": (
216
+ "Get team win/loss streak data with streak length and label by game. Use to spot when the public "
217
+ "has overreacted to momentum -- e.g. a team on a 7-game streak getting inflated betting action."
218
+ ),
219
+ "path": "/v1/teams/streaks",
220
+ "params": {
221
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
222
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
223
+ },
224
+ "required": ["team_id"],
225
+ },
226
+ {
227
+ "name": "get_team_rolling_averages",
228
+ "description": (
229
+ "Get rolling averages for team stats: points scored, points allowed, win percentage, and pace over "
230
+ "the last 5 and 10 games. Use to build a dynamic total estimate against the posted line."
231
+ ),
232
+ "path": "/v1/teams/rolling-averages",
233
+ "params": {
234
+ "team_id": {"type": "string", "description": "Basketball Reference abbreviation. Required."},
235
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
236
+ "game_date": {"type": "string", "description": "Rolling averages as of this date, YYYY-MM-DD."},
237
+ },
238
+ "required": ["team_id"],
239
+ },
240
+ {
241
+ "name": "get_player_streaks",
242
+ "description": (
243
+ "Get player hot/cold streak data: points above or below their season average over the last 3 and "
244
+ "5 games. Use to flag players 5+ points off their average against posted prop lines."
245
+ ),
246
+ "path": "/v1/players/streaks",
247
+ "params": {
248
+ "player_name": {"type": "string", "description": "Full player name, e.g. 'Cade Cunningham'. Required."},
249
+ "team_id": {"type": "string", "description": "Team abbreviation. Required."},
250
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
251
+ },
252
+ "required": ["player_name", "team_id"],
253
+ },
254
+ {
255
+ "name": "get_player_rolling_averages",
256
+ "description": (
257
+ "Get rolling averages for player stats: points, rebounds, and assists over the last 3 and 5 games, "
258
+ "compared against their season average. Use to identify reliable same-game parlay legs."
259
+ ),
260
+ "path": "/v1/players/rolling-averages",
261
+ "params": {
262
+ "player_name": {"type": "string", "description": "Full player name. Required."},
263
+ "team_id": {"type": "string", "description": "Team abbreviation. Required."},
264
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
265
+ "game_date": {"type": "string", "description": "Rolling averages as of this date, YYYY-MM-DD."},
266
+ },
267
+ "required": ["player_name", "team_id"],
268
+ },
269
+ {
270
+ "name": "get_player_referee_stats",
271
+ "description": (
272
+ "Get player performance splits by referee: average points, season average comparison, and "
273
+ "plus/minus with that official. Use to find prop edges where a player performs differently with "
274
+ "specific referees."
275
+ ),
276
+ "path": "/v1/players/referee-stats",
277
+ "params": {
278
+ "player_name": {"type": "string", "description": "Full player name. Required."},
279
+ "team_id": {"type": "string", "description": "Team abbreviation. Required."},
280
+ "referee_name": {"type": "string", "description": "Filter to a specific referee. Optional."},
281
+ "min_games": {"type": "integer", "description": "Minimum games with this referee. Defaults to 10."},
282
+ },
283
+ "required": ["player_name", "team_id"],
284
+ },
285
+ {
286
+ "name": "get_player_altitude_fatigue",
287
+ "description": (
288
+ "Get player performance broken down by quarter in altitude games, including stats and altitude "
289
+ "change from the previous game location. Use before betting first-half player props in Denver or "
290
+ "Salt Lake City."
291
+ ),
292
+ "path": "/v1/players/altitude-fatigue",
293
+ "params": {
294
+ "player_name": {"type": "string", "description": "Full player name. Required."},
295
+ "team_id": {"type": "string", "description": "Team abbreviation. Required."},
296
+ "season": {"type": "integer", "description": "Season year. Defaults to current."},
297
+ "game_date": {"type": "string", "description": "Filter to a specific game date, YYYY-MM-DD."},
298
+ },
299
+ "required": ["player_name", "team_id"],
300
+ },
301
+ ]
302
+
303
+ # ---------------------------------------------------------------------------
304
+ # Server implementation
305
+ # ---------------------------------------------------------------------------
306
+
307
+ server = Server("fine-print")
308
+
309
+
310
+ @server.list_tools()
311
+ async def list_tools() -> list[Tool]:
312
+ """Expose every endpoint in ENDPOINTS as an MCP tool."""
313
+ return [
314
+ Tool(
315
+ name=ep["name"],
316
+ description=ep["description"],
317
+ inputSchema={
318
+ "type": "object",
319
+ "properties": ep["params"],
320
+ "required": ep.get("required", []),
321
+ },
322
+ )
323
+ for ep in ENDPOINTS
324
+ ]
325
+
326
+
327
+ @server.call_tool()
328
+ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
329
+ """Route a tool call to its HTTP endpoint and return the JSON result."""
330
+ ep = next((e for e in ENDPOINTS if e["name"] == name), None)
331
+ if ep is None:
332
+ return [TextContent(type="text", text=f"Unknown tool: {name}")]
333
+
334
+ if not API_KEY:
335
+ return [TextContent(
336
+ type="text",
337
+ text="No API key configured. Set FINE_PRINT_API_KEY in your MCP config.",
338
+ )]
339
+
340
+ # Split arguments into path params (those that appear as {placeholder}) and
341
+ # query params (everything else).
342
+ path = ep["path"]
343
+ query: dict[str, Any] = {}
344
+ for key, value in (arguments or {}).items():
345
+ placeholder = "{" + key + "}"
346
+ if placeholder in path:
347
+ path = path.replace(placeholder, str(value))
348
+ elif value is not None:
349
+ query[key] = value
350
+
351
+ url = f"{API_BASE}{path}"
352
+ headers = {AUTH_HEADER: API_KEY}
353
+
354
+ try:
355
+ async with httpx.AsyncClient(timeout=20) as client:
356
+ resp = await client.get(url, params=query, headers=headers)
357
+
358
+ if resp.status_code == 429:
359
+ return [TextContent(
360
+ type="text",
361
+ text=("Fine Print API rate limit reached for this billing period. "
362
+ "Upgrade your plan at https://fineprintanalytics.com/mcp to continue."),
363
+ )]
364
+ if resp.status_code == 401:
365
+ return [TextContent(
366
+ type="text",
367
+ text="Fine Print API key is invalid or inactive. Check your FINE_PRINT_API_KEY.",
368
+ )]
369
+ resp.raise_for_status()
370
+
371
+ try:
372
+ data = resp.json()
373
+ text = json.dumps(data, indent=2)
374
+ except Exception:
375
+ text = resp.text
376
+
377
+ return [TextContent(type="text", text=text)]
378
+
379
+ except httpx.HTTPStatusError as e:
380
+ return [TextContent(type="text", text=f"Fine Print API error {e.response.status_code}: {e.response.text[:300]}")]
381
+ except Exception as e:
382
+ return [TextContent(type="text", text=f"Failed to reach Fine Print API: {e}")]
383
+
384
+
385
+ async def serve() -> None:
386
+ """Run the server over stdio (how Claude Desktop talks to it)."""
387
+ async with stdio_server() as (read_stream, write_stream):
388
+ await server.run(read_stream, write_stream, server.create_initialization_options())
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "mcp-server-fine-print"
3
+ version = "0.1.0"
4
+ description = "Fine Print Analytics NBA data server for Claude Desktop and other MCP clients"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Fine Print Analytics" }]
9
+ keywords = ["nba", "betting", "analytics", "mcp", "claude"]
10
+ dependencies = [
11
+ "mcp>=1.2.0",
12
+ "httpx>=0.27.0",
13
+ ]
14
+
15
+ [project.scripts]
16
+ mcp-server-fine-print = "mcp_server_fine_print:main"
17
+
18
+ [build-system]
19
+ requires = ["hatchling"]
20
+ build-backend = "hatchling.build"
21
+
22
+ [tool.hatch.build.targets.wheel]
23
+ packages = ["mcp_server_fine_print"]