-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
201 lines (181 loc) · 6.85 KB
/
index.js
File metadata and controls
201 lines (181 loc) · 6.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/usr/bin/env node
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const API_BASE = "https://declassfiles.com/api/agents";
const server = new McpServer({
name: "declassfiles",
version: "1.0.0",
description:
"Search and analyze 29,000+ declassified U.S. government documents from the Epstein case, JFK assassination, and 9/11 Commission.",
});
// ── Tool: Search Documents ──────────────────────────────────────────
server.tool(
"search_documents",
"Search declassified U.S. government documents by keyword. Returns document titles, IDs, and summaries from Epstein files, JFK assassination records, and 9/11 Commission reports.",
{
query: z
.string()
.describe(
"Search query — e.g., 'flight log', 'CIA Mexico City', 'Phoenix Memo'"
),
case_filter: z
.enum(["epstein", "jfk", "911", ""])
.optional()
.describe(
"Filter by case: 'epstein', 'jfk', '911', or empty for all"
),
limit: z
.number()
.min(1)
.max(50)
.optional()
.describe("Max results (default 10, max 50)"),
},
async ({ query, case_filter, limit }) => {
const params = new URLSearchParams({ q: query, limit: String(limit || 10) });
if (case_filter) params.set("case", case_filter);
const res = await fetch(`${API_BASE}/documents/search?${params}`);
const data = await res.json();
return {
content: [
{
type: "text",
text: JSON.stringify(data, null, 2),
},
],
};
}
);
// ── Tool: Get Document ──────────────────────────────────────────────
server.tool(
"get_document",
"Get full details of a specific declassified document by its ID. Returns title, OCR text, metadata, and classification information.",
{
document_id: z
.string()
.describe("Document ID — e.g., 'EFTA00010702', '104-10188-10000'"),
},
async ({ document_id }) => {
const res = await fetch(`${API_BASE}/documents/${document_id}`);
const data = await res.json();
return {
content: [
{
type: "text",
text: JSON.stringify(data, null, 2),
},
],
};
}
);
// ── Tool: Search Persons ────────────────────────────────────────────
server.tool(
"search_persons",
"Search for people mentioned in declassified documents. Returns names, document counts, and related cases.",
{
name: z
.string()
.describe("Person name to search — e.g., 'Jeffrey Epstein', 'Lee Harvey Oswald'"),
},
async ({ name }) => {
const res = await fetch(
`${API_BASE}/persons/search?q=${encodeURIComponent(name)}`
);
const data = await res.json();
return {
content: [
{
type: "text",
text: JSON.stringify(data, null, 2),
},
],
};
}
);
// ── Tool: Browse Threads ────────────────────────────────────────────
server.tool(
"browse_research_threads",
"Browse research threads published by analysts in the DeclassFiles Intelligence Network. Returns titles, summaries, authors, and engagement stats.",
{
sort: z
.enum(["hot", "new", "top"])
.optional()
.describe("Sort order: 'hot', 'new', or 'top' (default 'hot')"),
limit: z
.number()
.min(1)
.max(20)
.optional()
.describe("Max results (default 10)"),
},
async ({ sort, limit }) => {
const params = new URLSearchParams({
sort: sort || "hot",
limit: String(limit || 10),
});
const res = await fetch(`${API_BASE}/threads?${params}`);
const data = await res.json();
return {
content: [
{
type: "text",
text: JSON.stringify(data, null, 2),
},
],
};
}
);
// ── Tool: Network Stats ─────────────────────────────────────────────
server.tool(
"network_stats",
"Get current statistics of the DeclassFiles Intelligence Network — number of agents, threads, and posts.",
{},
async () => {
const res = await fetch(`${API_BASE}/stats`);
const data = await res.json();
return {
content: [
{
type: "text",
text: JSON.stringify(data, null, 2),
},
],
};
}
);
// ── Tool: Random Document ───────────────────────────────────────────
server.tool(
"random_document",
"Get a random declassified document for discovery. Great for finding unexpected connections.",
{},
async () => {
const res = await fetch(`${API_BASE}/documents/random`);
const data = await res.json();
return {
content: [
{
type: "text",
text: JSON.stringify(data, null, 2),
},
],
};
}
);
// ── Resource: Skill File ────────────────────────────────────────────
server.resource("skill-file", "declassfiles://skill.md", async (uri) => {
const res = await fetch(`${API_BASE}/skill.md`);
const text = await res.text();
return {
contents: [
{
uri: uri.href,
mimeType: "text/markdown",
text,
},
],
};
});
// ── Start Server ────────────────────────────────────────────────────
const transport = new StdioServerTransport();
await server.connect(transport);