@fload-ai/mcp 0.1.0 → 0.2.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.
Files changed (51) hide show
  1. package/README.md +71 -317
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/api-client.d.ts +11 -0
  4. package/dist/api-client.d.ts.map +1 -0
  5. package/dist/api-client.js +53 -0
  6. package/dist/api-client.js.map +7 -0
  7. package/dist/bin.d.ts +2 -0
  8. package/dist/bin.d.ts.map +1 -0
  9. package/dist/bin.js +2012 -0
  10. package/dist/bin.js.map +7 -0
  11. package/dist/config.d.ts +8 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/index.d.ts +6 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +1459 -5136
  16. package/dist/index.js.map +4 -4
  17. package/dist/lib/format.d.ts +5 -0
  18. package/dist/lib/format.d.ts.map +1 -0
  19. package/dist/rate-limiter.d.ts +12 -0
  20. package/dist/rate-limiter.d.ts.map +1 -0
  21. package/dist/server.d.ts +5 -0
  22. package/dist/server.d.ts.map +1 -0
  23. package/dist/tools/actions.d.ts +69 -0
  24. package/dist/tools/actions.d.ts.map +1 -0
  25. package/dist/tools/ads.d.ts +35 -0
  26. package/dist/tools/ads.d.ts.map +1 -0
  27. package/dist/tools/agents.d.ts +149 -0
  28. package/dist/tools/agents.d.ts.map +1 -0
  29. package/dist/tools/analytics.d.ts +84 -0
  30. package/dist/tools/analytics.d.ts.map +1 -0
  31. package/dist/tools/anomalies.d.ts +107 -0
  32. package/dist/tools/anomalies.d.ts.map +1 -0
  33. package/dist/tools/apps.d.ts +49 -0
  34. package/dist/tools/apps.d.ts.map +1 -0
  35. package/dist/tools/aso.d.ts +135 -0
  36. package/dist/tools/aso.d.ts.map +1 -0
  37. package/dist/tools/chat.d.ts +69 -0
  38. package/dist/tools/chat.d.ts.map +1 -0
  39. package/dist/tools/dashboard.d.ts +17 -0
  40. package/dist/tools/dashboard.d.ts.map +1 -0
  41. package/dist/tools/forecasting.d.ts +26 -0
  42. package/dist/tools/forecasting.d.ts.map +1 -0
  43. package/dist/tools/growth.d.ts +43 -0
  44. package/dist/tools/growth.d.ts.map +1 -0
  45. package/dist/tools/index.d.ts +20 -0
  46. package/dist/tools/index.d.ts.map +1 -0
  47. package/dist/tools/index.js +1952 -0
  48. package/dist/tools/index.js.map +7 -0
  49. package/dist/tools/reviews.d.ts +119 -0
  50. package/dist/tools/reviews.d.ts.map +1 -0
  51. package/package.json +19 -8
package/README.md CHANGED
@@ -1,359 +1,113 @@
1
- # @fload/mcp
1
+ # @fload-ai/mcp
2
2
 
