@inboxapi/cli 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/README.md +94 -0
- package/index.js +70 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# InboxAPI CLI
|
|
2
|
+
|
|
3
|
+
STDIO proxy that bridges the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) over STDIO to the remote [InboxAPI](https://inboxapi.ai) service over Streamable HTTP/SSE. This lets any MCP-compatible client (Claude Desktop, Claude Code, etc.) use InboxAPI's email tools without custom HTTP integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @inboxapi/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Prebuilt binaries are included for:
|
|
12
|
+
|
|
13
|
+
| Platform | Architecture |
|
|
14
|
+
|----------------|--------------|
|
|
15
|
+
| macOS | ARM64, x64 |
|
|
16
|
+
| Linux | x64, ARM64 |
|
|
17
|
+
| Windows | x64 |
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Just start the proxy — an account is created automatically on first run
|
|
23
|
+
inboxapi proxy
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
On first run with no saved credentials, the CLI auto-creates an account with a generated name (e.g. `brooding-fluffy-owl`) and authenticates. No manual setup needed.
|
|
27
|
+
|
|
28
|
+
Credentials are stored in your system config directory (`~/.config/inboxapi/credentials.json` on Linux/macOS) and automatically injected into tool calls.
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
### `proxy` (default)
|
|
33
|
+
|
|
34
|
+
Starts the STDIO proxy. Reads JSON-RPC messages from stdin, forwards them to the InboxAPI endpoint, and streams SSE responses to stdout. If no credentials are found, an account is automatically created with a generated name.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
inboxapi proxy
|
|
38
|
+
inboxapi proxy --endpoint https://custom-endpoint.example.com/mcp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Running `inboxapi` with no subcommand also starts the proxy.
|
|
42
|
+
|
|
43
|
+
### `login`
|
|
44
|
+
|
|
45
|
+
Manually creates an account with a chosen name and stores access credentials locally. Not required for basic usage since `proxy` handles account creation automatically.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
inboxapi login
|
|
49
|
+
inboxapi login --name myaccount
|
|
50
|
+
inboxapi login --endpoint https://custom-endpoint.example.com/mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `whoami`
|
|
54
|
+
|
|
55
|
+
Displays the currently authenticated account and endpoint.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
inboxapi whoami
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage with MCP Clients
|
|
62
|
+
|
|
63
|
+
InboxAPI CLI works as an MCP STDIO transport. Point your MCP client at the `inboxapi` binary:
|
|
64
|
+
|
|
65
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"inboxapi": {
|
|
71
|
+
"command": "inboxapi"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Claude Code:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
claude mcp add inboxapi inboxapi
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
cargo build # Build debug binary
|
|
87
|
+
cargo build --release # Build release binary
|
|
88
|
+
cargo test # Run tests
|
|
89
|
+
cargo fmt # Format code
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const PLATFORM_PACKAGES = {
|
|
8
|
+
'darwin-arm64': '@inboxapi/cli-darwin-arm64',
|
|
9
|
+
'darwin-x64': '@inboxapi/cli-darwin-x64',
|
|
10
|
+
'linux-x64': '@inboxapi/cli-linux-x64',
|
|
11
|
+
'linux-arm64': '@inboxapi/cli-linux-arm64',
|
|
12
|
+
'win32-x64': '@inboxapi/cli-win32-x64',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const binName = process.platform === 'win32' ? 'inboxapi-cli.exe' : 'inboxapi-cli';
|
|
16
|
+
|
|
17
|
+
function findBinary() {
|
|
18
|
+
// 1. Try platform-specific npm package (production install)
|
|
19
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
20
|
+
const pkg = PLATFORM_PACKAGES[platformKey];
|
|
21
|
+
if (pkg) {
|
|
22
|
+
try {
|
|
23
|
+
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
24
|
+
const binPath = path.join(pkgDir, binName);
|
|
25
|
+
if (fs.existsSync(binPath)) return binPath;
|
|
26
|
+
} catch {}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 2. Fall back to local dev paths
|
|
30
|
+
const devPaths = [
|
|
31
|
+
path.join(__dirname, 'target', 'release', binName),
|
|
32
|
+
path.join(__dirname, 'target', 'debug', binName),
|
|
33
|
+
];
|
|
34
|
+
const found = devPaths.find(p => fs.existsSync(p));
|
|
35
|
+
if (found) return found;
|
|
36
|
+
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const binPath = findBinary();
|
|
41
|
+
const args = process.argv.slice(2);
|
|
42
|
+
|
|
43
|
+
if (binPath) {
|
|
44
|
+
const child = spawn(binPath, args, { stdio: 'inherit' });
|
|
45
|
+
child.on('exit', (code, signal) => {
|
|
46
|
+
if (code !== null) process.exit(code);
|
|
47
|
+
if (signal) process.kill(process.pid, signal);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
});
|
|
50
|
+
child.on('error', (err) => {
|
|
51
|
+
console.error(`Failed to start binary at ${binPath}:`, err);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
// 3. Final fallback: cargo run (development)
|
|
56
|
+
const child = spawn('cargo', ['run', '--quiet', '--', ...args], { stdio: 'inherit' });
|
|
57
|
+
child.on('exit', (code, signal) => {
|
|
58
|
+
if (code !== null) process.exit(code);
|
|
59
|
+
if (signal) process.kill(process.pid, signal);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
child.on('error', () => {
|
|
63
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
64
|
+
console.error(
|
|
65
|
+
`No pre-built binary available for ${platformKey}. Supported platforms: ${Object.keys(PLATFORM_PACKAGES).join(', ')}.\n` +
|
|
66
|
+
`Fallback to 'cargo run' also failed. Install Rust (https://rustup.rs) or use a supported platform.`
|
|
67
|
+
);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
|
70
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inboxapi/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "STDIO Proxy for InboxAPI MCP service",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"inboxapi": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/shaond/inboxapi-cli.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"inboxapi",
|
|
19
|
+
"proxy",
|
|
20
|
+
"email",
|
|
21
|
+
"ai"
|
|
22
|
+
],
|
|
23
|
+
"author": "Shaon Diwakar",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "cargo build --release",
|
|
27
|
+
"test": "cargo test"
|
|
28
|
+
},
|
|
29
|
+
"optionalDependencies": {
|
|
30
|
+
"@inboxapi/cli-darwin-arm64": "0.1.0",
|
|
31
|
+
"@inboxapi/cli-darwin-x64": "0.1.0",
|
|
32
|
+
"@inboxapi/cli-linux-x64": "0.1.0",
|
|
33
|
+
"@inboxapi/cli-linux-arm64": "0.1.0",
|
|
34
|
+
"@inboxapi/cli-win32-x64": "0.1.0"
|
|
35
|
+
}
|
|
36
|
+
}
|