evipedia-mcp-dev 0.1.0
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/LICENSE +9 -0
- package/README.md +11 -0
- package/dist/index.js +110 -0
- package/package.json +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Forever Healthy Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including, without limitation, the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# evipedia-mcp-dev
|
|
2
|
+
|
|
3
|
+
**Internal development build. Not for public use.**
|
|
4
|
+
|
|
5
|
+
This package is used for internal testing of the evipedia MCP server. It may
|
|
6
|
+
change or break at any time.
|
|
7
|
+
|
|
8
|
+
The public release lives at:
|
|
9
|
+
|
|
10
|
+
- npm: [`evipedia-mcp`](https://www.npmjs.com/package/evipedia-mcp)
|
|
11
|
+
- GitHub: [forever-healthy/evipedia-mcp](https://github.com/forever-healthy/evipedia-mcp)
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var BASE_URL = (process.env.EVIPEDIA_BASE_URL ?? "https://evipedia.ai").replace(/\/$/, "");
|
|
8
|
+
var SUGGEST_ENDPOINT = process.env.EVIPEDIA_SUGGEST_ENDPOINT ?? "https://formspree.io/f/myknrvdg";
|
|
9
|
+
var CACHE_TTL = 5 * 60 * 1e3;
|
|
10
|
+
var cache = /* @__PURE__ */ new Map();
|
|
11
|
+
async function fetchCached(url) {
|
|
12
|
+
const now = Date.now();
|
|
13
|
+
const entry = cache.get(url);
|
|
14
|
+
if (entry && now - entry.ts < CACHE_TTL) return entry.data;
|
|
15
|
+
const res = await fetch(url);
|
|
16
|
+
if (!res.ok) throw new Error(`HTTP ${res.status} fetching ${url}`);
|
|
17
|
+
const data = await res.json();
|
|
18
|
+
cache.set(url, { data, ts: now });
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function toSlug(input) {
|
|
22
|
+
const path = input.startsWith("http") ? new URL(input).pathname : input;
|
|
23
|
+
return path.replace(/\.md$/, "").replace(/^\//, "");
|
|
24
|
+
}
|
|
25
|
+
var server = new McpServer({ name: "evipedia-mcp", version: "0.1.0" });
|
|
26
|
+
server.tool(
|
|
27
|
+
"search_reviews",
|
|
28
|
+
"Search evipedia.ai evidence reviews by name, synonym, keyword, or category. Returns matching reviews with their permalinks and conclusions.",
|
|
29
|
+
{ query: z.string().describe("Search query \u2014 intervention name, synonym, drug class, or category") },
|
|
30
|
+
async ({ query }) => {
|
|
31
|
+
const [searchIndex, reviewsIndex] = await Promise.all([
|
|
32
|
+
fetchCached(`${BASE_URL}/search.json`),
|
|
33
|
+
fetchCached(`${BASE_URL}/reviews.json`)
|
|
34
|
+
]);
|
|
35
|
+
const q = query.toLowerCase();
|
|
36
|
+
const bySlug = new Map(reviewsIndex.map((r) => [toSlug(r.permalink).toLowerCase(), r]));
|
|
37
|
+
const has = (v) => (v ?? "").toLowerCase().includes(q);
|
|
38
|
+
const matches = searchIndex.filter(
|
|
39
|
+
(e) => has(e.short_topic) || has(e.alternate_names) || has(e.ep_keywords) || has(e.ep_category)
|
|
40
|
+
);
|
|
41
|
+
if (matches.length === 0) {
|
|
42
|
+
return { content: [{ type: "text", text: "No reviews found." }] };
|
|
43
|
+
}
|
|
44
|
+
const text = matches.slice(0, 20).map((e) => {
|
|
45
|
+
const r = bySlug.get(toSlug(e.url).toLowerCase());
|
|
46
|
+
return r ? `**${r.canonical_name}** \u2014 ${r.permalink}
|
|
47
|
+
${r.er_conclusion}` : `**${e.short_topic}** \u2014 ${e.url}`;
|
|
48
|
+
}).join("\n\n---\n\n");
|
|
49
|
+
return { content: [{ type: "text", text }] };
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
server.tool(
|
|
53
|
+
"get_review",
|
|
54
|
+
"Get the full evidence review as raw Markdown.",
|
|
55
|
+
{ permalink: z.string().describe("Review slug (e.g. 'rapamycin') or full URL") },
|
|
56
|
+
async ({ permalink }) => {
|
|
57
|
+
const slug = toSlug(permalink);
|
|
58
|
+
const res = await fetch(`${BASE_URL}/${slug}.md`);
|
|
59
|
+
if (!res.ok) throw new Error(`Review not found: ${slug}`);
|
|
60
|
+
const text = await res.text();
|
|
61
|
+
return { content: [{ type: "text", text }] };
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
server.tool(
|
|
65
|
+
"get_conclusion",
|
|
66
|
+
"Get just the plain-text conclusion of an evidence review.",
|
|
67
|
+
{ permalink: z.string().describe("Review slug (e.g. 'rapamycin') or full URL") },
|
|
68
|
+
async ({ permalink }) => {
|
|
69
|
+
const slug = toSlug(permalink);
|
|
70
|
+
const reviews = await fetchCached(`${BASE_URL}/reviews.json`);
|
|
71
|
+
const review = reviews.find((r) => toSlug(r.permalink) === slug);
|
|
72
|
+
if (!review) throw new Error(`Review not found: ${slug}`);
|
|
73
|
+
return { content: [{ type: "text", text: review.er_conclusion }] };
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
server.tool(
|
|
77
|
+
"suggest_intervention",
|
|
78
|
+
"Suggest a new intervention for evipedia.ai to review. Submits to evipedia's public suggestion form (the same one at evipedia.ai/suggest). Use only when the user explicitly wants to propose a new intervention \u2014 this sends a message to the evipedia team.",
|
|
79
|
+
{
|
|
80
|
+
intervention: z.string().min(1).describe("Name of the intervention to suggest (e.g. 'Urolithin A')"),
|
|
81
|
+
goal: z.string().optional().describe("Optional health or longevity goal the intervention targets"),
|
|
82
|
+
references: z.string().optional().describe("Optional supporting references or links"),
|
|
83
|
+
email: z.string().email().optional().describe("Optional submitter email, so the evipedia team can follow up")
|
|
84
|
+
},
|
|
85
|
+
async ({ intervention, goal, references, email }) => {
|
|
86
|
+
const clean = (s) => s.replace(/[^a-zA-Z0-9\s\-]/g, "").trim();
|
|
87
|
+
const subject = goal ? `${clean(intervention)} : ${clean(goal)}` : clean(intervention);
|
|
88
|
+
const payload = { intervention, subject, tags: "SUGGEST-NEW" };
|
|
89
|
+
if (goal) payload.goal = goal;
|
|
90
|
+
if (references) payload.references = references;
|
|
91
|
+
if (email) payload.email = email;
|
|
92
|
+
const res = await fetch(SUGGEST_ENDPOINT, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
95
|
+
body: JSON.stringify(payload)
|
|
96
|
+
});
|
|
97
|
+
if (!res.ok) {
|
|
98
|
+
const detail = await res.text().catch(() => "");
|
|
99
|
+
throw new Error(`Suggestion failed: HTTP ${res.status}${detail ? ` \u2014 ${detail}` : ""}`);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
content: [{
|
|
103
|
+
type: "text",
|
|
104
|
+
text: `Suggestion submitted: "${intervention}"${goal ? ` (goal: ${goal})` : ""}. Thanks \u2014 the evipedia team will review it.`
|
|
105
|
+
}]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
var transport = new StdioServerTransport();
|
|
110
|
+
await server.connect(transport);
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "evipedia-mcp-dev",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Internal development build of evipedia-mcp. Not for public use.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"evipedia-mcp-dev": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
17
|
+
"zod": "^3.0.0"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"private": false
|
|
21
|
+
}
|