poke 0.2.5 → 0.3.1

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 CHANGED
@@ -154,16 +154,22 @@ poke mcp add https://example.com/mcp --name "My Server" --api-key sk-xxx
154
154
 
155
155
  ### `poke tunnel <url>`
156
156
 
157
- Expose a local MCP server to Poke via a tunnel.
157
+ Forward a local port to Poke so your agent can reach a server running on your machine.
158
+
159
+ The tunnel **only forwards the port** — it does not start or manage the server itself. You must start your MCP server separately, then point the tunnel at it:
158
160
 
159
161
  ```bash
162
+ # 1. Start your MCP server (example)
163
+ uv run python -m server # listening on http://localhost:3000/mcp
164
+
165
+ # 2. In another terminal, tunnel that port to Poke
160
166
  poke tunnel http://localhost:3000/mcp --name "Local Dev"
161
167
  ```
162
168
 
163
169
  | Option | Description |
164
170
  |--------|-------------|
165
171
  | `-n, --name <name>` | Display name for the connection (required) |
166
- | `--share` | Create a shareable recipe with QR code |
172
+ | `--recipe` | Create a shareable recipe with QR code |
167
173
 
168
174
  The tunnel stays active until you press Ctrl+C. Tools are synced automatically every 5 minutes.
169
175
 
@@ -173,14 +179,15 @@ Analyze your project with AI and generate an MCP server that exposes its capabil
173
179
 
174
180
  ```bash
175
181
  poke wrap
176
- poke wrap --name "My Project" --share
182
+ poke wrap --name "My Project"
183
+ poke wrap --prompt "Focus on the REST API endpoints and expose CRUD operations as tools"
177
184
  ```
178
185
 
179
186
  | Option | Description |
180
187
  |--------|-------------|
181
188
  | `--port <port>` | Port for the generated MCP server (default: `8765`) |
182
189
  | `-n, --name <name>` | Display name for the connection |
183
- | `--share` | Create a shareable recipe with QR code |
190
+ | `--prompt <prompt>` | Additional instructions for what the MCP server should do |
184
191
 