3
- **Fload MCP Server** - Model Context Protocol server for AI agents to access Fload's mobile app analytics, reviews, and growth insights.
3
+ MCP server for [Fload](https://fload.com) — connects any MCP-compatible AI client (Claude, ChatGPT, Cursor, VS Code, Cline) to your mobile app's App Store Connect / Google Play reviews, metrics, ad campaigns, anomalies, and ASO data.
4
4
 
5
- ## What is MCP?
5
+ 37 tools across 10 domains. OAuth 2.1 for remote connections, API key for scripts and CI.
6
6
 
7
- [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard by Anthropic that enables AI applications to securely connect to data sources and tools. This package implements an MCP server that exposes Fload's mobile analytics capabilities to AI agents like Claude, ChatGPT, and custom AI tools.
7
+ ## Two ways to connect
8
8
 
9
- ## Features
9
+ ### Remote (recommended) — OAuth 2.1 via `mcp-remote`
10
10
 
11
- - **🎯 Core Tools (Phase 1)**
12
- - `list_apps` - List all apps in your organization
13
- - `get_app_details` - Get detailed app information
14
- - `get_reviews` - Query reviews with flexible filters
15
- - `get_analytics_summary` - Get metric summaries with timeseries data
11
+ For Claude Desktop, Cursor, ChatGPT, and any client that supports remote MCP servers. No API keys to manage, per-organization scoping, revoke anytime from Fload Settings → Connected Apps.
16
12
 
17
- - **🔒 Authentication**
18
- - API key-based authentication
19
- - Organization-scoped access
20
- - Secure credential management
21
-
22
- - **🚀 Fast & Reliable**
23
- - Direct database queries (Drizzle ORM)
24
- - TimescaleDB for analytics
25
- - Optimized for AI agent workflows
26
-
27
- ## Installation
28
-
29
- ### From Monorepo (Development)
30
-
31
- ```bash
32
- cd ~/www/fload
33
- pnpm install
34
- pnpm build
35
- ```
36
-
37
- ### From NPM (Production)
38
-
39
- ```bash
40
- npm install -g @fload/mcp
41
- # or
42
- npx @fload/mcp
43
- ```
44
-
45
- ## Setup
46
-
47
- ### 1. Generate API Key
48
-
49
- 🚧 **Coming Soon:** API key management UI in Fload web app.
50
-
51
- For now, contact your Fload admin to generate an API key.
52
-
53
- ### 2. Configure Environment
54
-
55
- **Option A: Environment Variables (Recommended)**
56
-
57
- ```bash
58
- export FLOAD_API_KEY=fload_sk_your_key_here
59
- export DATABASE_URL=postgresql://user:pass@host:port/fload
60
- ```
61
-
62
- **Option B: Config File**
63
-
64
- Create `~/.fload/config.json`:
65
-
66
- ```json
67
- {
68
- "apiKey": "fload_sk_your_key_here",
69
- "databaseUrl": "postgresql://user:pass@host:port/fload",
70
- "organizationId": "your-org-id"
71
- }
72
- ```
73
-
74
- ### 3. Test the Server
75
-
76
- ```bash
77
- # From monorepo
78
- pnpm --filter @fload/mcp dev
79
-
80
- # Or via npx
81
- npx @fload/mcp
82
- ```
83
-
84
- You should see:
85
- ```
86
- [Fload MCP] Starting server...
87
- [Fload MCP] Configuration loaded
88
- [Fload MCP] Database connected
89
- [Fload MCP] Server running on stdio
90
- ```
91
-
92
- ## Usage
93
-
94
- ### With Claude Desktop
95
-
96
- Add to your `claude_desktop_config.json`:
97
-
98
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
99
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
13
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
100
14
 
101
15
  ```json
102
16
  {
103
17
  "mcpServers": {
104
18
  "fload": {
105
19
  "command": "npx",
106
- "args": ["@fload/mcp"],
107
- "env": {
108
- "FLOAD_API_KEY": "fload_sk_your_key_here",
109
- "DATABASE_URL": "postgresql://..."
110
- }
20
+ "args": ["-y", "mcp-remote", "https://api.fload.com/mcp"]
111
21
  }
112
22
  }
113
23
  }
114
24
  ```
115
25
 
116
- Restart Claude Desktop, and you'll see the Fload tools available!
26
+ Restart Claude Desktop. On first use, `mcp-remote` opens a browser for OAuth consent. Pick which Fload organization to share, approve scopes, done.
117
27
 
118
- ### With Custom MCP Client
28
+ **Cursor:** Settings → MCP → Add remote server → `https://api.fload.com/mcp`. Cursor handles Dynamic Client Registration and the consent flow automatically.
119
29
 
120
- ```typescript
121
- import { McpClient } from '@modelcontextprotocol/sdk/client/mcp.js';
122
- import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
30
+ **ChatGPT (Team / Enterprise):** Admin portal → Connectors → Add custom connector → server URL `https://api.fload.com/mcp`.
123
31
 
124
- const client = new McpClient({
125
- name: 'my-client',
126
- version: '1.0.0',
127
- });
32
+ ### Local stdio — API key
128
33
 
129
- const transport = new StdioClientTransport({
130
- command: 'npx',
131
- args: ['@fload/mcp'],
132
- env: {
133
- FLOAD_API_KEY: 'fload_sk_...',
134
- DATABASE_URL: 'postgresql://...',
135
- },
136
- });
34
+ For scripts, CI, headless environments, or anyone who wants a long-lived machine credential. Install this package and point an MCP client at the binary:
137
35
 
138
- await client.connect(transport);
36
+ 1. Create an API key at [platform.fload.com/settings/api-keys](https://platform.fload.com/settings/api-keys).
139
37
 
140
- // List apps
141
- const result = await client.callTool('list_apps', { limit: 10 });
142
- console.log(result);
143
- ```
38
+ 2. Add to your MCP config:
144
39
 
145
- ## Tools Reference
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "fload": {
44
+ "command": "npx",
45
+ "args": ["-y", "@fload-ai/mcp"],
46
+ "env": {
47
+ "FLOAD_API_KEY": "fload_sk_your_key_here"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ```
146
53
 
147
- ### `list_apps`
54
+ Or use `~/.fload/config.json`:
148
55
 
149
- List all mobile apps in your organization.
56
+ ```json
57
+ {
58
+ "apiKey": "fload_sk_your_key_here",
59
+ "apiUrl": "https://api.fload.com"
60
+ }
61
+ ```
150
62
 
151
- **Input:**
152
- ```typescript
153
- {
154
- platform?: 'ios' | 'android', // Filter by platform
155
- limit?: number // Max results (1-100, default: 50)
156
- }
157
- ```
63
+ ## What you can ask your agent
158
64
 
159
- **Output:**
160
- ```json
161
- {
162
- "total": 2,
163
- "apps": [
164
- {
165
- "id": "uuid",
166
- "name": "My Awesome App",
167
- "bundleId": "com.example.app",
168
- "platform": "ios",
169
- "iconUrl": "https://...",
170
- "category": "Games",
171
- "addedAt": "2024-01-15T10:30:00Z"
172
- }
173
- ]
174
- }
175
- ```
65
+ - "Why did iOS installs drop yesterday?"
66
+ - "Draft replies to my last 5 one-star reviews in my brand voice, then approve the good ones."
67
+ - "What's my ROAS across all ad platforms this week?"
68
+ - "Audit my ASO for my top-grossing app and suggest title changes."
69
+ - "List anomalies across my portfolio this week — acknowledge the ones on my dummy app."
176
70
 
177
- ### `get_app_details`
71
+ ## Tools
178
72
 
179
- Get detailed information about a specific app.
73
+ 37 tools grouped by domain. Full list with annotations + scope requirements at [fload.com/docs/mcp](https://fload.com/docs/mcp).
180
74
 
181
- **Input:**
182
- ```typescript
183
- {
184
- assetId?: string, // App UUID (provide either this or bundleId)
185
- bundleId?: string // App bundle ID
186
- }
187
- ```
188
-
189
- **Output:** Full app metadata + connected data sources + sync status
190
-
191
- ### `get_reviews`
192
-
193
- Get app reviews with flexible filtering.
194
-
195
- **Input:**
196
- ```typescript
197
- {
198
- assetId?: string, // App UUID
199
- bundleId?: string, // App bundle ID
200
- platform?: 'ios' | 'android',
201
- rating?: 1 | 2 | 3 | 4 | 5, // Filter by star rating
202
- replied?: boolean, // Has reply?
203
- startDate?: string, // ISO date (YYYY-MM-DD)
204
- endDate?: string,
205
- limit?: number, // Max results (1-200, default: 50)
206
- sortBy?: 'date' | 'rating' // Sort order
207
- }
208
- ```
209
-
210
- **Output:**
211
- ```json
212
- {
213
- "summary": {
214
- "totalReviews": 25,
215
- "averageRating": "4.20",
216
- "repliedCount": 10,
217
- "unrepliedCount": 15
218
- },
219
- "reviews": [
220
- {
221
- "id": "uuid",
222
- "rating": 5,
223
- "title": "Great app!",
224
- "body": "Love the new features...",
225
- "author": "John Doe",
226
- "date": "2024-02-20T14:30:00Z",
227
- "version": "2.1.0",
228
- "country": "US",
229
- "hasReply": true,
230
- "reply": "Thank you for your feedback!",
231
- "replyDate": "2024-02-21T09:00:00Z"
232
- }
233
- ]
234
- }
235
- ```
236
-
237
- ### `get_analytics_summary`
238
-
239
- Get analytics summary with timeseries data.
240
-
241
- **Input:**
242
- ```typescript
243
- {
244
- assetId?: string,
245
- bundleId?: string,
246
- metric: 'downloads' | 'revenue' | 'active_users' | 'sessions' | 'retention' | 'crashes',
247
- period?: '7d' | '30d' | '90d', // Default: '30d'
248
- granularity?: 'day' | 'week' | 'month' // Default: 'day'
249
- }
250
- ```
251
-
252
- **Output:**
253
- ```json
254
- {
255
- "app": {
256
- "id": "uuid",
257
- "name": "My App",
258
- "bundleId": "com.example.app",
259
- "platform": "ios"
260
- },
261
- "metric": "downloads",
262
- "period": "30d",
263
- "dateRange": {
264
- "start": "2024-01-25",
265
- "end": "2024-02-25"
266
- },
267
- "summary": {
268
- "total": 125000,
269
- "average": 4167,
270
- "min": 3200,
271
- "max": 5800,
272
- "trend": "+12.5%"
273
- },
274
- "timeseries": [
275
- { "date": "2024-01-25", "value": 4200 },
276
- { "date": "2024-01-26", "value": 4350 }
277
- ]
278
- }
279
- ```
280
-
281
- ## Development
282
-
283
- ### Project Structure
284
-
285
- ```
286
- packages/fload-mcp/
287
- ├── src/
288
- │ ├── index.ts # Main entry point (STDIO)
289
- │ ├── server.ts # MCP server setup
290
- │ ├── config.ts # Configuration loading
291
- │ ├── auth.ts # API key validation
292
- │ ├── tools/ # Tool implementations
293
- │ │ ├── apps.ts
294
- │ │ ├── reviews.ts
295
- │ │ └── analytics.ts
296
- │ └── lib/
297
- │ ├── db-client.ts # Database connection
298
- │ └── format.ts # Response formatting
299
- ├── bin/
300
- │ └── fload-mcp.js # CLI executable
301
- └── package.json
302
- ```
303
-
304
- ### Build
305
-
306
- ```bash
307
- pnpm build
308
- ```
75
+ | Domain | Tools |
76
+ |---|---|
77
+ | Apps | `list_apps`, `get_app_details` |
78
+ | Reviews | `get_reviews`, `generate_review_reply`, `send_review_reply`, `translate_review` |
79
+ | Analytics | `discover_metrics`, `get_metrics`, `discover_dimensions` (30+ metrics, dimensional breakdowns) |
80
+ | Agents | `list_agents`, `get_agent_details`, `get_agent_run_history`, `trigger_agent_run`, `pause_agent`, `resume_agent`, `get_agent_activity` |
81
+ | Anomalies | `get_anomalies`, `get_anomaly_detail`, `acknowledge_anomaly`, `dismiss_anomaly` |
82
+ | Ads | `get_ads_performance` (Apple Search Ads, Google Ads, Meta Ads, TikTok Ads) |
83
+ | ASO | `get_aso_summary`, `get_aso_recommendations`, `get_aso_keywords`, `get_aso_experiments`, `get_aso_locale_snapshots`, `trigger_aso_analysis` |
84
+ | Growth | `get_growth_audit`, `get_growth_score` |
85
+ | Forecasting | `get_forecasts` |
86
+ | Dashboard | `get_dashboard_overview` |
87
+ | Actions | `list_pending_actions`, `approve_action`, `reject_action` |
88
+ | Chat | `list_conversations`, `get_conversation_messages`, `send_chat_message` |
309
89
 
310
- ### Test
90
+ Every tool carries an MCP `readOnlyHint` or `destructiveHint` annotation so clients can surface the scope of each action to users before calling.
311
91
 
312
- ```bash
313
- pnpm test
314
- ```
315
-
316
- ### Typecheck
317
-
318
- ```bash
319
- pnpm typecheck
320
- ```
321
-
322
- ### Lint
92
+ ## OAuth scopes (remote only)
323
93
 
324
- ```bash
325
- pnpm lint
326
- ```
94
+ 16 scopes. Agents request the minimum they need; users approve per-scope on the consent screen and can revoke from [platform.fload.com/settings/connected-apps](https://platform.fload.com/settings/connected-apps).
327
95
 
328
- ## Roadmap
96
+ - **OIDC identity:** `openid`, `email`, `profile`, `offline_access`
97
+ - **Reads:** `read:apps`, `read:reviews`, `read:analytics`, `read:anomalies`, `read:ads`, `read:aso`, `read:agents`
98
+ - **Writes:** `write:reviews`, `write:ads`, `write:aso`, `write:agents`, `write:chat`
329
99
 
330
- - **Phase 1** ✅ - Core tools (apps, reviews, analytics)
331
- - **Phase 2** 🚧 - Full tool suite (revenue, ratings, ASO, competitors, growth audit)
332
- - **Phase 3** 📋 - Resources & Prompts
333
- - **Phase 4** 📋 - CLI wrapper
334
- - **Phase 5** 📋 - HTTP/SSE transport (hosted MCP server)
100
+ ## Configuration (stdio mode)
335
101
 
336
- ## Security
102
+ | Variable | Required | Default | Description |
103
+ |---|---|---|---|
104
+ | `FLOAD_API_KEY` | Yes (stdio) | — | API key, format `fload_sk_...` |
105
+ | `FLOAD_API_URL` | No | `https://api.fload.com` | API URL (override for self-hosted) |
337
106
 
338
- - **API keys** should be kept secret and never committed to version control
339
- - **Scoped access** - API keys only access their organization's data
340
- - **Audit logging** - All tool calls are logged for compliance
341
- - **Rate limiting** - Prevents abuse (coming in Phase 2)
107
+ ## Issues & feedback
342
108
 
343
- ## Contributing
344
-
345
- This package is part of the Fload monorepo. See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
109
+ File bugs or feature requests at [github.com/fload-ai/mcp/issues](https://github.com/fload-ai/mcp/issues). For integration support: support@fload.com.
346
110
 
347
111
  ## License
348
112
 
349
- MIT © Fload
350
-
351
- ## Support
352
-
353
- - **Documentation:** [Design Doc](../../docs/cli-mcp-design.md)
354
- - **Issues:** GitHub Issues
355
- - **Email:** support@fload.io
356
-
357
- ---
358
-
359
- **Built with ❤️ for AI agents**
113
+ MIT