@inboxapi/cli 0.2.17 → 0.2.19
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/claude/hooks/credential-check.js +65 -0
- package/claude/hooks/email-activity-logger.js +84 -0
- package/claude/hooks/email-send-guard.js +69 -0
- package/claude/skills/check-inbox/SKILL.md +39 -0
- package/claude/skills/compose/SKILL.md +53 -0
- package/claude/skills/email-digest/SKILL.md +58 -0
- package/claude/skills/email-forward/SKILL.md +53 -0
- package/claude/skills/email-reply/SKILL.md +54 -0
- package/claude/skills/email-search/SKILL.md +41 -0
- package/claude/skills/setup-inboxapi/SKILL.md +67 -0
- package/package.json +9 -8
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// InboxAPI Credential Check — SessionStart hook
|
|
3
|
+
// Verifies InboxAPI credentials are present and valid on session startup.
|
|
4
|
+
// Always exits 0 (non-blocking, informational only)
|
|
5
|
+
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function findCredentials() {
|
|
11
|
+
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
12
|
+
if (!home) return null;
|
|
13
|
+
const candidates = [];
|
|
14
|
+
|
|
15
|
+
// Platform config dir
|
|
16
|
+
if (process.platform === "darwin") {
|
|
17
|
+
candidates.push(
|
|
18
|
+
path.join(home, "Library", "Application Support", "inboxapi", "credentials.json"),
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
if (process.platform === "win32") {
|
|
22
|
+
const appData = process.env.APPDATA || "";
|
|
23
|
+
const localAppData = process.env.LOCALAPPDATA || "";
|
|
24
|
+
if (appData) candidates.push(path.join(appData, "inboxapi", "credentials.json"));
|
|
25
|
+
if (localAppData) candidates.push(path.join(localAppData, "inboxapi", "credentials.json"));
|
|
26
|
+
}
|
|
27
|
+
candidates.push(path.join(home, ".config", "inboxapi", "credentials.json"));
|
|
28
|
+
candidates.push(
|
|
29
|
+
path.join(home, ".local", "inboxapi", "credentials.json"),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
for (const p of candidates) {
|
|
33
|
+
if (fs.existsSync(p)) {
|
|
34
|
+
return p;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function main() {
|
|
41
|
+
const credPath = findCredentials();
|
|
42
|
+
|
|
43
|
+
if (!credPath) {
|
|
44
|
+
process.stderr.write(
|
|
45
|
+
"\n[InboxAPI] No credentials found. Run `npx -y @inboxapi/cli login` to authenticate.\n\n",
|
|
46
|
+
);
|
|
47
|
+
process.exit(0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const creds = JSON.parse(fs.readFileSync(credPath, "utf8"));
|
|
52
|
+
const email = creds.email || creds.account_name || "(unknown)";
|
|
53
|
+
process.stderr.write(
|
|
54
|
+
`\n[InboxAPI] Authenticated as: ${email}\n\n`,
|
|
55
|
+
);
|
|
56
|
+
} catch {
|
|
57
|
+
process.stderr.write(
|
|
58
|
+
"\n[InboxAPI] Credentials file exists but could not be read. Run `npx -y @inboxapi/cli login` to re-authenticate.\n\n",
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// InboxAPI Activity Logger — PostToolUse hook
|
|
3
|
+
// Logs all InboxAPI MCP tool usage to .claude/inboxapi-activity.log
|
|
4
|
+
// Always exits 0 (non-blocking)
|
|
5
|
+
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
|
+
function main() {
|
|
10
|
+
const input = fs.readFileSync(0, "utf8");
|
|
11
|
+
let data;
|
|
12
|
+
try {
|
|
13
|
+
data = JSON.parse(input);
|
|
14
|
+
} catch {
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const toolName = data.tool_name || "";
|
|
19
|
+
const toolInput = data.tool_input || {};
|
|
20
|
+
const cwd = data.cwd || process.cwd();
|
|
21
|
+
|
|
22
|
+
// Only log inboxapi tools
|
|
23
|
+
if (!toolName.includes("inboxapi")) {
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const timestamp = new Date().toISOString();
|
|
28
|
+
const shortName = toolName.replace("mcp__inboxapi__", "");
|
|
29
|
+
|
|
30
|
+
// Build a concise log entry (logs identifiers and lengths, not email content)
|
|
31
|
+
let details = "";
|
|
32
|
+
switch (shortName) {
|
|
33
|
+
case "send_email": {
|
|
34
|
+
const toVal = toolInput.to;
|
|
35
|
+
const toCount = Array.isArray(toVal) ? toVal.length : toVal ? 1 : 0;
|
|
36
|
+
details = `to_count=${toCount}, subject_length=${(toolInput.subject || "").length}, body_length=${(toolInput.body || "").length}`;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case "send_reply":
|
|
40
|
+
details = `in_reply_to=${toolInput.in_reply_to || "?"}, body_length=${(toolInput.body || "").length}`;
|
|
41
|
+
break;
|
|
42
|
+
case "forward_email": {
|
|
43
|
+
const fwdTo = toolInput.to;
|
|
44
|
+
const fwdCount = Array.isArray(fwdTo) ? fwdTo.length : fwdTo ? 1 : 0;
|
|
45
|
+
details = `message_id=${toolInput.message_id || "?"}, to_count=${fwdCount}`;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "get_email":
|
|
49
|
+
details = `index=${toolInput.index ?? "?"}, message_id=${toolInput.message_id || "?"}`;
|
|
50
|
+
break;
|
|
51
|
+
case "get_emails":
|
|
52
|
+
details = `limit=${toolInput.limit || "default"}`;
|
|
53
|
+
break;
|
|
54
|
+
case "search_emails":
|
|
55
|
+
details = `query_length=${(toolInput.query || toolInput.subject || toolInput.sender || "").length}`;
|
|
56
|
+
break;
|
|
57
|
+
case "get_thread":
|
|
58
|
+
details = `message_id=${toolInput.message_id || "?"}`;
|
|
59
|
+
break;
|
|
60
|
+
default: {
|
|
61
|
+
const keys = toolInput && typeof toolInput === "object" ? Object.keys(toolInput) : [];
|
|
62
|
+
details = keys.length ? `fields=${keys.join(",")}` : "fields=<none>";
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const logLine = `[${timestamp}] ${shortName}: ${details}\n`;
|
|
68
|
+
|
|
69
|
+
// Write to log file
|
|
70
|
+
const logPath = path.join(cwd, ".claude", "inboxapi-activity.log");
|
|
71
|
+
try {
|
|
72
|
+
const logDir = path.dirname(logPath);
|
|
73
|
+
if (!fs.existsSync(logDir)) {
|
|
74
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
75
|
+
}
|
|
76
|
+
fs.appendFileSync(logPath, logLine);
|
|
77
|
+
} catch {
|
|
78
|
+
// Non-critical — don't fail the tool call
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
process.exit(0);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
main();
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// InboxAPI Email Send Guard — PreToolUse hook
|
|
3
|
+
// Reviews outbound emails before sending. Logs details to stderr for user visibility.
|
|
4
|
+
// Exit 0 = allow
|
|
5
|
+
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
|
|
8
|
+
function main() {
|
|
9
|
+
const input = fs.readFileSync(0, "utf8");
|
|
10
|
+
let data;
|
|
11
|
+
try {
|
|
12
|
+
data = JSON.parse(input);
|
|
13
|
+
} catch {
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const toolName = data.tool_name || "";
|
|
18
|
+
const toolInput = data.tool_input || {};
|
|
19
|
+
|
|
20
|
+
// Only inspect send-related tools
|
|
21
|
+
if (
|
|
22
|
+
!toolName.includes("send_email") &&
|
|
23
|
+
!toolName.includes("send_reply") &&
|
|
24
|
+
!toolName.includes("forward_email")
|
|
25
|
+
) {
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const rawTo = toolInput.to || toolInput.recipient || "(unknown)";
|
|
30
|
+
const toList = Array.isArray(rawTo) ? rawTo : [rawTo];
|
|
31
|
+
const toDisplay = toList.join(", ");
|
|
32
|
+
const subject = toolInput.subject || "(no subject)";
|
|
33
|
+
const body = toolInput.body || toolInput.message || "";
|
|
34
|
+
const action = toolName.includes("forward")
|
|
35
|
+
? "FORWARD"
|
|
36
|
+
: toolName.includes("reply")
|
|
37
|
+
? "REPLY"
|
|
38
|
+
: "SEND";
|
|
39
|
+
|
|
40
|
+
// Log details to stderr so the user sees them in the Claude Code UI
|
|
41
|
+
process.stderr.write(`\n[InboxAPI Send Guard] ${action}\n`);
|
|
42
|
+
process.stderr.write(` To: ${toDisplay}\n`);
|
|
43
|
+
process.stderr.write(` Subject: ${subject}\n`);
|
|
44
|
+
if (body.length > 0) {
|
|
45
|
+
const preview = body.length > 200 ? body.substring(0, 200) + "..." : body;
|
|
46
|
+
process.stderr.write(` Body: ${preview}\n`);
|
|
47
|
+
}
|
|
48
|
+
process.stderr.write("\n");
|
|
49
|
+
|
|
50
|
+
// Check for self-send (common AI agent mistake)
|
|
51
|
+
const hasInboxApiRecipient = toList.some(
|
|
52
|
+
(addr) => typeof addr === "string" && (addr.includes("@inboxapi.ai") || addr.includes("@inboxapi.com")),
|
|
53
|
+
);
|
|
54
|
+
if (hasInboxApiRecipient) {
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
` [WARNING] Recipient is an @inboxapi address. Did you mean to send to an external address?\n\n`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Check for empty body
|
|
61
|
+
if (body.trim().length === 0) {
|
|
62
|
+
process.stderr.write(` [WARNING] Email body is empty.\n\n`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Allow by default — the user sees the preview and can deny via Claude Code's permission prompt
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: check-inbox
|
|
3
|
+
description: Check your InboxAPI email inbox and display a summary of recent messages. Use when the user wants to see their emails, check mail, or view their inbox.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: [limit]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Check Inbox
|
|
9
|
+
|
|
10
|
+
Fetch and display a summary of recent emails from the user's InboxAPI inbox.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. Call the `mcp__inboxapi__whoami` tool to identify the current account and email address
|
|
15
|
+
2. Call `mcp__inboxapi__get_email_count` to show the total number of emails
|
|
16
|
+
3. Call `mcp__inboxapi__get_emails` with:
|
|
17
|
+
- `limit`: Use `$ARGUMENTS` if provided, otherwise default to `20`
|
|
18
|
+
4. Present results in a formatted table with columns:
|
|
19
|
+
- **From** — sender name or address
|
|
20
|
+
- **Subject** — email subject line (truncated to 60 chars)
|
|
21
|
+
- **Date** — received date in relative format (e.g., "2 hours ago", "yesterday")
|
|
22
|
+
5. After the table, show a summary line: "Showing X of Y emails for <email>"
|
|
23
|
+
|
|
24
|
+
## Output Format
|
|
25
|
+
|
|
26
|
+
Use this markdown table format:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
| # | From | Subject | Date |
|
|
30
|
+
|---|------|---------|------|
|
|
31
|
+
| 1 | Alice <alice@example.com> | Re: Project update... | 2h ago |
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If the inbox is empty, display: "Your inbox is empty. Your email address is <email>."
|
|
35
|
+
|
|
36
|
+
## Notes
|
|
37
|
+
|
|
38
|
+
- Do NOT read full email bodies — only show the summary list
|
|
39
|
+
- If the user asks to read a specific email after seeing the list, use `mcp__inboxapi__get_email` with the email ID
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: compose
|
|
3
|
+
description: Compose and send an email with guided prompts, addressbook lookup, and send confirmation. Use when the user wants to write and send an email.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: [recipient]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Compose Email
|
|
10
|
+
|
|
11
|
+
Guide the user through composing and sending an email safely.
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. **Identify sender**: Call `mcp__inboxapi__whoami` to get the current account email address
|
|
16
|
+
|
|
17
|
+
2. **Resolve recipient**:
|
|
18
|
+
- If `$ARGUMENTS` is provided, use it as the recipient hint
|
|
19
|
+
- Call `mcp__inboxapi__get_addressbook` to check for matching contacts
|
|
20
|
+
- If multiple matches found, ask the user to pick one
|
|
21
|
+
- If no match, ask the user to confirm or provide the full email address
|
|
22
|
+
|
|
23
|
+
3. **Collect email details**: Ask the user for:
|
|
24
|
+
- **To**: Recipient email (pre-filled if resolved above)
|
|
25
|
+
- **Subject**: Email subject line
|
|
26
|
+
- **Body**: Email content (plain text)
|
|
27
|
+
|
|
28
|
+
4. **Preview**: Show the complete email before sending:
|
|
29
|
+
```
|
|
30
|
+
From: <your-email@inboxapi.ai>
|
|
31
|
+
To: <recipient@example.com>
|
|
32
|
+
Subject: <subject>
|
|
33
|
+
---
|
|
34
|
+
<body>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
5. **Safety checks**:
|
|
38
|
+
- Warn if the recipient address matches the sender's own @inboxapi.ai address
|
|
39
|
+
- Warn if the body is empty
|
|
40
|
+
- Warn if the subject is empty
|
|
41
|
+
|
|
42
|
+
6. **Confirm**: Ask the user to confirm: "Send this email? (yes/no)"
|
|
43
|
+
|
|
44
|
+
7. **Send**: Call `mcp__inboxapi__send_email` with `to`, `subject`, and `body`
|
|
45
|
+
|
|
46
|
+
8. **Confirm delivery**: Report the result to the user
|
|
47
|
+
|
|
48
|
+
## Rules
|
|
49
|
+
|
|
50
|
+
- ALWAYS show a preview before sending
|
|
51
|
+
- ALWAYS ask for explicit confirmation before calling send_email
|
|
52
|
+
- NEVER send an email without the user confirming
|
|
53
|
+
- If the user cancels, acknowledge and do not send
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: email-digest
|
|
3
|
+
description: Generate a digest summary of recent email activity grouped by thread. Use when the user wants an overview of their email activity.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: [timeframe]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Email Digest
|
|
9
|
+
|
|
10
|
+
Generate a structured digest of recent email activity.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Determine timeframe**: Use `$ARGUMENTS` if provided (e.g., "today", "this week", "last 3 days"), otherwise default to "last 24 hours"
|
|
15
|
+
|
|
16
|
+
2. **Get account info**: Call `mcp__inboxapi__whoami` for the account email
|
|
17
|
+
|
|
18
|
+
3. **Get total count**: Call `mcp__inboxapi__get_email_count` for inbox statistics
|
|
19
|
+
|
|
20
|
+
4. **Fetch recent emails**: Call `mcp__inboxapi__get_emails` with an appropriate limit (50 for digest)
|
|
21
|
+
|
|
22
|
+
5. **Group by thread**: For threads with multiple emails, call `mcp__inboxapi__get_thread` to understand the conversation
|
|
23
|
+
|
|
24
|
+
6. **Generate digest** with these sections:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
# Email Digest — <timeframe>
|
|
28
|
+
Account: <email>
|
|
29
|
+
|
|
30
|
+
## Summary
|
|
31
|
+
- Total emails in inbox: X
|
|
32
|
+
- Emails in this period: Y
|
|
33
|
+
- Unique senders: Z
|
|
34
|
+
- Threads with activity: N
|
|
35
|
+
|
|
36
|
+
## Active Threads
|
|
37
|
+
### 1. <Subject>
|
|
38
|
+
- Participants: alice@..., bob@...
|
|
39
|
+
- Messages in period: 3
|
|
40
|
+
- Latest: "Brief preview of most recent message..."
|
|
41
|
+
- Status: Awaiting your reply / You replied / FYI only
|
|
42
|
+
|
|
43
|
+
## New Emails (not in threads)
|
|
44
|
+
| From | Subject | Date |
|
|
45
|
+
|------|---------|------|
|
|
46
|
+
| ... | ... | ... |
|
|
47
|
+
|
|
48
|
+
## Needs Attention
|
|
49
|
+
- Emails you haven't replied to where you were directly addressed
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
7. **Offer actions**: "Would you like to reply to any of these, or read a specific email?"
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
- Focus on actionable insights, not raw data
|
|
57
|
+
- Highlight emails that likely need a response
|
|
58
|
+
- Keep the digest concise — summarize, don't reproduce full emails
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: email-forward
|
|
3
|
+
description: Forward an email to someone with an optional message. Use when the user wants to forward a specific email to another person.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: [email-id or subject]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Email Forward
|
|
10
|
+
|
|
11
|
+
Help the user forward an email to another recipient.
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. **Find the email to forward**:
|
|
16
|
+
- If `$ARGUMENTS` looks like an email ID, call `mcp__inboxapi__get_email` directly
|
|
17
|
+
- Otherwise, call `mcp__inboxapi__search_emails` with the argument
|
|
18
|
+
- If multiple results, show them and ask the user to pick one
|
|
19
|
+
|
|
20
|
+
2. **Show email content**: Display the email being forwarded:
|
|
21
|
+
```
|
|
22
|
+
--- Email to forward ---
|
|
23
|
+
From: <original sender>
|
|
24
|
+
Subject: <subject>
|
|
25
|
+
Date: <date>
|
|
26
|
+
---
|
|
27
|
+
<body preview, first 500 chars>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. **Resolve recipient**:
|
|
31
|
+
- Ask "Who do you want to forward this to?"
|
|
32
|
+
- Call `mcp__inboxapi__get_addressbook` to check for matching contacts
|
|
33
|
+
- Confirm the recipient email address
|
|
34
|
+
|
|
35
|
+
4. **Optional message**: Ask "Add a message? (or press enter to skip)"
|
|
36
|
+
|
|
37
|
+
5. **Preview**:
|
|
38
|
+
```
|
|
39
|
+
Forwarding to: <recipient>
|
|
40
|
+
Subject: Fwd: <original subject>
|
|
41
|
+
Your message: <optional message or "(none)">
|
|
42
|
+
Original email from: <sender>, <date>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
6. **Confirm**: Ask "Forward this email? (yes/no)"
|
|
46
|
+
|
|
47
|
+
7. **Send**: Call `mcp__inboxapi__forward_email` with the email ID, recipient, and optional message
|
|
48
|
+
|
|
49
|
+
## Rules
|
|
50
|
+
|
|
51
|
+
- ALWAYS show what's being forwarded before sending
|
|
52
|
+
- ALWAYS confirm before forwarding
|
|
53
|
+
- NEVER forward without explicit user confirmation
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: email-reply
|
|
3
|
+
description: Reply to an email with full thread context. Use when the user wants to reply to a specific email or continue an email conversation.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
argument-hint: [email-id or subject]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Email Reply
|
|
10
|
+
|
|
11
|
+
Help the user reply to an email with full thread context.
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. **Find the email**:
|
|
16
|
+
- If `$ARGUMENTS` looks like an email ID (alphanumeric string), call `mcp__inboxapi__get_email` directly
|
|
17
|
+
- Otherwise, call `mcp__inboxapi__search_emails` with the argument as subject/keyword
|
|
18
|
+
- If multiple results, present them and ask the user to pick one
|
|
19
|
+
|
|
20
|
+
2. **Load thread context**: Call `mcp__inboxapi__get_thread` with the email's thread ID to show the full conversation
|
|
21
|
+
|
|
22
|
+
3. **Display thread**: Show the conversation history in chronological order:
|
|
23
|
+
```
|
|
24
|
+
--- Thread: <subject> ---
|
|
25
|
+
|
|
26
|
+
[1] From: alice@example.com (Jan 15, 2:30 PM)
|
|
27
|
+
> Original message text...
|
|
28
|
+
|
|
29
|
+
[2] From: you@inboxapi.ai (Jan 15, 3:00 PM)
|
|
30
|
+
> Your previous reply...
|
|
31
|
+
|
|
32
|
+
[3] From: alice@example.com (Jan 15, 4:15 PM)
|
|
33
|
+
> Latest message you're replying to...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. **Compose reply**: Ask the user what they want to say in their reply
|
|
37
|
+
|
|
38
|
+
5. **Preview**: Show the reply before sending:
|
|
39
|
+
```
|
|
40
|
+
Replying to: alice@example.com
|
|
41
|
+
Subject: Re: <subject>
|
|
42
|
+
---
|
|
43
|
+
<reply body>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
6. **Confirm**: Ask "Send this reply? (yes/no)"
|
|
47
|
+
|
|
48
|
+
7. **Send**: Call `mcp__inboxapi__send_reply` with the email ID and reply body
|
|
49
|
+
|
|
50
|
+
## Rules
|
|
51
|
+
|
|
52
|
+
- ALWAYS show the thread context before composing
|
|
53
|
+
- ALWAYS preview and confirm before sending
|
|
54
|
+
- NEVER send without explicit user confirmation
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: email-search
|
|
3
|
+
description: Search your InboxAPI emails using natural language. Use when the user wants to find specific emails by sender, subject, date, or content.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: [query]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Email Search
|
|
9
|
+
|
|
10
|
+
Search emails using natural language and present results clearly.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. Take the user's query from `$ARGUMENTS`
|
|
15
|
+
- If no arguments provided, ask: "What are you looking for?"
|
|
16
|
+
|
|
17
|
+
2. Translate the natural language query into a `mcp__inboxapi__search_emails` call:
|
|
18
|
+
- Extract sender hints (e.g., "from John" -> search by sender)
|
|
19
|
+
- Extract subject hints (e.g., "about invoices" -> search by subject)
|
|
20
|
+
- Extract date hints (e.g., "last week", "yesterday")
|
|
21
|
+
- Use the full query as the search term
|
|
22
|
+
|
|
23
|
+
3. Call `mcp__inboxapi__search_emails` with the interpreted parameters
|
|
24
|
+
|
|
25
|
+
4. Present results in a formatted table:
|
|
26
|
+
```
|
|
27
|
+
| # | From | Subject | Date |
|
|
28
|
+
|---|------|---------|------|
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
5. After showing results, offer: "Would you like to read any of these emails? Provide the number."
|
|
32
|
+
|
|
33
|
+
6. If the user picks one, call `mcp__inboxapi__get_email` with the email ID
|
|
34
|
+
|
|
35
|
+
7. If no results, suggest alternative searches or broader terms
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
- `/email-search invoices from accounting` -> search for "invoices" filtered by sender containing "accounting"
|
|
40
|
+
- `/email-search meeting tomorrow` -> search for "meeting" in recent emails
|
|
41
|
+
- `/email-search` -> prompt user for search query
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-inboxapi
|
|
3
|
+
description: Set up InboxAPI email tools in your Claude Code project. Adds MCP server config, installs skills, and configures safety hooks. Use when the user wants to configure InboxAPI for their project.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Setup InboxAPI
|
|
9
|
+
|
|
10
|
+
Configure InboxAPI email tools for this Claude Code project.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Check current setup**: Look for existing `.mcp.json` and `.claude/settings.json` files
|
|
15
|
+
|
|
16
|
+
2. **Add MCP server** (if not already configured):
|
|
17
|
+
- Check if `.mcp.json` exists and contains an `inboxapi` entry
|
|
18
|
+
- If not, run: `claude mcp add inboxapi -- npx -y @inboxapi/cli`
|
|
19
|
+
- Or create/update `.mcp.json` with:
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"inboxapi": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "@inboxapi/cli"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. **Install skills**: Run `npx -y @inboxapi/cli setup-skills` to copy bundled skills and hooks into the project's `.claude/` directory
|
|
32
|
+
|
|
33
|
+
4. **Verify credentials**:
|
|
34
|
+
- Call `mcp__inboxapi__whoami` to check if credentials are set up
|
|
35
|
+
- If not authenticated, instruct the user: "Run `npx -y @inboxapi/cli login` in a terminal to authenticate"
|
|
36
|
+
|
|
37
|
+
5. **Show summary**:
|
|
38
|
+
```
|
|
39
|
+
InboxAPI Setup Complete!
|
|
40
|
+
|
|
41
|
+
MCP Server: configured in .mcp.json
|
|
42
|
+
Email: <email> (or "not authenticated yet")
|
|
43
|
+
|
|
44
|
+
Installed Skills:
|
|
45
|
+
/check-inbox — View inbox summary
|
|
46
|
+
/compose — Write and send emails
|
|
47
|
+
/email-search — Search emails
|
|
48
|
+
/email-reply — Reply with thread context
|
|
49
|
+
/email-digest — Email activity digest
|
|
50
|
+
/email-forward — Forward emails
|
|
51
|
+
|
|
52
|
+
Installed Hooks:
|
|
53
|
+
PreToolUse — Email send guard (reviews before sending)
|
|
54
|
+
PostToolUse — Activity logger (audit trail)
|
|
55
|
+
SessionStart — Credential check (verifies auth on startup)
|
|
56
|
+
|
|
57
|
+
Next steps:
|
|
58
|
+
- Run /check-inbox to see your emails
|
|
59
|
+
- Run /compose to send your first email
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Notes
|
|
63
|
+
|
|
64
|
+
- This skill is safe to run multiple times — it won't duplicate entries or overwrite local edits
|
|
65
|
+
- Existing `.mcp.json` entries, skill files, and hook files with local edits are preserved
|
|
66
|
+
- `.claude/settings.json` is merged with new hook config (may be reformatted when hooks are updated)
|
|
67
|
+
- Files with local edits are skipped; unmodified files are reported as up to date
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inboxapi/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "📧 Email for your AI 🤖",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"inboxapi": "index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"index.js"
|
|
10
|
+
"index.js",
|
|
11
|
+
"claude"
|
|
11
12
|
],
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -27,13 +28,13 @@
|
|
|
27
28
|
"test": "cargo test"
|
|
28
29
|
},
|
|
29
30
|
"optionalDependencies": {
|
|
30
|
-
"@inboxapi/cli-darwin-arm64": "0.2.
|
|
31
|
-
"@inboxapi/cli-darwin-x64": "0.2.
|
|
32
|
-
"@inboxapi/cli-linux-arm64": "0.2.
|
|
33
|
-
"@inboxapi/cli-linux-x64": "0.2.
|
|
34
|
-
"@inboxapi/cli-win32-x64": "0.2.
|
|
31
|
+
"@inboxapi/cli-darwin-arm64": "0.2.19",
|
|
32
|
+
"@inboxapi/cli-darwin-x64": "0.2.19",
|
|
33
|
+
"@inboxapi/cli-linux-arm64": "0.2.19",
|
|
34
|
+
"@inboxapi/cli-linux-x64": "0.2.19",
|
|
35
|
+
"@inboxapi/cli-win32-x64": "0.2.19"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@inboxapi/cli": "^0.2.
|
|
38
|
+
"@inboxapi/cli": "^0.2.19"
|
|
38
39
|
}
|
|
39
40
|
}
|