pdg-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.
pdg_mcp-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.5
2
+ Name: pdg-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for Provenance Data Grid — 20 data tools for AI agents
5
+ Project-URL: Homepage, https://pdg.neprovenance.com
6
+ Project-URL: Documentation, https://pdg.neprovenance.com/docs
7
+ Project-URL: Buy Credits, https://pdg.neprovenance.com/billing/plans
8
+ License-Expression: MIT
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: httpx>=0.25
11
+ Requires-Dist: mcp>=2.0
12
+ Description-Content-Type: text/markdown
13
+
14
+ # pdg-mcp — Provenance Data Grid MCP Server
15
+
16
+ 20 data tools for AI agents via the Model Context Protocol. Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install pdg-mcp
22
+ ```
23
+
24
+ ## Configure
25
+
26
+ **Claude Desktop** (`~/.claude/settings.json`):
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "pdg": {
31
+ "command": "pdg-mcp"
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ **With API key** (for more than 5 free calls/day):
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "pdg": {
42
+ "command": "pdg-mcp",
43
+ "env": {
44
+ "PDG_API_KEY": "pdg_your_key_here"
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## Tools
52
+
53
+ | Tool | Description |
54
+ |------|-------------|
55
+ | `crypto_price` | Crypto price, 24h change, volume, market cap |
56
+ | `stock_price` | US stock quotes |
57
+ | `weather` | Global weather + 48h forecast |
58
+ | `weather_us` | NWS weather + alerts (US only) |
59
+ | `web_extract` | URL to clean markdown |
60
+ | `web_search` | Brave Search results |
61
+ | `news_search` | News headlines by keyword |
62
+ | `entity_search` | Business entity search (SEC + 5 state SOS + NPPES) |
63
+ | `entity_federal` | SAM.gov federal contractor lookup |
64
+ | `sanctions_screen` | OFAC SDN screening (19,596 entries) |
65
+ | `provider_search` | 9.89M US healthcare providers |
66
+ | `company_detail` | SEC company details + filings |
67
+ | `company_financials` | SEC XBRL financials (revenue, assets, EPS) |
68
+ | `address_enrich` | Multi-source address enrichment |
69
+ | `market_search` | Prediction markets (Polymarket + Kalshi) |
70
+ | `market_quote` | Prediction market quotes |
71
+ | `chain_balance` | Wallet balances (Base/ETH/Arbitrum) |
72
+ | `chain_gas` | Gas prices |
73
+ | `chain_tx` | Transaction details |
74
+
75
+ ## Pricing
76
+
77
+ - **Free:** 5 calls/day per tool, no API key needed
78
+ - **API Key:** Credit packs from $5 at https://pdg.neprovenance.com/billing/plans
79
+ - **x402:** Pay per call in USDC on Base
80
+
81
+ ## Links
82
+
83
+ - API Docs: https://pdg.neprovenance.com/docs
84
+ - Buy Credits: https://pdg.neprovenance.com/billing/plans
@@ -0,0 +1,71 @@
1
+ # pdg-mcp — Provenance Data Grid MCP Server
2
+
3
+ 20 data tools for AI agents via the Model Context Protocol. Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install pdg-mcp
9
+ ```
10
+
11
+ ## Configure
12
+
13
+ **Claude Desktop** (`~/.claude/settings.json`):
14
+ ```json
15
+ {
16
+ "mcpServers": {
17
+ "pdg": {
18
+ "command": "pdg-mcp"
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ **With API key** (for more than 5 free calls/day):
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "pdg": {
29
+ "command": "pdg-mcp",
30
+ "env": {
31
+ "PDG_API_KEY": "pdg_your_key_here"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Tools
39
+
40
+ | Tool | Description |
41
+ |------|-------------|
42
+ | `crypto_price` | Crypto price, 24h change, volume, market cap |
43
+ | `stock_price` | US stock quotes |
44
+ | `weather` | Global weather + 48h forecast |
45
+ | `weather_us` | NWS weather + alerts (US only) |
46
+ | `web_extract` | URL to clean markdown |
47
+ | `web_search` | Brave Search results |
48
+ | `news_search` | News headlines by keyword |
49
+ | `entity_search` | Business entity search (SEC + 5 state SOS + NPPES) |
50
+ | `entity_federal` | SAM.gov federal contractor lookup |
51
+ | `sanctions_screen` | OFAC SDN screening (19,596 entries) |
52
+ | `provider_search` | 9.89M US healthcare providers |
53
+ | `company_detail` | SEC company details + filings |
54
+ | `company_financials` | SEC XBRL financials (revenue, assets, EPS) |
55
+ | `address_enrich` | Multi-source address enrichment |
56
+ | `market_search` | Prediction markets (Polymarket + Kalshi) |
57
+ | `market_quote` | Prediction market quotes |
58
+ | `chain_balance` | Wallet balances (Base/ETH/Arbitrum) |
59
+ | `chain_gas` | Gas prices |
60
+ | `chain_tx` | Transaction details |
61
+
62
+ ## Pricing
63
+
64
+ - **Free:** 5 calls/day per tool, no API key needed
65
+ - **API Key:** Credit packs from $5 at https://pdg.neprovenance.com/billing/plans
66
+ - **x402:** Pay per call in USDC on Base
67
+
68
+ ## Links
69
+
70
+ - API Docs: https://pdg.neprovenance.com/docs
71
+ - Buy Credits: https://pdg.neprovenance.com/billing/plans
File without changes
@@ -0,0 +1,18 @@
1
+ """Run the PDG MCP server over stdio for local use with Claude Desktop, Cursor, etc."""
2
+
3
+ import asyncio
4
+ from mcp.server.stdio import stdio_server
5
+ from mcp_server.server import server
6
+
7
+
8
+ async def main():
9
+ async with stdio_server() as (read_stream, write_stream):
10
+ await server.run(read_stream, write_stream, server.create_initialization_options())
11
+
12
+
13
+ def main_sync():
14
+ asyncio.run(main())
15
+
16
+
17
+ if __name__ == "__main__":
18
+ main_sync()
@@ -0,0 +1,136 @@
1
+ """Provenance Data Grid MCP Server — 20 data tools for AI agents.
2
+
3
+ Runs as:
4
+ 1. Remote: mounted at /mcp on the FastAPI app (Streamable HTTP transport)
5
+ 2. Standalone: `python -m mcp_server` (stdio transport)
6
+
7
+ 5 free calls/day per tool. For more, set PDG_API_KEY env var.
8
+ Buy credits at https://pdg.neprovenance.com/billing/plans
9
+ """
10
+
11
+ import os
12
+ import json
13
+
14
+ import httpx
15
+ from mcp.server import Server
16
+ from mcp import types
17
+
18
+ PDG_BASE_URL = os.environ.get("PDG_BASE_URL", "https://pdg.neprovenance.com")
19
+ PDG_API_KEY = os.environ.get("PDG_API_KEY", "")
20
+
21
+ server = Server("provenance-data-grid")
22
+
23
+
24
+ async def _call(path: str, params: dict = None) -> dict:
25
+ headers = {}
26
+ if PDG_API_KEY:
27
+ headers["X-API-Key"] = PDG_API_KEY
28
+ async with httpx.AsyncClient(timeout=15.0, base_url=PDG_BASE_URL) as client:
29
+ resp = await client.get(path, params=params or {}, headers=headers)
30
+ return resp.json()
31
+
32
+
33
+ # --- Tool definitions ---
34
+
35
+ TOOLS = [
36
+ types.Tool(name="crypto_price", description="Get cryptocurrency price, 24h change, volume, and market cap. Supports BTC, ETH, SOL, and 100+ coins.",
37
+ inputSchema={"type": "object", "properties": {"symbol": {"type": "string", "description": "Crypto symbol (btc, eth, sol)"}}, "required": ["symbol"]}),
38
+ types.Tool(name="crypto_top", description="Top cryptocurrencies ranked by market cap with prices and 24h changes.",
39
+ inputSchema={"type": "object", "properties": {"limit": {"type": "integer", "description": "Number of coins (default 20, max 100)", "default": 20}}}),
40
+ types.Tool(name="stock_price", description="Current stock quote: price, day high/low, volume. All US-listed stocks.",
41
+ inputSchema={"type": "object", "properties": {"ticker": {"type": "string", "description": "Stock ticker (AAPL, MSFT, TSLA)"}}, "required": ["ticker"]}),
42
+ types.Tool(name="weather", description="Current weather and 48-hour forecast for any location worldwide.",
43
+ inputSchema={"type": "object", "properties": {"lat": {"type": "number", "description": "Latitude"}, "lon": {"type": "number", "description": "Longitude"}}, "required": ["lat", "lon"]}),
44
+ types.Tool(name="weather_us", description="US weather from NWS: current conditions, 7-day forecast, and active alerts.",
45
+ inputSchema={"type": "object", "properties": {"lat": {"type": "number", "description": "Latitude (US only)"}, "lon": {"type": "number", "description": "Longitude (US only)"}}, "required": ["lat", "lon"]}),
46
+ types.Tool(name="web_extract", description="Extract main content from any URL as clean markdown. Strips ads and navigation.",
47
+ inputSchema={"type": "object", "properties": {"url": {"type": "string", "description": "URL to extract"}}, "required": ["url"]}),
48
+ types.Tool(name="web_search", description="Web search via Brave Search. Structured results with titles, URLs, snippets.",
49
+ inputSchema={"type": "object", "properties": {"query": {"type": "string", "description": "Search query"}}, "required": ["query"]}),
50
+ types.Tool(name="news_search", description="Search news headlines by keyword. Returns titles, sources, URLs, dates.",
51
+ inputSchema={"type": "object", "properties": {"query": {"type": "string", "description": "Search query"}}, "required": ["query"]}),
52
+ types.Tool(name="entity_search", description="Search US business entities across 5 state SOS databases, SEC EDGAR, and 9.89M NPPES healthcare providers.",
53
+ inputSchema={"type": "object", "properties": {"name": {"type": "string", "description": "Business or entity name"}, "state": {"type": "string", "description": "Two-letter state code (optional)"}}, "required": ["name"]}),
54
+ types.Tool(name="entity_federal", description="SAM.gov federal contractor lookup: status, certifications (HUBZone, 8(a), WOSB), NAICS codes.",
55
+ inputSchema={"type": "object", "properties": {"name": {"type": "string", "description": "Business name"}}, "required": ["name"]}),
56
+ types.Tool(name="sanctions_screen", description="OFAC SDN sanctions screening. 19,596 entries with exact and fuzzy matching. Essential for compliance.",
57
+ inputSchema={"type": "object", "properties": {"name": {"type": "string", "description": "Name to screen"}}, "required": ["name"]}),
58
+ types.Tool(name="provider_search", description="Search 9.89M US healthcare providers by name, NPI, location, or specialty. All 50 states.",
59
+ inputSchema={"type": "object", "properties": {"name": {"type": "string", "description": "Provider name"}, "npi": {"type": "string", "description": "NPI number"}, "state": {"type": "string", "description": "State code"}, "city": {"type": "string", "description": "City"}}}),
60
+ types.Tool(name="company_detail", description="SEC company details: tickers, SIC code, addresses, recent filings. Use CIK number.",
61
+ inputSchema={"type": "object", "properties": {"cik": {"type": "string", "description": "SEC CIK number (e.g., 320193 for Apple)"}}, "required": ["cik"]}),
62
+ types.Tool(name="company_financials", description="Public company financials from SEC XBRL: revenue, net income, assets, equity, EPS.",
63
+ inputSchema={"type": "object", "properties": {"cik": {"type": "string", "description": "SEC CIK number"}}, "required": ["cik"]}),
64
+ types.Tool(name="address_enrich", description="Multi-source address enrichment: property data (New England), healthcare providers, and business entities at address.",
65
+ inputSchema={"type": "object", "properties": {"address": {"type": "string", "description": "Street address"}, "city": {"type": "string", "description": "City"}, "state": {"type": "string", "description": "State code"}}, "required": ["address", "city", "state"]}),
66
+ types.Tool(name="market_search", description="Search prediction markets on Polymarket and Kalshi. Prices, volume, liquidity.",
67
+ inputSchema={"type": "object", "properties": {"query": {"type": "string", "description": "Search query"}}, "required": ["query"]}),
68
+ types.Tool(name="market_quote", description="Prediction market quote: bid/ask, volume, outcome prices.",
69
+ inputSchema={"type": "object", "properties": {"market_id": {"type": "string", "description": "Market ID from market_search"}}, "required": ["market_id"]}),
70
+ types.Tool(name="chain_balance", description="ETH and token balances for a wallet on Base, Ethereum, or Arbitrum.",
71
+ inputSchema={"type": "object", "properties": {"address": {"type": "string", "description": "Wallet address (0x...)"}, "chain": {"type": "string", "description": "base, ethereum, or arbitrum", "default": "base"}}, "required": ["address"]}),
72
+ types.Tool(name="chain_gas", description="Current gas price and base fee on Base, Ethereum, or Arbitrum.",
73
+ inputSchema={"type": "object", "properties": {"chain": {"type": "string", "description": "base, ethereum, or arbitrum", "default": "base"}}}),
74
+ types.Tool(name="chain_tx", description="Transaction details: sender, recipient, value, gas, status.",
75
+ inputSchema={"type": "object", "properties": {"tx_hash": {"type": "string", "description": "Transaction hash"}, "chain": {"type": "string", "description": "base, ethereum, or arbitrum", "default": "base"}}, "required": ["tx_hash"]}),
76
+ ]
77
+
78
+ DISPATCH = {
79
+ "crypto_price": lambda a: _call(f"/price/crypto/{a['symbol']}"),
80
+ "crypto_top": lambda a: _call("/price/crypto", {"limit": a.get("limit", 20)}),
81
+ "stock_price": lambda a: _call(f"/price/stock/{a['ticker']}"),
82
+ "weather": lambda a: _call(f"/weather/{a['lat']},{a['lon']}"),
83
+ "weather_us": lambda a: _call(f"/weather-us/{a['lat']},{a['lon']}"),
84
+ "web_extract": lambda a: _call("/web/extract", {"url": a["url"]}),
85
+ "web_search": lambda a: _call("/web/search", {"q": a["query"]}),
86
+ "news_search": lambda a: _call("/news/search", {"q": a["query"]}),
87
+ "entity_search": lambda a: _call("/entity/search", {"name": a["name"], **({"state": a["state"]} if a.get("state") else {})}),
88
+ "entity_federal": lambda a: _call("/entity/federal", {"name": a["name"]}),
89
+ "sanctions_screen": lambda a: _call("/sanctions/screen", {"name": a["name"]}),
90
+ "provider_search": lambda a: _call("/provider/search", {k: v for k, v in a.items() if v}),
91
+ "company_detail": lambda a: _call(f"/company/{a['cik']}"),
92
+ "company_financials": lambda a: _call(f"/company/{a['cik']}/financials"),
93
+ "address_enrich": lambda a: _call("/address/enrich", {"address": a["address"], "city": a["city"], "state": a["state"]}),
94
+ "market_search": lambda a: _call("/market/search", {"q": a["query"]}),
95
+ "market_quote": lambda a: _call(f"/market/quote/{a['market_id']}"),
96
+ "chain_balance": lambda a: _call(f"/chain/balance/{a['address']}", {"chain": a.get("chain", "base")}),
97
+ "chain_gas": lambda a: _call("/chain/gas", {"chain": a.get("chain", "base")}),
98
+ "chain_tx": lambda a: _call(f"/chain/tx/{a['tx_hash']}", {"chain": a.get("chain", "base")}),
99
+ }
100
+
101
+
102
+ # --- MCP protocol handlers ---
103
+
104
+ async def handle_list_tools(request, *args):
105
+ return types.ListToolsResult(tools=TOOLS)
106
+
107
+
108
+ async def handle_call_tool(request, *args):
109
+ name = request.params.name
110
+ args = request.params.arguments or {}
111
+
112
+ handler = DISPATCH.get(name)
113
+ if not handler:
114
+ return types.CallToolResult(
115
+ content=[types.TextContent(type="text", text=f"Unknown tool: {name}")],
116
+ isError=True,
117
+ )
118
+ try:
119
+ result = await handler(args)
120
+ return types.CallToolResult(
121
+ content=[types.TextContent(type="text", text=json.dumps(result, indent=2))],
122
+ )
123
+ except Exception as e:
124
+ return types.CallToolResult(
125
+ content=[types.TextContent(type="text", text=f"Error: {e}")],
126
+ isError=True,
127
+ )
128
+
129
+
130
+ server.add_request_handler("tools/list", types.ListToolsRequest, handle_list_tools)
131
+ server.add_request_handler("tools/call", types.CallToolRequest, handle_call_tool)
132
+
133
+
134
+ def get_streamable_app():
135
+ """Get a Starlette app for mounting in FastAPI (remote HTTP transport)."""
136
+ return server.streamable_http_app()
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pdg-mcp"
7
+ version = "0.1.0"
8
+ description = "MCP server for Provenance Data Grid — 20 data tools for AI agents"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ dependencies = ["mcp>=2.0", "httpx>=0.25"]
13
+
14
+ [tool.hatch.build.targets.wheel]
15
+ packages = ["mcp_server"]
16
+
17
+ [project.scripts]
18
+ pdg-mcp = "mcp_server.__main__:main_sync"
19
+
20
+ [project.urls]
21
+ Homepage = "https://pdg.neprovenance.com"
22
+ Documentation = "https://pdg.neprovenance.com/docs"
23
+ "Buy Credits" = "https://pdg.neprovenance.com/billing/plans"