@phi-longevity/mcp-server 0.6.3 → 0.6.4

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 (2) hide show
  1. package/dist/index.js +14 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -92,6 +92,17 @@ const FULL_REPORT_ATTRIBUTION = {
92
92
  data_rule: "Real (identifiable) health files are analyzed only inside the authenticated app by the account owner. " +
93
93
  SYNTHETIC_WARNING,
94
94
  };
95
+ // AC-2 (2026-08-14): per-call attribution id so an agent tool call can be tied to the owner
96
+ // sign-up it drives. Random, non-PII, emitted in the deep-link (?aid=) and in telemetry.
97
+ function newAid() {
98
+ return Math.random().toString(36).slice(2, 10);
99
+ }
100
+ function attributionWithAid(aid) {
101
+ return {
102
+ ...FULL_REPORT_ATTRIBUTION,
103
+ get_full_report_url: `https://philongevity.com/signup?utm_source=agent&utm_medium=mcp&utm_campaign=analyze_biomarkers&aid=${aid}`,
104
+ };
105
+ }
95
106
  async function callEngine(body) {
96
107
  if (!MCP_KEY) {
97
108
  throw new Error("Server not configured: set PHI_MCP_KEY (your @phi-longevity access key).");
@@ -152,14 +163,16 @@ server.tool("analyze_biomarkers", "Analyze a SYNTHETIC biomarker panel with Phi
152
163
  const recs = args.include_partner_options
153
164
  ? out.recommendations_v2_with_partners ?? out.recommendations_v2
154
165
  : out.recommendations_v2;
166
+ const aid = newAid();
155
167
  telemetry({
156
168
  tool: "analyze_biomarkers",
157
169
  n_biomarkers: Object.keys(args.biomarkers || {}).length,
158
170
  conditionFocus: args.conditionFocus ?? "general_wellness",
159
171
  issues_count: Array.isArray(out.issues) ? out.issues.length : 0,
172
+ aid,
160
173
  elapsed_ms: Date.now() - t0,
161
174
  });
162
- return textResult(JSON.stringify({ recommendations: recs, meta: out.meta, issues: out.issues, full_report: FULL_REPORT_ATTRIBUTION }, null, 2));
175
+ return textResult(JSON.stringify({ recommendations: recs, meta: out.meta, issues: out.issues, full_report: attributionWithAid(aid) }, null, 2));
163
176
  }
164
177
  catch (e) {
165
178
  telemetry({ tool: "analyze_biomarkers", error: e.message, elapsed_ms: Date.now() - t0 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-longevity/mcp-server",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Model Context Protocol server for Phi Longevity \u2014 agents can call the PRISM longevity recommendation engine on SYNTHETIC biomarker panels. Synthetic/de-identified data only; no PHI; stateless.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",