185
192
  Requires [uv](https://docs.astral.sh/uv/) to be installed.
186
193
 
@@ -192,4 +199,4 @@ Credentials are stored in `~/.config/poke/credentials.json` (respects `$XDG_CONF
192
199
  |---------------------|-------------|---------|
193
200
  | `POKE_API_KEY` | API key for SDK usage | &mdash; |
194
201
  | `POKE_API` | API base URL | `https://poke.com/api/v1` |
195
- | `POKE_FRONTEND` | Frontend URL | `https://poke.com` |
202
+ | `POKE_FRONTEND` | Frontend URL | `https://poke.com` |
package/dist/cli.cjs CHANGED
@@ -70,7 +70,7 @@ This MCP server requires OAuth authentication.`),console.error(`Add it from the
70
70
  Failed to add MCP connection: ${a.message??`HTTP ${r.status}`}
71
71
  `),process.exit(1)}let n=await r.json(),s=Array.isArray(n.tools)?n.tools.length:0;console.log(`
72
72
  MCP connection added successfully!`),console.log(` Name: ${n.name}`),console.log(` Server URL: ${n.serverUrl}`),console.log(` Tools: ${s}
73
- `)});q.command("tunnel").description("Create a tunnel to expose a local MCP server").argument("<url>","Local MCP server URL (e.g. http://localhost:3000/mcp)").requiredOption("-n, --name <name>","Display name for the connection").option("--recipe","Create a shareable recipe with QR code").option("--client-id <id>","OAuth client ID").option("--client-secret <secret>","OAuth client secret").action(async(i,e)=>{let t;try{t=new URL(i)}catch{console.error(`
73
+ `)});q.command("tunnel").description("Forward a local port to Poke (start your MCP server separately, then tunnel that port)").argument("<url>","Local MCP server URL (e.g. http://localhost:3000/mcp)").requiredOption("-n, --name <name>","Display name for the connection").option("--recipe","Create a shareable recipe with QR code").option("--client-id <id>","OAuth client ID").option("--client-secret <secret>","OAuth client secret").action(async(i,e)=>{let t;try{t=new URL(i)}catch{console.error(`
74
74
  Invalid URL: ${i}
75
75
  `),process.exit(1)}let r={name:e.name,serverUrl:i,tunnel:!0};e.clientId&&(r.clientId=e.clientId),e.clientSecret&&(r.clientSecret=e.clientSecret);let n=await k("/mcp/connections/cli",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){let p=await n.text(),E=`HTTP ${n.status}`;try{E=JSON.parse(p).message??E}catch{}console.error(`
76
76
  Failed to create tunnel: ${E}
@@ -96,7 +96,7 @@ Removing MCP connection...`);try{await k(`/mcp/connections/${s.id}`,{method:"DEL
96
96
  `)}catch{console.error(`Failed to remove MCP connection.
97
97
  `)}c.exitCode===null&&c.kill(),process.exit(0)}};process.on("SIGINT",T),process.on("SIGTERM",T);let $=await new Promise(p=>{c.on("exit",E=>{console.log(`
98
98
  Tunnel stopped${E?` (exit ${E})`:""}.
99
- `),p(E??0)})});d||process.exit($)});function un(i){return new Promise((e,t)=>{let r=fe.default.createServer();r.listen(i,()=>{let{port:n}=r.address();r.close(()=>e(n))}),r.on("error",()=>{let n=fe.default.createServer();n.listen(0,()=>{let{port:s}=n.address();n.close(()=>e(s))}),n.on("error",t)})})}function hn(i,e){let t=Date.now()+e;return new Promise((r,n)=>{let s=()=>{if(Date.now()>t){n(new Error(`Server did not start within ${e}ms`));return}let o=fe.default.createConnection({port:i,host:"127.0.0.1"},()=>{o.destroy(),r()});o.on("error",()=>{setTimeout(s,500)})};s()})}q.command("wrap").description("Wrap the current project in an MCP server using AI").option("--port <port>","Port for the MCP server","8765").option("-n, --name <name>","Display name for the connection").action(async i=>{let e=de();e?.token||(await hr(),e=de(),e?.token||(console.error("Login failed."),process.exit(1))),(0,ee.spawnSync)("uv",["--version"],{stdio:"ignore"}).status!==0&&(console.error(`uv is required but not installed.
99
+ `),p(E??0)})});d||process.exit($)});function un(i){return new Promise((e,t)=>{let r=fe.default.createServer();r.listen(i,()=>{let{port:n}=r.address();r.close(()=>e(n))}),r.on("error",()=>{let n=fe.default.createServer();n.listen(0,()=>{let{port:s}=n.address();n.close(()=>e(s))}),n.on("error",t)})})}function hn(i,e){let t=Date.now()+e;return new Promise((r,n)=>{let s=()=>{if(Date.now()>t){n(new Error(`Server did not start within ${e}ms`));return}let o=fe.default.createConnection({port:i,host:"127.0.0.1"},()=>{o.destroy(),r()});o.on("error",()=>{setTimeout(s,500)})};s()})}q.command("wrap").description("Wrap the current project in an MCP server using AI").option("--port <port>","Port for the MCP server","8765").option("-n, --name <name>","Display name for the connection").option("--prompt <prompt>","Additional instructions for what the MCP server should do").action(async i=>{let e=de();e?.token||(await hr(),e=de(),e?.token||(console.error("Login failed."),process.exit(1))),(0,ee.spawnSync)("uv",["--version"],{stdio:"ignore"}).status!==0&&(console.error(`uv is required but not installed.
100
100
 
101
101
  Install it with:
102
102
  curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -160,7 +160,11 @@ Install it with:
160
160
  - Use absolute paths when writing files
161
161
  - Include proper error handling in every tool
162
162
  - Tools should work with the project as-is
163
- - You MUST install deps and start the server using the Bash tool before finishing`;console.log(`Analyzing project and generating MCP server...
163
+ - You MUST install deps and start the server using the Bash tool before finishing${i.prompt?`
164
+
165
+ ## Additional Instructions from the User
166
+
167
+ ${i.prompt}`:""}`;console.log(`Analyzing project and generating MCP server...
164
168
  `);try{let{query:m}=await import("@anthropic-ai/claude-agent-sdk");for await(let b of m({prompt:o,options:{cwd:r,allowedTools:["Read","Write","Bash","Glob","Grep"],permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,maxTurns:30,env:{...process.env,ANTHROPIC_BASE_URL:`${Y}/ai-proxy`,ANTHROPIC_API_KEY:e.token}}}))if(b.type,b.type==="result"){let Q=b;if(Q.subtype!=="success"){let pe=(Q.errors??[]).filter(N=>!N.includes("events failed to export")&&!N.includes("Failed to export")&&!N.includes("1P event logging")&&!N.includes("only prompt commands are supported")&&!N.includes("405 status code")&&!N.includes("404")&&!N.includes("EISDIR"));pe.length>0&&(console.error(`
165
169
  Failed to generate MCP server:`,pe),process.exit(1))}}}catch(m){console.error(`
166
170
  Failed to run AI agent: ${m instanceof Error?m.message:m}`),console.error("Make sure @anthropic-ai/claude-agent-sdk is installed."),process.exit(1)}console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poke",
3
- "version": "0.2.5",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Poke.com Developer SDK",
6
6
  "main": "./dist/index.cjs",