fastmail-mcp-server 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 +21 -0
- package/README.md +171 -0
- package/package.json +46 -0
- package/src/index.ts +525 -0
- package/src/jmap/client.ts +149 -0
- package/src/jmap/methods.ts +500 -0
- package/src/jmap/types.ts +198 -0
- package/src/test.ts +69 -0
package/src/test.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
const transport = new StdioClientTransport({
|
|
7
|
+
command: "bun",
|
|
8
|
+
args: ["run", "src/index.ts"],
|
|
9
|
+
env: {
|
|
10
|
+
...process.env,
|
|
11
|
+
FASTMAIL_API_TOKEN: process.env.FASTMAIL_API_TOKEN || "",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const client = new Client({ name: "fastmail-test", version: "1.0.0" });
|
|
16
|
+
await client.connect(transport);
|
|
17
|
+
|
|
18
|
+
console.log("Connected to Fastmail MCP server\n");
|
|
19
|
+
|
|
20
|
+
// Test 1: List mailboxes
|
|
21
|
+
console.log("=== Test: list_mailboxes ===");
|
|
22
|
+
try {
|
|
23
|
+
const result = await client.callTool({
|
|
24
|
+
name: "list_mailboxes",
|
|
25
|
+
arguments: {},
|
|
26
|
+
});
|
|
27
|
+
const text = (result.content as Array<{ text: string }>)[0]?.text ?? "";
|
|
28
|
+
console.log(text.slice(0, 500) + (text.length > 500 ? "..." : ""));
|
|
29
|
+
console.log("✓ list_mailboxes works\n");
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.log("✗ list_mailboxes failed:", e);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Test 2: List emails in inbox
|
|
35
|
+
console.log("=== Test: list_emails (inbox, limit 3) ===");
|
|
36
|
+
try {
|
|
37
|
+
const result = await client.callTool({
|
|
38
|
+
name: "list_emails",
|
|
39
|
+
arguments: { mailbox: "inbox", limit: 3 },
|
|
40
|
+
});
|
|
41
|
+
const text = (result.content as Array<{ text: string }>)[0]?.text ?? "";
|
|
42
|
+
console.log(text.slice(0, 800) + (text.length > 800 ? "..." : ""));
|
|
43
|
+
console.log("✓ list_emails works\n");
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.log("✗ list_emails failed:", e);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Test 3: Search
|
|
49
|
+
console.log("=== Test: search_emails ===");
|
|
50
|
+
try {
|
|
51
|
+
const result = await client.callTool({
|
|
52
|
+
name: "search_emails",
|
|
53
|
+
arguments: { query: "test", limit: 2 },
|
|
54
|
+
});
|
|
55
|
+
const text = (result.content as Array<{ text: string }>)[0]?.text ?? "";
|
|
56
|
+
console.log(text.slice(0, 500) + (text.length > 500 ? "..." : ""));
|
|
57
|
+
console.log("✓ search_emails works\n");
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.log("✗ search_emails failed:", e);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
await client.close();
|
|
63
|
+
console.log("\n=== All tests completed ===");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
main().catch((e) => {
|
|
67
|
+
console.error("Test failed:", e);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|