titan-email-mcp 1.0.2 → 1.0.3

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 +13 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24,8 +24,8 @@ if (!preset) {
24
24
  }
25
25
  const activePreset = preset ?? PROVIDER_PRESETS.titan;
26
26
  const cfg = {
27
- user: req("TITAN_EMAIL"),
28
- pass: req("TITAN_PASSWORD"),
27
+ user: process.env.TITAN_EMAIL ?? "",
28
+ pass: process.env.TITAN_PASSWORD ?? "",
29
29
  provider: preset ? providerName : "titan",
30
30
  imapHost: process.env.TITAN_IMAP_HOST ?? activePreset.imapHost,
31
31
  imapPort: Number(process.env.TITAN_IMAP_PORT ?? activePreset.imapPort),
@@ -36,16 +36,20 @@ const cfg = {
36
36
  sentFolder: process.env.TITAN_SENT_FOLDER ?? "Sent",
37
37
  draftsFolder: process.env.TITAN_DRAFTS_FOLDER ?? "Drafts",
38
38
  };
39
- function req(name) {
40
- const v = process.env[name];
41
- if (!v) {
42
- console.error(`Missing required env var ${name}. Set TITAN_EMAIL and TITAN_PASSWORD in your MCP client's server config — see README.md for examples.`);
43
- process.exit(1);
39
+ // Tool schemas register unconditionally below, regardless of credentials, so clients
40
+ // and directory crawlers can list this server's capabilities without live creds.
41
+ // Credentials are only required once a tool actually tries to touch the mailbox.
42
+ if (!cfg.user || !cfg.pass) {
43
+ console.error("TITAN_EMAIL / TITAN_PASSWORD not set — tools are registered but will return an error until both are configured in your MCP client's server config.");
44
+ }
45
+ function ensureCreds() {
46
+ if (!cfg.user || !cfg.pass) {
47
+ throw new Error("Missing TITAN_EMAIL and/or TITAN_PASSWORD. Set both in your MCP client's server config — see README.md for examples.");
44
48
  }
45
- return v;
46
49
  }
47
50
  // ---------- helpers ----------
48
51
  async function withImap(fn) {
52
+ ensureCreds();
49
53
  const client = new ImapFlow({
50
54
  host: cfg.imapHost,
51
55
  port: cfg.imapPort,
@@ -280,6 +284,7 @@ server.registerTool("send_email", {
280
284
  if (!cfg.allowSend)
281
285
  return fail("Sending is disabled (TITAN_ALLOW_SEND=false). Use save_draft instead.");
282
286
  try {
287
+ ensureCreds();
283
288
  const mail = { from: fromAddr(), to: a.to, cc: a.cc, bcc: a.bcc, subject: a.subject, text: a.body, html: a.html };
284
289
  const info = await smtp.sendMail(mail);
285
290
  await appendCopy(cfg.sentFolder, await buildRaw({ ...mail, messageId: info.messageId }), ["\\Seen"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "titan-email-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "MCP server that connects Claude (or any MCP client) to a Titan Email mailbox over IMAP/SMTP — including Titan accounts resold through GoDaddy.",
5
5
  "mcpName": "io.github.qmmughal/titan-email-mcp",
6
6
  "main": "dist/index.js",