@praise25/meta-mcp-server 0.1.8 → 0.1.10

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 (36) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +292 -292
  3. package/dist/config.d.ts +24 -0
  4. package/dist/config.js +14 -0
  5. package/dist/constants.d.ts +1 -1
  6. package/dist/constants.js +1 -1
  7. package/dist/helpers/graph-client.d.ts +11 -1
  8. package/dist/helpers/graph-client.js +24 -16
  9. package/dist/index.js +0 -0
  10. package/dist/server.js +21 -1
  11. package/dist/tools/ads/get-insights.d.ts +1 -1
  12. package/dist/tools/ads/get-insights.js +12 -10
  13. package/dist/tools/ads/list-accounts.js +4 -4
  14. package/dist/tools/business/list-assets.js +10 -10
  15. package/dist/tools/business/list-businesses.js +4 -4
  16. package/dist/tools/business/list-system-users.js +4 -4
  17. package/dist/tools/instagram/get-audience-demographics.js +9 -9
  18. package/dist/tools/instagram/get-media-insights.js +14 -14
  19. package/dist/tools/instagram/list-accounts.js +2 -2
  20. package/dist/tools/meta/graph-read.js +7 -7
  21. package/dist/tools/overview/business-overview.js +10 -10
  22. package/dist/tools/overview/content-report.d.ts +57 -0
  23. package/dist/tools/overview/content-report.js +318 -0
  24. package/dist/tools/overview/latest-posts-summary.d.ts +1 -1
  25. package/dist/tools/overview/latest-posts-summary.js +10 -16
  26. package/dist/tools/pages/get-insights.js +2 -2
  27. package/dist/tools/pages/get-post-insights.js +4 -4
  28. package/dist/tools/pages/list-posts.d.ts +1 -1
  29. package/dist/tools/pages/list-posts.js +3 -1
  30. package/dist/tools/register.js +3 -2
  31. package/dist/tools/shared.d.ts +19 -4
  32. package/dist/tools/shared.js +56 -0
  33. package/dist/tools/token/health.js +8 -6
  34. package/dist/tools/token/inspect.js +11 -11
  35. package/dist/tools/whatsapp/get-analytics.js +2 -2
  36. package/package.json +77 -77
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 CashToken Rewards
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CashToken Rewards
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,292 +1,292 @@
1
- # meta-mcp-server
2
-
3
- > **Read-only Model Context Protocol server for Meta Business Manager.** Plug-in for AI assistants ("ChatGPT for marketing insights") that surfaces Pages, Instagram Business, Marketing API ad insights, Pixels, Commerce catalogs, and WhatsApp Business data — all read-only by construction.
4
-
5
- [![Read-Only Verified](https://img.shields.io/badge/safety-read--only-success)](#read-only-by-construction)
6
- [![Governance: Cashtoken SDGP](https://img.shields.io/badge/governance-cashtoken%20sdgp-blue)](./governance/standards/sdgp-main.md)
7
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
8
-
9
- ---
10
-
11
- ## Why this exists
12
-
13
- CashToken Marketing operates several Pages, Instagram Business accounts, Meta ad accounts, Pixels and (in future) Catalogs / WhatsApp Business assets across the `Hodusoft` Business Manager. Insight retrieval today is fragmented across Business Suite UIs, Ads Manager exports, and ad-hoc Graph API calls. This MCP server consolidates **read-only** access into a single tool surface that any MCP-aware AI assistant can plug into — turning fragmented UIs into one conversational interface for the marketing team.
14
-
15
- ---
16
-
17
- ## Read-only by construction
18
-
19
- This server cannot write to Meta. Period. Four layers of defence:
20
-
21
- 1. **HTTP interceptor** — every axios request passes through a guard that throws `ReadOnlyViolationError` if the method isn't `GET`, before the request leaves the process. ([`src/helpers/graph-client.ts`](./src/helpers/graph-client.ts))
22
- 2. **No write API surface** — the `GraphClient` class exposes only `get()` and `getAllPages()`. No `post()`, `put()`, `patch()`, or `delete()` exist anywhere in `src/`.
23
- 3. **All tools annotated** `readOnlyHint: true, destructiveHint: false` — MCP clients surface this to end users.
24
- 4. **Belt-and-braces token scopes** (operator responsibility) — issue the system-user token with read-only scopes (`ads_read`, `pages_read_engagement`, `read_insights`, `instagram_basic`, `instagram_manage_insights`). Even if the server were compromised, the token itself cannot write. See [`ADR-20260421-Read-Only-HTTP-Enforcement.md`](./governance/project-docs/adr/ADR-20260421-Read-Only-HTTP-Enforcement.md).
25
-
26
- Verify any time:
27
-
28
- ```bash
29
- npm run test:readonly
30
- ```
31
-
32
- ---
33
-
34
- ## Tools (36)
35
-
36
- | Domain | Tools |
37
- |---|---|
38
- | **Discovery** (6) | `meta_token_inspect`, `meta_health_check`, `meta_graph_read`, `meta_business_list`, `meta_business_list_assets`, `meta_business_list_system_users` |
39
- | **Ads / Marketing API** (8) | `meta_ads_list_accounts`, `meta_ads_get_account`, `meta_ads_list_campaigns`, `meta_ads_list_adsets`, `meta_ads_list_ads`, `meta_ads_get_insights` ⭐, `meta_ads_get_creative`, `meta_ads_list_custom_audiences` |
40
- | **Pages** (7) | `meta_page_list`, `meta_page_get`, `meta_page_list_posts`, `meta_page_get_post_insights`, `meta_page_get_insights`, `meta_page_list_reviews`, `meta_page_list_videos` |
41
- | **Instagram** (5) | `meta_ig_list_accounts`, `meta_ig_get_account`, `meta_ig_list_media`, `meta_ig_get_media_insights`, `meta_ig_get_audience_demographics` |
42
- | **Pixels** (2) | `meta_pixel_list`, `meta_pixel_get_stats` |
43
- | **Catalog** (3) | `meta_catalog_list`, `meta_catalog_list_products`, `meta_catalog_get_diagnostics` |
44
- | **WhatsApp** (4) | `meta_whatsapp_list_wabas`, `meta_whatsapp_list_phone_numbers`, `meta_whatsapp_list_templates`, `meta_whatsapp_get_analytics` |
45
- | **Eagle's-eye** (1) | `meta_business_overview` ⭐⭐⭐ — single-call consolidated snapshot across the whole business |
46
-
47
- ---
48
-
49
- ## Quickstart
50
-
51
- ### 1. Install
52
-
53
- ```bash
54
- git clone git@github.com:feladeveloper/meta-mcp-server.git
55
- cd meta-mcp-server
56
- npm install
57
- ```
58
-
59
- ### 2. Configure environment
60
-
61
- Copy `.env.example` → `.env` and fill in:
62
-
63
- ```bash
64
- META_ACCESS_TOKEN=... # System-user token (see Token Provisioning below)
65
- META_APP_SECRET=... # App secret of the app that issued the token (Hodusoft app: 193481170220592)
66
- META_API_VERSION=v23.0
67
- META_CACHE_TTL_SECONDS=120
68
- META_MAX_AUTO_PAGES=5
69
- LOG_LEVEL=info
70
- ```
71
-
72
- Optional allowlists (if set, the server refuses to operate on IDs outside the allowlist):
73
-
74
- ```bash
75
- META_ALLOWED_BUSINESS_IDS=133767790806312
76
- META_ALLOWED_AD_ACCOUNT_IDS=act_146517954996436,...
77
- META_ALLOWED_PAGE_IDS=138368686823692,...
78
- META_ALLOWED_IG_USER_IDS=17841406467396631,...
79
- ```
80
-
81
- ### 3. Build and run
82
-
83
- ```bash
84
- npm run build
85
- node dist/index.js # stdio MCP server
86
- ```
87
-
88
- Or in development:
89
-
90
- ```bash
91
- npm run dev
92
- ```
93
-
94
- For an MCP Inspector session against the built server:
95
-
96
- ```bash
97
- npm run inspect
98
- ```
99
-
100
- ### 4. Wire into a client
101
-
102
- Example (Claude Desktop or any MCP client) — fetches the published package on demand via `npx`:
103
-
104
- ```json
105
- {
106
- "mcpServers": {
107
- "meta": {
108
- "command": "npx",
109
- "args": ["-y", "@praise25/meta-mcp-server"],
110
- "env": {
111
- "META_ACCESS_TOKEN": "...",
112
- "META_APP_SECRET": "..."
113
- }
114
- }
115
- }
116
- }
117
- ```
118
-
119
- For a global install (`npm install -g @praise25/meta-mcp-server`), use the bin directly:
120
-
121
- ```json
122
- {
123
- "mcpServers": {
124
- "meta": {
125
- "command": "meta-business-manager-mcp-server",
126
- "env": {
127
- "META_ACCESS_TOKEN": "...",
128
- "META_APP_SECRET": "..."
129
- }
130
- }
131
- }
132
- }
133
- ```
134
-
135
- For local development against a clone of this repo:
136
-
137
- ```json
138
- {
139
- "mcpServers": {
140
- "meta": {
141
- "command": "node",
142
- "args": ["/absolute/path/to/meta-mcp-server/dist/index.js"],
143
- "env": {
144
- "META_ACCESS_TOKEN": "...",
145
- "META_APP_SECRET": "..."
146
- }
147
- }
148
- }
149
- }
150
- ```
151
-
152
- ---
153
-
154
- ## Token Provisioning (Cashtoken-specific)
155
-
156
- The system user `AI_Insights_Reader` (id `122093391782492654`) under the `Hodusoft` business (id `133767790806312`) is the canonical identity for this server. Procedure to issue / rotate its token:
157
-
158
- 1. Business Settings → System Users → `AI_Insights_Reader` → **Generate New Token**
159
- 2. Pick the **Hodusoft** app (id `193481170220592`)
160
- 3. In the scope picker, untick everything, then tick:
161
- - `business_management`, `ads_management` (Meta only exposes management here; server still blocks writes), `pages_read_engagement`, `pages_read_user_content`, `read_insights`, `instagram_basic`, `instagram_manage_insights`, `whatsapp_business_management`, `catalog_management`
162
- 4. Copy the token (Meta only shows it once)
163
- 5. Paste over `META_ACCESS_TOKEN` in `.env`
164
- 6. Verify with `meta_health_check` and `meta_token_inspect`
165
-
166
- Token TTL is ~60 days. Set a calendar reminder; rotation procedure documented in [`/governance/project-docs/runbook.md`](./governance/project-docs/runbook.md).
167
-
168
- See also: [`ADR-20260421-System-User-Token-Pattern.md`](./governance/project-docs/adr/ADR-20260421-System-User-Token-Pattern.md).
169
-
170
- ---
171
-
172
- ## Repository layout
173
-
174
- ```
175
- meta-mcp-server/
176
- ├── CLAUDE.md # AI agent rules (governance)
177
- ├── .cursorrules # Cursor agent rules
178
- ├── .github/
179
- │ ├── copilot-instructions.md # Copilot agent rules
180
- │ ├── ISSUE_TEMPLATE/
181
- │ └── workflows/ # CI/CD (GitHub Actions, Sentinel status check)
182
- ├── .claude/skills/ # 23 governance skills (scaffolding, review, git-ops, …)
183
- ├── .sentinelrc # Sentinel governance plugin config
184
- ├── CHANGELOG.md # SemVer release history
185
- ├── README.md
186
- ├── governance/ # Governance assets — see /governance/standards/
187
- │ ├── standards/ # SDGP policies, coding standards
188
- │ ├── templates/ # Doc templates (specs, ADRs, deviations, project docs)
189
- │ └── project-docs/ # Project documents
190
- │ ├── 1-vision-doc.md
191
- │ ├── 2-brd.md
192
- │ ├── 3-prd.md
193
- │ ├── 5-tad.md
194
- │ ├── runbook.md
195
- │ ├── solution-doc-architecture.md
196
- │ ├── specs/ # Feature specs
197
- │ ├── adr/ # Architecture Decision Records
198
- │ └── deviations/ # Governance deviation logs
199
- ├── src/ # Implementation (see TAD)
200
- │ ├── index.ts # stdio entrypoint
201
- │ ├── server.ts # MCP server wiring
202
- │ ├── config.ts # env + allowlists
203
- │ ├── errors.ts # MetaError, ReadOnlyViolationError
204
- │ ├── logger.ts # pino, stderr only, redacts secrets
205
- │ ├── constants.ts
206
- │ ├── context.ts
207
- │ ├── helpers/
208
- │ │ ├── graph-client.ts # GET-only axios client + retry + cache + appsecret_proof
209
- │ │ ├── cache.ts # LRU TTL cache
210
- │ │ ├── format.ts # JSON / Markdown response formatting
211
- │ │ └── schema.ts # Shared Zod shapes (pagination, date presets, IDs)
212
- │ ├── tools/ # 36 tool implementations grouped by domain
213
- │ │ ├── token/ meta/ business/ ads/ pages/ instagram/ pixels/ catalog/ whatsapp/ overview/
214
- │ │ ├── shared.ts # runList / runGet / errorResult helpers
215
- │ │ └── register.ts # Centralized tool registration
216
- │ └── types/
217
- └── tests/
218
- └── read-only-guard.mjs # Runtime proof that POST/PUT/PATCH/DELETE are blocked
219
- ```
220
-
221
- ---
222
-
223
- ## Governance
224
-
225
- This project is initialized from the [`cashtokenrewards/project-governance-template`](https://github.com/cashtokenrewards/project-governance-template) and follows the **Software Development Governance Policy (SDGP)** in [`/governance/standards/sdgp-main.md`](./governance/standards/sdgp-main.md).
226
-
227
- **Three absolute rules:**
228
- 1. No feature is built without an approved spec. ([`/governance/project-docs/specs/`](./governance/project-docs/specs/))
229
- 2. No ADR is written without a parent feature spec. ([`/governance/project-docs/adr/`](./governance/project-docs/adr/))
230
- 3. No implementation begins without the spec and all required ADRs approved.
231
-
232
- The current implementation (commit zero) was bootstrapped against an initial pass of governance docs:
233
-
234
- | Doc | Path |
235
- |---|---|
236
- | Vision | [`governance/project-docs/1-vision-doc.md`](./governance/project-docs/1-vision-doc.md) |
237
- | BRD | [`governance/project-docs/2-brd.md`](./governance/project-docs/2-brd.md) |
238
- | PRD | [`governance/project-docs/3-prd.md`](./governance/project-docs/3-prd.md) |
239
- | TAD | [`governance/project-docs/5-tad.md`](./governance/project-docs/5-tad.md) |
240
- | Runbook | [`governance/project-docs/runbook.md`](./governance/project-docs/runbook.md) |
241
- | Specs | [`governance/project-docs/specs/`](./governance/project-docs/specs/) |
242
- | ADRs | [`governance/project-docs/adr/`](./governance/project-docs/adr/) |
243
- | Deviations | [`governance/project-docs/deviations/`](./governance/project-docs/deviations/) |
244
-
245
- **Branch model:** Gitflow. `main` (production), `dev` (integration). Short-lived branches: `feature-`, `fix-`, `release-`, `hotfix-`, `docs-`. All merges `--no-ff`. See [`/governance/standards/sdgp-main.md`](./governance/standards/sdgp-main.md) §7.4.
246
-
247
- **AI agent rules:** [`CLAUDE.md`](./CLAUDE.md), [`.cursorrules`](./.cursorrules), [`.github/copilot-instructions.md`](./.github/copilot-instructions.md). Sentinel keeps these in sync with the central governance config.
248
-
249
- ---
250
-
251
- ## Sentinel
252
-
253
- This repository is tracked by the [Sentinel governance plugin](https://github.com/feladeveloper/sentinel-claude-plugin). Configuration lives at [`.sentinelrc`](./.sentinelrc). On any clone:
254
-
255
- ```bash
256
- export SENTINEL_GITHUB_TOKEN="ghp_..." # Personal access token with repo:read
257
- sentinel sync # Pull latest org-level governance into CLAUDE.md
258
- ```
259
-
260
- `/sentinel-sync` and `/sentinel-status` slash commands are also available inside Claude Code once the plugin is installed.
261
-
262
- ---
263
-
264
- ## Scripts
265
-
266
- | Script | What it does |
267
- |---|---|
268
- | `npm run build` | Clean + compile TypeScript → `dist/` |
269
- | `npm run dev` | Run with `tsx` (no build step) |
270
- | `npm run start` | Run built `dist/index.js` |
271
- | `npm run inspect` | Build + open MCP Inspector |
272
- | `npm run check:types` | `tsc --noEmit` |
273
- | `npm run test:readonly` | Build + runtime proof that POST/PUT/PATCH/DELETE are blocked by the Graph client |
274
- | `npm test` | (placeholder for jest suite — see [`SPEC-07-eval-suite.md`](./governance/project-docs/specs/) when added) |
275
-
276
- ---
277
-
278
- ## Status
279
-
280
- | Aspect | State |
281
- |---|---|
282
- | Implementation | **v0.1.0 — bootstrapped, 36 tools, build clean, read-only guard verified** |
283
- | Governance docs | Initial pass — Vision / BRD / PRD / TAD / Runbook / 3 ADRs / 1 deviation drafted |
284
- | App-level (Meta) | Hodusoft app in **development tier** for Marketing API. Standard Access via App Review pending. |
285
- | Asset coverage | All 3 Pages discoverable; 1 Page (CashToken) currently assigned to AI_Insights_Reader; 5 ad accounts visible; 3 Pixels visible; 1 IG (cashtokenhq) discovered via Page link |
286
- | Open scopes | `read_insights`, `instagram_manage_insights`, `whatsapp_business_management`, `catalog_management` may need to be added to the Hodusoft app before they appear in the token picker |
287
-
288
- ---
289
-
290
- ## License
291
-
292
- MIT — see [LICENSE](./LICENSE).
1
+ # meta-mcp-server
2
+
3
+ > **Read-only Model Context Protocol server for Meta Business Manager.** Plug-in for AI assistants ("ChatGPT for marketing insights") that surfaces Pages, Instagram Business, Marketing API ad insights, Pixels, Commerce catalogs, and WhatsApp Business data — all read-only by construction.
4
+
5
+ [![Read-Only Verified](https://img.shields.io/badge/safety-read--only-success)](#read-only-by-construction)
6
+ [![Governance: Cashtoken SDGP](https://img.shields.io/badge/governance-cashtoken%20sdgp-blue)](./governance/standards/sdgp-main.md)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
8
+
9
+ ---
10
+
11
+ ## Why this exists
12
+
13
+ CashToken Marketing operates several Pages, Instagram Business accounts, Meta ad accounts, Pixels and (in future) Catalogs / WhatsApp Business assets across the `Hodusoft` Business Manager. Insight retrieval today is fragmented across Business Suite UIs, Ads Manager exports, and ad-hoc Graph API calls. This MCP server consolidates **read-only** access into a single tool surface that any MCP-aware AI assistant can plug into — turning fragmented UIs into one conversational interface for the marketing team.
14
+
15
+ ---
16
+
17
+ ## Read-only by construction
18
+
19
+ This server cannot write to Meta. Period. Four layers of defence:
20
+
21
+ 1. **HTTP interceptor** — every axios request passes through a guard that throws `ReadOnlyViolationError` if the method isn't `GET`, before the request leaves the process. ([`src/helpers/graph-client.ts`](./src/helpers/graph-client.ts))
22
+ 2. **No write API surface** — the `GraphClient` class exposes only `get()` and `getAllPages()`. No `post()`, `put()`, `patch()`, or `delete()` exist anywhere in `src/`.
23
+ 3. **All tools annotated** `readOnlyHint: true, destructiveHint: false` — MCP clients surface this to end users.
24
+ 4. **Belt-and-braces token scopes** (operator responsibility) — issue the system-user token with read-only scopes (`ads_read`, `pages_read_engagement`, `read_insights`, `instagram_basic`, `instagram_manage_insights`). Even if the server were compromised, the token itself cannot write. See [`ADR-20260421-Read-Only-HTTP-Enforcement.md`](./governance/project-docs/adr/ADR-20260421-Read-Only-HTTP-Enforcement.md).
25
+
26
+ Verify any time:
27
+
28
+ ```bash
29
+ npm run test:readonly
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Tools (36)
35
+
36
+ | Domain | Tools |
37
+ |---|---|
38
+ | **Discovery** (6) | `meta_token_inspect`, `meta_health_check`, `meta_graph_read`, `meta_business_list`, `meta_business_list_assets`, `meta_business_list_system_users` |
39
+ | **Ads / Marketing API** (8) | `meta_ads_list_accounts`, `meta_ads_get_account`, `meta_ads_list_campaigns`, `meta_ads_list_adsets`, `meta_ads_list_ads`, `meta_ads_get_insights` ⭐, `meta_ads_get_creative`, `meta_ads_list_custom_audiences` |
40
+ | **Pages** (7) | `meta_page_list`, `meta_page_get`, `meta_page_list_posts`, `meta_page_get_post_insights`, `meta_page_get_insights`, `meta_page_list_reviews`, `meta_page_list_videos` |
41
+ | **Instagram** (5) | `meta_ig_list_accounts`, `meta_ig_get_account`, `meta_ig_list_media`, `meta_ig_get_media_insights`, `meta_ig_get_audience_demographics` |
42
+ | **Pixels** (2) | `meta_pixel_list`, `meta_pixel_get_stats` |
43
+ | **Catalog** (3) | `meta_catalog_list`, `meta_catalog_list_products`, `meta_catalog_get_diagnostics` |
44
+ | **WhatsApp** (4) | `meta_whatsapp_list_wabas`, `meta_whatsapp_list_phone_numbers`, `meta_whatsapp_list_templates`, `meta_whatsapp_get_analytics` |
45
+ | **Eagle's-eye** (1) | `meta_business_overview` ⭐⭐⭐ — single-call consolidated snapshot across the whole business |
46
+
47
+ ---
48
+
49
+ ## Quickstart
50
+
51
+ ### 1. Install
52
+
53
+ ```bash
54
+ git clone git@github.com:feladeveloper/meta-mcp-server.git
55
+ cd meta-mcp-server
56
+ npm install
57
+ ```
58
+
59
+ ### 2. Configure environment
60
+
61
+ Copy `.env.example` → `.env` and fill in:
62
+
63
+ ```bash
64
+ META_ACCESS_TOKEN=... # System-user token (see Token Provisioning below)
65
+ META_APP_SECRET=... # App secret of the app that issued the token (Hodusoft app: 193481170220592)
66
+ META_API_VERSION=v23.0
67
+ META_CACHE_TTL_SECONDS=120
68
+ META_MAX_AUTO_PAGES=5
69
+ LOG_LEVEL=info
70
+ ```
71
+
72
+ Optional allowlists (if set, the server refuses to operate on IDs outside the allowlist):
73
+
74
+ ```bash
75
+ META_ALLOWED_BUSINESS_IDS=133767790806312
76
+ META_ALLOWED_AD_ACCOUNT_IDS=act_146517954996436,...
77
+ META_ALLOWED_PAGE_IDS=138368686823692,...
78
+ META_ALLOWED_IG_USER_IDS=17841406467396631,...
79
+ ```
80
+
81
+ ### 3. Build and run
82
+
83
+ ```bash
84
+ npm run build
85
+ node dist/index.js # stdio MCP server
86
+ ```
87
+
88
+ Or in development:
89
+
90
+ ```bash
91
+ npm run dev
92
+ ```
93
+
94
+ For an MCP Inspector session against the built server:
95
+
96
+ ```bash
97
+ npm run inspect
98
+ ```
99
+
100
+ ### 4. Wire into a client
101
+
102
+ Example (Claude Desktop or any MCP client) — fetches the published package on demand via `npx`:
103
+
104
+ ```json
105
+ {
106
+ "mcpServers": {
107
+ "meta": {
108
+ "command": "npx",
109
+ "args": ["-y", "@praise25/meta-mcp-server"],
110
+ "env": {
111
+ "META_ACCESS_TOKEN": "...",
112
+ "META_APP_SECRET": "..."
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ For a global install (`npm install -g @praise25/meta-mcp-server`), use the bin directly:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "meta": {
125
+ "command": "meta-business-manager-mcp-server",
126
+ "env": {
127
+ "META_ACCESS_TOKEN": "...",
128
+ "META_APP_SECRET": "..."
129
+ }
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ For local development against a clone of this repo:
136
+
137
+ ```json
138
+ {
139
+ "mcpServers": {
140
+ "meta": {
141
+ "command": "node",
142
+ "args": ["/absolute/path/to/meta-mcp-server/dist/index.js"],
143
+ "env": {
144
+ "META_ACCESS_TOKEN": "...",
145
+ "META_APP_SECRET": "..."
146
+ }
147
+ }
148
+ }
149
+ }
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Token Provisioning (Cashtoken-specific)
155
+
156
+ The system user `AI_Insights_Reader` (id `122093391782492654`) under the `Hodusoft` business (id `133767790806312`) is the canonical identity for this server. Procedure to issue / rotate its token:
157
+
158
+ 1. Business Settings → System Users → `AI_Insights_Reader` → **Generate New Token**
159
+ 2. Pick the **Hodusoft** app (id `193481170220592`)
160
+ 3. In the scope picker, untick everything, then tick:
161
+ - `business_management`, `ads_management` (Meta only exposes management here; server still blocks writes), `pages_read_engagement`, `pages_read_user_content`, `read_insights`, `instagram_basic`, `instagram_manage_insights`, `whatsapp_business_management`, `catalog_management`
162
+ 4. Copy the token (Meta only shows it once)
163
+ 5. Paste over `META_ACCESS_TOKEN` in `.env`
164
+ 6. Verify with `meta_health_check` and `meta_token_inspect`
165
+
166
+ Token TTL is ~60 days. Set a calendar reminder; rotation procedure documented in [`/governance/project-docs/runbook.md`](./governance/project-docs/runbook.md).
167
+
168
+ See also: [`ADR-20260421-System-User-Token-Pattern.md`](./governance/project-docs/adr/ADR-20260421-System-User-Token-Pattern.md).
169
+
170
+ ---
171
+
172
+ ## Repository layout
173
+
174
+ ```
175
+ meta-mcp-server/
176
+ ├── CLAUDE.md # AI agent rules (governance)
177
+ ├── .cursorrules # Cursor agent rules
178
+ ├── .github/
179
+ │ ├── copilot-instructions.md # Copilot agent rules
180
+ │ ├── ISSUE_TEMPLATE/
181
+ │ └── workflows/ # CI/CD (GitHub Actions, Sentinel status check)
182
+ ├── .claude/skills/ # 23 governance skills (scaffolding, review, git-ops, …)
183
+ ├── .sentinelrc # Sentinel governance plugin config
184
+ ├── CHANGELOG.md # SemVer release history
185
+ ├── README.md
186
+ ├── governance/ # Governance assets — see /governance/standards/
187
+ │ ├── standards/ # SDGP policies, coding standards
188
+ │ ├── templates/ # Doc templates (specs, ADRs, deviations, project docs)
189
+ │ └── project-docs/ # Project documents
190
+ │ ├── 1-vision-doc.md
191
+ │ ├── 2-brd.md
192
+ │ ├── 3-prd.md
193
+ │ ├── 5-tad.md
194
+ │ ├── runbook.md
195
+ │ ├── solution-doc-architecture.md
196
+ │ ├── specs/ # Feature specs
197
+ │ ├── adr/ # Architecture Decision Records
198
+ │ └── deviations/ # Governance deviation logs
199
+ ├── src/ # Implementation (see TAD)
200
+ │ ├── index.ts # stdio entrypoint
201
+ │ ├── server.ts # MCP server wiring
202
+ │ ├── config.ts # env + allowlists
203
+ │ ├── errors.ts # MetaError, ReadOnlyViolationError
204
+ │ ├── logger.ts # pino, stderr only, redacts secrets
205
+ │ ├── constants.ts
206
+ │ ├── context.ts
207
+ │ ├── helpers/
208
+ │ │ ├── graph-client.ts # GET-only axios client + retry + cache + appsecret_proof
209
+ │ │ ├── cache.ts # LRU TTL cache
210
+ │ │ ├── format.ts # JSON / Markdown response formatting
211
+ │ │ └── schema.ts # Shared Zod shapes (pagination, date presets, IDs)
212
+ │ ├── tools/ # 36 tool implementations grouped by domain
213
+ │ │ ├── token/ meta/ business/ ads/ pages/ instagram/ pixels/ catalog/ whatsapp/ overview/
214
+ │ │ ├── shared.ts # runList / runGet / errorResult helpers
215
+ │ │ └── register.ts # Centralized tool registration
216
+ │ └── types/
217
+ └── tests/
218
+ └── read-only-guard.mjs # Runtime proof that POST/PUT/PATCH/DELETE are blocked
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Governance
224
+
225
+ This project is initialized from the [`cashtokenrewards/project-governance-template`](https://github.com/cashtokenrewards/project-governance-template) and follows the **Software Development Governance Policy (SDGP)** in [`/governance/standards/sdgp-main.md`](./governance/standards/sdgp-main.md).
226
+
227
+ **Three absolute rules:**
228
+ 1. No feature is built without an approved spec. ([`/governance/project-docs/specs/`](./governance/project-docs/specs/))
229
+ 2. No ADR is written without a parent feature spec. ([`/governance/project-docs/adr/`](./governance/project-docs/adr/))
230
+ 3. No implementation begins without the spec and all required ADRs approved.
231
+
232
+ The current implementation (commit zero) was bootstrapped against an initial pass of governance docs:
233
+
234
+ | Doc | Path |
235
+ |---|---|
236
+ | Vision | [`governance/project-docs/1-vision-doc.md`](./governance/project-docs/1-vision-doc.md) |
237
+ | BRD | [`governance/project-docs/2-brd.md`](./governance/project-docs/2-brd.md) |
238
+ | PRD | [`governance/project-docs/3-prd.md`](./governance/project-docs/3-prd.md) |
239
+ | TAD | [`governance/project-docs/5-tad.md`](./governance/project-docs/5-tad.md) |
240
+ | Runbook | [`governance/project-docs/runbook.md`](./governance/project-docs/runbook.md) |
241
+ | Specs | [`governance/project-docs/specs/`](./governance/project-docs/specs/) |
242
+ | ADRs | [`governance/project-docs/adr/`](./governance/project-docs/adr/) |
243
+ | Deviations | [`governance/project-docs/deviations/`](./governance/project-docs/deviations/) |
244
+
245
+ **Branch model:** Gitflow. `main` (production), `dev` (integration). Short-lived branches: `feature-`, `fix-`, `release-`, `hotfix-`, `docs-`. All merges `--no-ff`. See [`/governance/standards/sdgp-main.md`](./governance/standards/sdgp-main.md) §7.4.
246
+
247
+ **AI agent rules:** [`CLAUDE.md`](./CLAUDE.md), [`.cursorrules`](./.cursorrules), [`.github/copilot-instructions.md`](./.github/copilot-instructions.md). Sentinel keeps these in sync with the central governance config.
248
+
249
+ ---
250
+
251
+ ## Sentinel
252
+
253
+ This repository is tracked by the [Sentinel governance plugin](https://github.com/feladeveloper/sentinel-claude-plugin). Configuration lives at [`.sentinelrc`](./.sentinelrc). On any clone:
254
+
255
+ ```bash
256
+ export SENTINEL_GITHUB_TOKEN="ghp_..." # Personal access token with repo:read
257
+ sentinel sync # Pull latest org-level governance into CLAUDE.md
258
+ ```
259
+
260
+ `/sentinel-sync` and `/sentinel-status` slash commands are also available inside Claude Code once the plugin is installed.
261
+
262
+ ---
263
+
264
+ ## Scripts
265
+
266
+ | Script | What it does |
267
+ |---|---|
268
+ | `npm run build` | Clean + compile TypeScript → `dist/` |
269
+ | `npm run dev` | Run with `tsx` (no build step) |
270
+ | `npm run start` | Run built `dist/index.js` |
271
+ | `npm run inspect` | Build + open MCP Inspector |
272
+ | `npm run check:types` | `tsc --noEmit` |
273
+ | `npm run test:readonly` | Build + runtime proof that POST/PUT/PATCH/DELETE are blocked by the Graph client |
274
+ | `npm test` | (placeholder for jest suite — see [`SPEC-07-eval-suite.md`](./governance/project-docs/specs/) when added) |
275
+
276
+ ---
277
+
278
+ ## Status
279
+
280
+ | Aspect | State |
281
+ |---|---|
282
+ | Implementation | **v0.1.0 — bootstrapped, 36 tools, build clean, read-only guard verified** |
283
+ | Governance docs | Initial pass — Vision / BRD / PRD / TAD / Runbook / 3 ADRs / 1 deviation drafted |
284
+ | App-level (Meta) | Hodusoft app in **development tier** for Marketing API. Standard Access via App Review pending. |
285
+ | Asset coverage | All 3 Pages discoverable; 1 Page (CashToken) currently assigned to AI_Insights_Reader; 5 ad accounts visible; 3 Pixels visible; 1 IG (cashtokenhq) discovered via Page link |
286
+ | Open scopes | `read_insights`, `instagram_manage_insights`, `whatsapp_business_management`, `catalog_management` may need to be added to the Hodusoft app before they appear in the token picker |
287
+
288
+ ---
289
+
290
+ ## License
291
+
292
+ MIT — see [LICENSE](./LICENSE).