@sharnix/agent 1.0.5 → 1.0.6
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 +67 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,80 +2,122 @@
|
|
|
2
2
|
|
|
3
3
|
Instantly share your local app with anyone — no config, no port forwarding, no deployment.
|
|
4
4
|
|
|
5
|
+
## First-time setup (one command)
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
|
-
|
|
8
|
+
npx @sharnix/agent setup
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
This is all a new user needs to run. It will:
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
1. Open your browser to relay.sharnix.com — sign in if you haven't already
|
|
14
|
+
2. Click **"Authorize & create key"** — one click
|
|
15
|
+
3. The CLI captures your API key automatically
|
|
16
|
+
4. Writes the MCP config to Claude Desktop, Cursor, and Windsurf automatically (whichever are installed)
|
|
17
|
+
5. Prints your key and tells you to restart your editor
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
- **Auto-provisioned** — creates an agent credential on first run, stored in `~/.sharnix/`
|
|
15
|
-
- **Auto-suspends** share links when you disconnect, reactivates when you reconnect
|
|
16
|
-
- **Works with any framework** — Next.js, Vite, Django, Rails, anything on localhost
|
|
19
|
+
After that, your AI agent has full MCP access and you can start tunneling.
|
|
17
20
|
|
|
18
|
-
##
|
|
21
|
+
## Tunneling your app
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
```bash
|
|
24
|
+
npx @sharnix/agent --port 3000
|
|
25
|
+
```
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
The API key is read from `SHARNIX_API_KEY` in your environment, or saved automatically by `setup`.
|
|
25
28
|
|
|
26
29
|
```bash
|
|
27
30
|
# Tunnel port 3000
|
|
28
31
|
SHARNIX_API_KEY=shx_... npx @sharnix/agent --port 3000
|
|
29
32
|
|
|
30
|
-
# Tunnel a
|
|
33
|
+
# Tunnel and immediately print a share link (no dashboard needed)
|
|
34
|
+
SHARNIX_API_KEY=shx_... npx @sharnix/agent --port 3000 --share
|
|
35
|
+
|
|
36
|
+
# With a label
|
|
31
37
|
SHARNIX_API_KEY=shx_... npx @sharnix/agent --port 8080 --label "staging"
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
Save the key to your shell profile so you don't repeat it:
|
|
35
41
|
|
|
36
42
|
```bash
|
|
37
43
|
# ~/.bashrc or ~/.zshrc
|
|
38
44
|
export SHARNIX_API_KEY=shx_...
|
|
39
45
|
```
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
## What it does
|
|
42
48
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
`@sharnix/agent` opens a secure tunnel from [relay.sharnix.com](https://relay.sharnix.com) to your local machine. Visitors access your app through a shareable link — you never expose a port publicly.
|
|
50
|
+
|
|
51
|
+
- **Stable tunnel ID** per project directory — same URL survives restarts
|
|
52
|
+
- **Auto-provisioned** — creates agent credentials on first run, stored in `~/.sharnix/`
|
|
53
|
+
- **Auto-suspends** share links when you disconnect, reactivates when you reconnect
|
|
54
|
+
- **Works with any framework** — Next.js, Vite, Django, Rails, anything on localhost
|
|
46
55
|
|
|
47
56
|
## Options
|
|
48
57
|
|
|
49
58
|
| Flag | Default | Description |
|
|
50
59
|
|------|---------|-------------|
|
|
60
|
+
| `setup` | — | First-time setup: creates API key and writes MCP config automatically |
|
|
51
61
|
| `--port`, `-p` | `3000` | Local port to forward |
|
|
52
62
|
| `--label`, `-l` | — | Human-readable label for this tunnel |
|
|
53
63
|
| `--name` | `local-dev` | Agent name used on first-time setup |
|
|
64
|
+
| `--share` | — | Create a read-only share link on connect and print the URL |
|
|
54
65
|
| `--help`, `-h` | — | Show help |
|
|
55
66
|
|
|
56
67
|
## Environment variables
|
|
57
68
|
|
|
58
69
|
| Variable | Description |
|
|
59
70
|
|----------|-------------|
|
|
60
|
-
| `SHARNIX_API_KEY` | Your API key
|
|
71
|
+
| `SHARNIX_API_KEY` | Your API key — set automatically by `setup`, or from Settings |
|
|
61
72
|
| `SHARNIX_URL` | Override relay URL (default: `https://relay.sharnix.com`) |
|
|
62
73
|
|
|
74
|
+
## What setup writes automatically
|
|
75
|
+
|
|
76
|
+
`npx @sharnix/agent setup` detects which editors are installed and writes the MCP config to:
|
|
77
|
+
|
|
78
|
+
| Editor | Config file |
|
|
79
|
+
|--------|-------------|
|
|
80
|
+
| Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
81
|
+
| Claude Desktop (Windows) | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
82
|
+
| Claude Desktop (Linux) | `~/.config/Claude/claude_desktop_config.json` |
|
|
83
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
84
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
85
|
+
|
|
86
|
+
It merges into the existing config — it will never overwrite other MCP servers you have configured.
|
|
87
|
+
|
|
88
|
+
The block it writes looks like this:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"sharnix": {
|
|
94
|
+
"command": "npx",
|
|
95
|
+
"args": ["-y", "@sharnix/mcp-server"],
|
|
96
|
+
"env": {
|
|
97
|
+
"SHARNIX_API_KEY": "shx_your_key_here"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
63
104
|
## Creating share links
|
|
64
105
|
|
|
65
106
|
Once the agent is running, create share links from:
|
|
66
107
|
|
|
108
|
+
- **Terminal** — `npx @sharnix/agent --port 3000 --share` prints a URL immediately
|
|
109
|
+
- **AI agent** — ask Claude/Cursor: *"share my app with the client"* via [`@sharnix/mcp-server`](https://www.npmjs.com/package/@sharnix/mcp-server)
|
|
67
110
|
- **Dashboard** — [relay.sharnix.com/app](https://relay.sharnix.com/app)
|
|
68
|
-
- **AI agent** — via the [`@sharnix/mcp-server`](https://www.npmjs.com/package/@sharnix/mcp-server) MCP integration
|
|
69
|
-
- **API** — `POST /api/v1/orgs/:slug/tunnels/:id/links`
|
|
70
111
|
|
|
71
112
|
Share links support permissions (`read-only`, `full`), expiry dates, email restrictions, and one-time view mode.
|
|
72
113
|
|
|
73
114
|
## How it works
|
|
74
115
|
|
|
75
|
-
1.
|
|
76
|
-
2.
|
|
77
|
-
3.
|
|
78
|
-
4.
|
|
116
|
+
1. `setup` creates an API key via browser auth and writes MCP config to your editors
|
|
117
|
+
2. On first tunnel run, agent credentials (`agentId` + `secret`) are auto-provisioned via the API and saved to `~/.sharnix/agent.json`
|
|
118
|
+
3. A stable tunnel ID is generated per working directory and saved to `~/.sharnix/tunnel-<hash>.json`
|
|
119
|
+
4. The agent opens a WebSocket to the relay and registers the tunnel
|
|
120
|
+
5. When a visitor opens a share link, the relay forwards their HTTP request over the WebSocket to your local app and streams the response back
|
|
79
121
|
|
|
80
122
|
## License
|
|
81
123
|
|