@driftwest/mcp-server 1.1.1

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 ADDED
@@ -0,0 +1,157 @@
1
+ # @driftwest/mcp-server
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@driftwest/mcp-server)](https://www.npmjs.com/package/@driftwest/mcp-server)
4
+ [![MCP Server](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Model Context Protocol server for DriftWest environmental data. Gives AI agents (Claude Desktop, Cursor, Windsurf, etc.) direct access to 28 tools across 6 environmental domains.
8
+
9
+ ## Quick Setup
10
+
11
+ ### Claude Desktop
12
+
13
+ Add to `~/.claude/claude_desktop_config.json`:
14
+
15
+ ```json
16
+ {
17
+ "mcpServers": {
18
+ "driftwest": {
19
+ "command": "npx",
20
+ "args": ["@driftwest/mcp-server"],
21
+ "env": {
22
+ "DRIFTWEST_API_KEY": "dw_your_key_here"
23
+ }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ ### Claude Code (CLI)
30
+
31
+ Add to `.mcp.json` in your project or `~/.claude.json`:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "driftwest": {
37
+ "command": "npx",
38
+ "args": ["@driftwest/mcp-server"],
39
+ "env": {
40
+ "DRIFTWEST_API_KEY": "dw_your_key_here"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### Get an API Key (Free)
48
+
49
+ ```bash
50
+ curl -X POST https://driftwest.xyz/api/account/register \
51
+ -H "Content-Type: application/json" \
52
+ -d '{"email":"you@example.com"}'
53
+ ```
54
+
55
+ Save the `apiKey` from the response — it cannot be retrieved later.
56
+
57
+ ### API Tiers
58
+
59
+ | Tier | Rate Limit | Daily Limit | History | Batch | Price |
60
+ |------|-----------|-------------|---------|-------|-------|
61
+ | Anonymous | 30/min | 1,000 | 1 day | No | Free |
62
+ | Free | 60/min | 5,000 | 1 day | No | Free (register) |
63
+ | Researcher | 300/min | 50,000 | 30 days | Yes | $29/mo CAD |
64
+ | Enterprise | 1,000/min | 500,000 | 365 days | Yes | Contact us |
65
+
66
+ **Upgrade to Researcher** ($29/mo CAD):
67
+
68
+ ```bash
69
+ curl -X POST https://driftwest.xyz/api/account/checkout \
70
+ -H "Content-Type: application/json" \
71
+ -H "X-API-Key: dw_your_key" \
72
+ | jq .checkoutUrl
73
+ ```
74
+
75
+ Opens a Stripe checkout page. Your tier upgrades automatically after payment.
76
+
77
+ ## Available Tools (28)
78
+
79
+ ### EMF & Space Weather
80
+ | Tool | Description |
81
+ |------|-------------|
82
+ | `emf_latest` | Latest reading from any sensor node |
83
+ | `emf_stats` | 24-hour statistics for all nodes |
84
+ | `emf_history` | Historical time-series data |
85
+ | `sensor_nodes` | List all nodes with online/offline status |
86
+ | `space_weather` | Current Kp/Dst, solar wind, disturbance score |
87
+ | `space_weather_alerts` | Active NOAA space weather alerts |
88
+
89
+ ### Coastal Environment (355 beaches)
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `search_beaches` | Geographic beach search with all indices |
93
+ | `beach_detail` | Complete beach dossier |
94
+ | `water_quality_rankings` | Beaches ranked by WQI |
95
+ | `biodiversity_hotspots` | Beaches ranked by biodiversity |
96
+ | `nearby_beaches` | Find nearby beaches by location |
97
+ | `shoreline_risk_alerts` | Beaches by environmental risk level |
98
+ | `compare_beaches` | Side-by-side comparison of up to 10 beaches |
99
+ | `water_quality_summary` | Provincial water quality statistics |
100
+ | `algae_risk` | Algae bloom risk analysis |
101
+
102
+ ### Wildfire Monitoring
103
+ | Tool | Description |
104
+ |------|-------------|
105
+ | `wildfire_current` | Active fires, danger level, city proximity scores |
106
+ | `wildfire_hotspots` | Fire hotspot locations from NASA FIRMS |
107
+ | `wildfire_smoke_impact` | Per-city smoke impact with AQI and PM2.5 |
108
+
109
+ ### Air Quality (12 cities)
110
+ | Tool | Description |
111
+ |------|-------------|
112
+ | `air_quality_current` | All cities with AQI and health risk scores |
113
+ | `air_quality_city` | Detailed pollutant breakdown for one city |
114
+ | `air_quality_rankings` | Cities ranked by health risk score |
115
+ | `air_quality_alerts` | Cities exceeding AQI 100 |
116
+
117
+ ### Seismic Activity
118
+ | Tool | Description |
119
+ |------|-------------|
120
+ | `seismic_recent` | Recent global earthquakes (M2.5+) from USGS |
121
+ | `seismic_canada` | Canadian earthquakes only (M1.0+) |
122
+ | `seismic_activity_score` | Risk zone scores for 5 Canadian zones |
123
+ | `seismic_nearby` | Earthquakes near a geographic point |
124
+
125
+ ### Cross-Domain
126
+ | Tool | Description |
127
+ |------|-------------|
128
+ | `alberta_environment` | EMF + water quality + space weather dashboard |
129
+
130
+ ### Agent Decision Support
131
+ | Tool | Description |
132
+ |------|-------------|
133
+ | `safety_check` | Composite go/no-go verdict combining air quality, wildfire proximity, and seismic activity for a location |
134
+
135
+ ## Resources
136
+
137
+ - `driftwest://sensors/overview` — All sensor nodes and 24h stats
138
+ - `driftwest://datasets/catalog` — Full dataset catalog description
139
+
140
+ ## Data Sources
141
+
142
+ - **EMF Sensors**: 3 ESP32 EMF nodes + 1 house monitor + 2 GOES satellite feeds in Alberta (sub-minute resolution)
143
+ - **Space Weather**: NOAA GOES satellites, Kp/Dst indices
144
+ - **Coastal**: 355 beaches across BC, Alberta, Oregon (Sentinel-2, Landsat 8/9)
145
+ - **Wildfire**: NASA FIRMS satellite fire detection (15-min refresh)
146
+ - **Air Quality**: Open-Meteo for 12 cities, 6 pollutants (15-min refresh)
147
+ - **Seismic**: USGS earthquake data, 5 Canadian risk zones (5-min refresh)
148
+
149
+ ## Links
150
+
151
+ - API Docs: https://driftwest.xyz/llms.txt
152
+ - OpenAPI Spec: https://driftwest.xyz/.well-known/openapi.json
153
+ - Homepage: https://driftwest.xyz
154
+
155
+ ## License
156
+
157
+ MIT
@@ -0,0 +1,122 @@
1
+ # DriftWest MCP Server — Quickstart Guide
2
+
3
+ ## 1. Install & Configure (2 minutes)
4
+
5
+ ### Get a Free API Key
6
+
7
+ ```bash
8
+ curl -X POST https://driftwest.xyz/api/account/register \
9
+ -H "Content-Type: application/json" \
10
+ -d '{"email":"you@example.com"}'
11
+ ```
12
+
13
+ Save the `apiKey` from the response. It starts with `dw_`.
14
+
15
+ ### Add to Claude Desktop
16
+
17
+ Edit `~/.claude/claude_desktop_config.json`:
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "driftwest": {
23
+ "command": "npx",
24
+ "args": ["@driftwest/mcp-server"],
25
+ "env": {
26
+ "DRIFTWEST_API_KEY": "dw_your_key_here"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ Restart Claude Desktop. You'll see "driftwest" in the MCP tools panel.
34
+
35
+ ### Add to Claude Code (CLI)
36
+
37
+ ```bash
38
+ claude mcp add driftwest -- npx @driftwest/mcp-server
39
+ ```
40
+
41
+ Or add to `.mcp.json` in your project root.
42
+
43
+ ### Add to Cursor
44
+
45
+ Settings > MCP > Add Server:
46
+ - Name: `driftwest`
47
+ - Command: `npx @driftwest/mcp-server`
48
+ - Environment: `DRIFTWEST_API_KEY=dw_your_key`
49
+
50
+ ## 2. Try These Prompts
51
+
52
+ Once connected, try asking your AI assistant:
53
+
54
+ ### Environmental Monitoring
55
+ - "What are the current EMF readings from the Alberta sensors?"
56
+ - "Show me space weather conditions — any solar storms?"
57
+ - "What's the air quality in Calgary right now?"
58
+
59
+ ### Beach & Water Quality
60
+ - "Find the top 5 beaches in BC by water quality"
61
+ - "Compare water quality between Kits Beach and English Bay"
62
+ - "Which beaches have algae bloom risk right now?"
63
+
64
+ ### Safety & Decision Support
65
+ - "Is it safe to go hiking near Banff today? Check wildfire, air quality, and seismic."
66
+ - "Give me a safety check for Vancouver — wildfire smoke, earthquakes, air quality"
67
+
68
+ ### Research Queries
69
+ - "Show me EMF correlations with weather and lunar cycles"
70
+ - "What's the seismic activity near the Cascadia zone?"
71
+ - "How has air quality trended in Edmonton this week?"
72
+
73
+ ## 3. Example Workflows
74
+
75
+ ### Environmental Report Generator
76
+
77
+ Ask Claude to build a daily environmental briefing:
78
+
79
+ > "Using the DriftWest tools, create a daily environmental briefing for Alberta that includes:
80
+ > 1. Current EMF sensor readings and any anomalies
81
+ > 2. Air quality for Calgary, Edmonton, and Red Deer
82
+ > 3. Any active wildfire hotspots
83
+ > 4. Space weather conditions
84
+ > 5. Recent seismic activity near Alberta
85
+ > Format as a concise morning briefing."
86
+
87
+ ### Beach Trip Planner
88
+
89
+ > "I want to plan a beach day this weekend in BC. Use the beach tools to:
90
+ > 1. Find the top 3 beaches near Vancouver by recreation score
91
+ > 2. Check water quality for each
92
+ > 3. Check algae risk
93
+ > 4. Run a safety check for the area
94
+ > Give me a recommendation with a backup option."
95
+
96
+ ### Research Data Collection
97
+
98
+ > "I'm studying EMF-weather correlations. Pull the latest correlation report
99
+ > and the 24-hour EMF statistics. Summarize any patterns you see between
100
+ > electromagnetic fields and environmental conditions."
101
+
102
+ ## 4. Upgrade to Researcher ($29/mo)
103
+
104
+ The free tier gives you 60 requests/minute and 1 day of history. Upgrade for:
105
+ - 300 req/min, 50K daily
106
+ - 30-day historical data
107
+ - Batch queries
108
+ - Priority support
109
+
110
+ ```bash
111
+ curl -X POST https://driftwest.xyz/api/account/checkout \
112
+ -H "Content-Type: application/json" \
113
+ -H "X-API-Key: dw_your_key"
114
+ ```
115
+
116
+ Opens Stripe checkout. Tier upgrades instantly after payment.
117
+
118
+ ## 5. Need Help?
119
+
120
+ - API Docs: https://driftwest.xyz/llms.txt
121
+ - Issues: https://github.com/driftwest/mcp-server/issues
122
+ - Email: info@nimpact.ca
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ DriftWest MCP Server — Research Data Examples
4
+ ==============================================
5
+ Shows how to use the DriftWest API directly from Python
6
+ for research data collection and analysis.
7
+
8
+ API Base: https://driftwest.xyz/api
9
+ Auth: X-API-Key header with your dw_ key
10
+
11
+ These are the same endpoints the MCP server uses internally.
12
+ Use these for building custom pipelines, dashboards, or datasets.
13
+ """
14
+
15
+ import requests
16
+ import json
17
+ from datetime import datetime
18
+
19
+ API_BASE = "https://driftwest.xyz/api"
20
+ # Replace with your API key (register at /api/account/register)
21
+ API_KEY = "dw_your_key_here"
22
+
23
+ headers = {
24
+ "Content-Type": "application/json",
25
+ "X-API-Key": API_KEY
26
+ }
27
+
28
+
29
+ def example_emf_latest():
30
+ """Get the latest EMF sensor readings from all nodes."""
31
+ print("\n=== EMF Latest Readings ===")
32
+ res = requests.get(f"{API_BASE}/emf/latest", headers=headers)
33
+ data = res.json()
34
+ for node in data.get("nodes", []):
35
+ print(f" {node['name']}: {node.get('emf', 'N/A')} uT | "
36
+ f"Temp: {node.get('temperature', 'N/A')}C | "
37
+ f"Status: {'online' if node.get('online') else 'offline'}")
38
+
39
+
40
+ def example_beach_search():
41
+ """Search for beaches by location and quality."""
42
+ print("\n=== Top Beaches in BC ===")
43
+ res = requests.get(f"{API_BASE}/beaches/search", headers=headers, params={
44
+ "province": "BC",
45
+ "limit": 5,
46
+ "sort": "wqi"
47
+ })
48
+ data = res.json()
49
+ for i, beach in enumerate(data.get("beaches", []), 1):
50
+ print(f" {i}. {beach['name']} — WQI: {beach.get('wqi', 'N/A')}, "
51
+ f"Biodiversity: {beach.get('biodiversity_score', 'N/A')}")
52
+
53
+
54
+ def example_air_quality():
55
+ """Get current air quality for all monitored cities."""
56
+ print("\n=== Air Quality Rankings ===")
57
+ res = requests.get(f"{API_BASE}/air-quality/rankings", headers=headers)
58
+ data = res.json()
59
+ for city in data.get("cities", [])[:5]:
60
+ aqi = city.get("aqi", "N/A")
61
+ risk = city.get("health_risk", "N/A")
62
+ print(f" {city['name']}: AQI {aqi} (Risk: {risk})")
63
+
64
+
65
+ def example_safety_check():
66
+ """Run a composite safety check for a location."""
67
+ print("\n=== Safety Check: Calgary ===")
68
+ res = requests.get(f"{API_BASE}/safety/check", headers=headers, params={
69
+ "lat": 51.0447,
70
+ "lon": -114.0719
71
+ })
72
+ data = res.json()
73
+ print(f" Verdict: {data.get('verdict', 'N/A')}")
74
+ print(f" Air Quality: {data.get('air_quality', {}).get('status', 'N/A')}")
75
+ print(f" Wildfire: {data.get('wildfire', {}).get('status', 'N/A')}")
76
+ print(f" Seismic: {data.get('seismic', {}).get('status', 'N/A')}")
77
+
78
+
79
+ def example_space_weather():
80
+ """Check current space weather conditions."""
81
+ print("\n=== Space Weather ===")
82
+ res = requests.get(f"{API_BASE}/space-weather/current", headers=headers)
83
+ data = res.json()
84
+ print(f" Kp Index: {data.get('kp', 'N/A')}")
85
+ print(f" Dst Index: {data.get('dst', 'N/A')} nT")
86
+ print(f" Solar Wind: {data.get('solar_wind_speed', 'N/A')} km/s")
87
+ print(f" Disturbance: {data.get('disturbance_score', 'N/A')}/10")
88
+
89
+
90
+ def example_build_dataset():
91
+ """
92
+ Build a research dataset combining multiple data sources.
93
+ This demonstrates how to create cross-domain environmental datasets.
94
+ """
95
+ print("\n=== Building Cross-Domain Dataset ===")
96
+
97
+ dataset = {
98
+ "timestamp": datetime.now().isoformat(),
99
+ "emf": {},
100
+ "air_quality": {},
101
+ "space_weather": {},
102
+ "seismic": {}
103
+ }
104
+
105
+ # Collect EMF data
106
+ try:
107
+ res = requests.get(f"{API_BASE}/emf/stats", headers=headers)
108
+ dataset["emf"] = res.json()
109
+ print(" [x] EMF stats collected")
110
+ except Exception as e:
111
+ print(f" [ ] EMF: {e}")
112
+
113
+ # Collect air quality
114
+ try:
115
+ res = requests.get(f"{API_BASE}/air-quality/current", headers=headers)
116
+ dataset["air_quality"] = res.json()
117
+ print(" [x] Air quality collected")
118
+ except Exception as e:
119
+ print(f" [ ] Air quality: {e}")
120
+
121
+ # Collect space weather
122
+ try:
123
+ res = requests.get(f"{API_BASE}/space-weather/current", headers=headers)
124
+ dataset["space_weather"] = res.json()
125
+ print(" [x] Space weather collected")
126
+ except Exception as e:
127
+ print(f" [ ] Space weather: {e}")
128
+
129
+ # Collect seismic
130
+ try:
131
+ res = requests.get(f"{API_BASE}/seismic/recent", headers=headers)
132
+ dataset["seismic"] = res.json()
133
+ print(" [x] Seismic data collected")
134
+ except Exception as e:
135
+ print(f" [ ] Seismic: {e}")
136
+
137
+ # Save dataset
138
+ filename = f"driftwest_snapshot_{datetime.now().strftime('%Y%m%d_%H%M')}.json"
139
+ with open(filename, "w") as f:
140
+ json.dump(dataset, f, indent=2)
141
+ print(f"\n Saved to {filename}")
142
+
143
+
144
+ if __name__ == "__main__":
145
+ print("DriftWest Environmental Data — Research Examples")
146
+ print("=" * 50)
147
+ print(f"API: {API_BASE}")
148
+ print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
149
+
150
+ # Uncomment the examples you want to run:
151
+ # example_emf_latest()
152
+ # example_beach_search()
153
+ # example_air_quality()
154
+ # example_safety_check()
155
+ # example_space_weather()
156
+ # example_build_dataset()
157
+
158
+ print("\nUncomment the examples above to run them.")
159
+ print("Get your API key: curl -X POST https://driftwest.xyz/api/account/register -H 'Content-Type: application/json' -d '{\"email\":\"you@example.com\"}'")