@soba-so/mcp 0.0.6 → 0.0.8
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 +30 -0
- package/dist/mcp.mjs +53 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,8 +37,37 @@ step, and reads it back — and the dashboard ticks along as it goes.
|
|
|
37
37
|
| `soba_create_key` | Mints your app's secret key, once |
|
|
38
38
|
| `soba_set_connect_url` | Points Connect back at your app |
|
|
39
39
|
| `soba_use_soba` | Answers the provider step with "Just use Soba for now" and ticks it |
|
|
40
|
+
| `soba_set_model_picker` | Sets the model picker: on or off, menu, presets, search |
|
|
40
41
|
| `soba_create_free_plan` | Adds the free "Bring your own" plan, the default, and starts new users on it |
|
|
41
42
|
| `soba_create_plan` | Creates a plan from numbers **you** gave it |
|
|
43
|
+
| `soba_get_settings`, `soba_update_settings` | Connect popup, model picker, which AI users may connect |
|
|
44
|
+
| `soba_list_plans` | Its plans, with every field |
|
|
45
|
+
| `soba_update_plan` | Changes the fields you name on one plan |
|
|
46
|
+
| `soba_archive_plan` | Takes a plan off sale; users on it keep it |
|
|
47
|
+
|
|
48
|
+
## The whole dashboard, in production
|
|
49
|
+
|
|
50
|
+
A management key reaches **development** only. To let an agent work in
|
|
51
|
+
production, or in any of your apps, sign in once and connect the server as you:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npx @soba-so/cli login --no-link
|
|
55
|
+
claude mcp add soba-account -- npx -y @soba-so/mcp --account
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
That connection has a tool for every page of an app: settings (Connect popup, model
|
|
59
|
+
picker, which AI users may connect, limits), providers and their models, custom models,
|
|
60
|
+
plans, rewards, users, machines, runs, keys and the workspace's people. It asks for the
|
|
61
|
+
app and the environment each time, and acts with exactly what you may do in each
|
|
62
|
+
workspace. A provider's key is never said in the conversation: the agent names the
|
|
63
|
+
variable in your `.env.local` and the server reads it. A key it makes goes straight into
|
|
64
|
+
that file too.
|
|
65
|
+
|
|
66
|
+
Two things end with you in a browser, because Stripe and the Soba app ask for a person:
|
|
67
|
+
putting a card in or connecting your Stripe, and approving a machine. The agent hands you
|
|
68
|
+
the link and reads when it is done. Anything that charges you, changes what your users pay
|
|
69
|
+
or cannot be undone takes a number or a name you gave it.
|
|
70
|
+
`SOBA_ACCESS_TOKEN` or a `SOBA_WORKSPACE_KEY` works in place of `--account`.
|
|
42
71
|
|
|
43
72
|
## What it deliberately does not do
|
|
44
73
|
|
|
@@ -72,6 +101,7 @@ decisions about your business.
|
|
|
72
101
|
| | |
|
|
73
102
|
|---|---|
|
|
74
103
|
| `--token mk_soba_…` | Your management key. `SOBA_MANAGEMENT_KEY` works too, and keeps it out of the process list. |
|
|
104
|
+
| `--account` | Use this terminal's `soba login` instead: every tool for an app's pages, in any app and environment. |
|
|
75
105
|
| `--url` | The Soba instance. Defaults to `https://soba.so`. |
|
|
76
106
|
|
|
77
107
|
No runtime dependencies. Node 22+.
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
import{readFileSync as Pe}from"node:fs";import Oe from"node:os";import fe from"node:path";var w=class extends Error{constructor(n,r){super(r);this.status=n;this.name="ApiError"}},A=class{constructor(t,n){this.token=t;this.baseUrl=n;this.kind=t.startsWith("mk_soba_")?"setup":"account"}kind;get(t){return this.call("GET",t)}post(t,n){return this.call("POST",t,n)}patch(t,n){return this.call("PATCH",t,n)}put(t,n){return this.call("PUT",t,n)}delete(t){return this.call("DELETE",t)}async call(t,n,r){let o=await fetch(`${this.baseUrl}${n}`,{method:t,headers:{authorization:`Bearer ${this.token}`,...r===void 0?{}:{"content-type":"application/json"}},body:r===void 0?void 0:JSON.stringify(r)}),s=await o.text(),u=null;try{u=s?JSON.parse(s):null}catch{throw new w(o.status,`${t} ${n} did not return json (${s.slice(0,120)})`)}if(!o.ok){let l=u?.error,h=l?.message??l;throw new w(o.status,typeof h=="string"?h:`${t} ${n} failed with ${o.status}`)}return u}};var G=36e5,E=24*G,qe={returnAfterMs:0,expiryMs:30*E,uniquenessMs:365*E},je={returnAfterMs:24*G,expiryMs:30*E,uniquenessMs:365*E};var Je=10*6e4;var we=864e5,ye=30,nt={abandonedAfterMs:ye*we};var st=30*24*60*60*1e3;var it=5*60*1e3;function T(e){return[{upTo:null,microsPerUnit:e}]}var R={hobby:2.5*1e6,starter:2.4*1e6,growth:2.3*1e6,scale:2.2*1e6},gt=5e3*1e6;var Y="lite";var bt=[{id:"hobby",name:"Hobby",feeMicros:19*1e6,includedActivations:20,seatLimit:2,appLimit:3,bands:T(R.hobby),features:["Set your users' free trial: length, usage and features","3 projects","2 seats","Owner and Member roles","Connected user counts","Docs support"]},{id:"starter",seatLimit:null,appLimit:null,name:"Starter",feeMicros:199*1e6,includedActivations:100,bands:T(R.starter),features:["Unlimited projects","Unlimited seats","Admin and Billing roles","Cohort and conversion attribution","Email support"]},{id:"growth",seatLimit:null,appLimit:null,name:"Growth",feeMicros:599*1e6,includedActivations:400,bands:T(R.growth),features:["Soba's approval screen in your colors","Window A/B experimentation","Email support, one business day"]},{id:"scale",seatLimit:null,appLimit:null,name:"Scale",feeMicros:1999*1e6,includedActivations:1500,bands:T(R.scale),features:["Custom roles and audit log","Effective-vs-configured window analytics","Shared channel with an SLA"]}];var wt={hobby:["owner","member"],[Y]:["owner","member"]};var Tt=60*6e4;var _e="https://soba.so/skill",Ct=`npx skills add ${_e}`;var H=`Soba is the LLM layer for an application whose users bring their own compute.
|
|
3
3
|
Requests go to Soba instead of to a model provider; Soba routes each one to the
|
|
4
4
|
machine or plan belonging to the user it names, meters it, and bills for it.
|
|
5
5
|
|
|
@@ -164,6 +164,7 @@ const run = await soba.run({
|
|
|
164
164
|
user: sobaUserId(session.user.username),
|
|
165
165
|
model: "auto",
|
|
166
166
|
prompt: "Summarise everything I saved this week",
|
|
167
|
+
owners: [session.user.accountId], // whose rows this person may read
|
|
167
168
|
tools: [listNotes, readNote], // your code, executed in your app
|
|
168
169
|
});
|
|
169
170
|
\`\`\`
|
|
@@ -172,6 +173,27 @@ Tools passed to a run execute in the app's own process, so they can read the
|
|
|
172
173
|
app's own data. The model asks for data by calling them; the data does not
|
|
173
174
|
travel in the prompt.
|
|
174
175
|
|
|
176
|
+
Every tool says whose data it returns, and a run with a tool that does not is
|
|
177
|
+
refused before it starts. One of three, on each tool:
|
|
178
|
+
|
|
179
|
+
- \`owner: (row) => row.accountId\` when it returns rows of the app's data.
|
|
180
|
+
Also pass \`owners\` on the run: the ids, in the app's own data, whose rows
|
|
181
|
+
this person may read (their account, their team), resolved from the session
|
|
182
|
+
the same way as \`user\`. The SDK then drops every row owned by anyone else,
|
|
183
|
+
even when a query forgot its filter.
|
|
184
|
+
- \`public: true\` when the result belongs to nobody: a catalogue, a search of
|
|
185
|
+
public pages.
|
|
186
|
+
- \`checksOwner: true\` when the tool writes, or returns a computed answer with
|
|
187
|
+
no rows. Its own code must scope by the signed-in user.
|
|
188
|
+
|
|
189
|
+
Never read an account id or a user id from a tool's input: derive it from the
|
|
190
|
+
session. Give each tool a strict \`inputSchema\` with
|
|
191
|
+
\`additionalProperties: false\`; the SDK rejects a call that does not fit it.
|
|
192
|
+
The user can read every tool's name, description and result, so return only
|
|
193
|
+
what that person may see. To keep a tool out of their sight, mark it
|
|
194
|
+
\`private: true\`: it then runs on the app's own provider key and only its
|
|
195
|
+
answer reaches the run.
|
|
196
|
+
|
|
175
197
|
## The browser: one provider, a surface for each moment
|
|
176
198
|
|
|
177
199
|
Everything below reads from \`<SobaProvider sessionEndpoint="/api/soba/session">\`.
|
|
@@ -514,7 +536,7 @@ remains is the key.
|
|
|
514
536
|
|
|
515
537
|
Pairing is a person installing the Soba app on their own laptop and approving
|
|
516
538
|
it. Pricing, allowances and rewards are decisions about somebody's business.
|
|
517
|
-
Do neither on their behalf; say what is left and stop.`;var
|
|
539
|
+
Do neither on their behalf; say what is left and stop.`;var L=[{name:"set_up",title:"Set Soba up in this repo",description:"Works through Soba's setup checklist one step at a time, editing this repo and showing you each diff.",text:`Set this project up on Soba, working from the real checklist rather than from memory.
|
|
518
540
|
|
|
519
541
|
The loop, and keep to it:
|
|
520
542
|
|
|
@@ -549,35 +571,46 @@ Start with \`soba_status\`.
|
|
|
549
571
|
What the codebase steps actually involve, so you are not working from memory
|
|
550
572
|
there either:
|
|
551
573
|
|
|
552
|
-
${
|
|
553
|
-
`)}function
|
|
554
|
-
`)}function
|
|
555
|
-
`);for(;
|
|
556
|
-
`)}}),process.stdin.on("end",()=>{r=!0,
|
|
574
|
+
${H}`}],V=new Map(L.map(e=>[e.name,e]));function m(e){process.stderr.write(`soba-mcp: ${e}
|
|
575
|
+
`)}function J(e){process.stdout.write(`${JSON.stringify(e)}
|
|
576
|
+
`)}function z(e){let t="",n=new Set,r=!1,o=s=>{n.add(s),s.finally(()=>{n.delete(s),r&&n.size===0&&process.exit(0)})};process.stdin.setEncoding("utf8"),process.stdin.on("data",s=>{t+=s;let u=t.indexOf(`
|
|
577
|
+
`);for(;u!==-1;){let l=t.slice(0,u).trim();t=t.slice(u+1),l&&o(ke(l,e)),u=t.indexOf(`
|
|
578
|
+
`)}}),process.stdin.on("end",()=>{r=!0,n.size===0&&process.exit(0),setTimeout(()=>process.exit(0),1e4).unref()})}async function ke(e,t){let n;try{n=JSON.parse(e)}catch{m("ignored a line that was not json");return}let r=n.id===void 0||n.id===null;try{let o=await t(n.method,n.params??{});r||J({jsonrpc:"2.0",id:n.id,result:o})}catch(o){if(r)return;let s=o instanceof Error?o.message:String(o),u=s==="method not found"?-32601:-32603;J({jsonrpc:"2.0",id:n.id,error:{code:u,message:s}})}}import{readFileSync as ue,realpathSync as C}from"node:fs";import b from"node:path";import{spawnSync as X}from"node:child_process";import{existsSync as Z}from"node:fs";import{appendFile as ve,chmod as Se,readFile as Q,writeFile as xe}from"node:fs/promises";import M from"node:path";var Ae=e=>new RegExp(`^\\s*(?:export\\s+)?${e}\\s*=`);async function ee(e,t,n){let r=Z(e),o=r?await Q(e,"utf8"):"",s=o===""?[]:o.replace(/\n$/,"").split(`
|
|
579
|
+
`),u=[];for(let[l,h]of Object.entries(t)){let f=s.findIndex(g=>Ae(l).test(g));f===-1?u.push(`${l}=${h}`):s[f]=`${l}=${h}`}u.length>0&&(s.length>0&&s[s.length-1].trim()!==""&&s.push(""),n&&s.push(...n.split(`
|
|
580
|
+
`).map(l=>`# ${l}`)),s.push(...u)),await xe(e,`${s.join(`
|
|
581
|
+
`)}
|
|
582
|
+
`),r||await Se(e,384).catch(()=>{})}async function te(e){let t=M.dirname(e);if(X("git",["rev-parse","--is-inside-work-tree"],{cwd:t}).status!==0||X("git",["check-ignore","-q",M.basename(e)],{cwd:t}).status===0)return null;let o=M.join(t,".gitignore"),s=Z(o)?await Q(o,"utf8"):"",u=s===""||s.endsWith(`
|
|
583
|
+
`)?"":`
|
|
584
|
+
`;return await ve(o,`${u}${M.basename(e)}
|
|
585
|
+
`),o}var I={type:"string",description:"The app's id, from soba_list_apps."},p={type:"string",enum:["development","production"]},i=e=>({type:"string",...e?{description:e}:{}}),c=(e,t)=>({type:[e,"null"],...t?{description:t}:{}}),d=e=>({type:"boolean",...e?{description:e}:{}}),N={limit:{type:"number",description:"Up to 200."},offset:{type:"number"}},F=(e,t)=>{let n=e[t];if(typeof n!="string"||!n)throw new Error(`${t} is required.`);return n};function a(e,t,n,r,o,s={},u=[],l){let h=[...r.matchAll(/:(\w+)/g)].map(f=>f[1]);return{name:e,title:t,description:o,credentials:["account"],inputSchema:{type:"object",properties:{...h.includes("app")?{app:I}:{},...h.includes("workspace")?{workspace:i("The workspace's id, from soba_list_workspaces.")}:{},...s},required:[...new Set([...h,...u])],additionalProperties:!1},run:async(f,g)=>{let S=`/v1${r.replace(/:(\w+)/g,(K,O)=>encodeURIComponent(F(g,O)))}`,x=Object.fromEntries(Object.entries(g).filter(([K,O])=>!h.includes(K)&&O!==void 0));return JSON.stringify(await $(f,n,S,l?l(x):x),null,2)}}}async function $(e,t,n,r){if(t==="GET"||t==="DELETE"){let o=new URLSearchParams(Object.entries(r).map(([u,l])=>[u,String(l)])).toString(),s=o?`${n}?${o}`:n;return t==="GET"?e.get(s):e.delete(s)}return t==="PUT"?e.put(n,r):t==="PATCH"?e.patch(n,r):e.post(n,r)}function ne({api_key_env:e,env_file:t,...n}){if(e===void 0)return n;let r=String(e),o=process.env[r];if(!o){let s=b.resolve(typeof t=="string"?t:".env.local");try{o=ue(s,"utf8").split(`
|
|
586
|
+
`).map(l=>l.trim().replace(/^export\s+/,"")).find(l=>l.startsWith(`${r}=`))?.slice(r.length+1).trim().replace(/^(["'])(.*)\1$/,"$2")}catch{}}if(!o)throw new Error(`${r} is not set here or in ${t??".env.local"}. Ask the person to put the key there; do not ask them to paste it to you.`);return{...n,api_key:o}}function Ee(e){let t=C(b.resolve(e)),n=C(process.cwd());if(!t.startsWith(n+b.sep))throw new Error("That file is outside this project.");return t}function U({file:e,...t}){let n;try{n=ue(Ee(String(e)))}catch(r){throw new Error(`Could not read ${e}: ${r.message}`)}if(n.length>2*1024*1024)throw new Error("That image is over 2MB.");return{...t,data:n.toString("base64")}}function re(e){return{name:e.name,title:e.title,description:e.description,credentials:["account"],inputSchema:{type:"object",properties:{...e.properties,env_file:i("Default .env.local.")},required:e.required,additionalProperties:!1},run:async(t,{env_file:n,...r})=>{let o=typeof n=="string"?n:".env.local";if(!/^(\.env|\.dev\.vars)/.test(b.basename(o)))throw new Error("env_file must be an .env file or .dev.vars.");let s=b.resolve(o),u=C(b.dirname(s)),l=C(process.cwd());if(u!==l&&!u.startsWith(l+b.sep))throw new Error("env_file must be in this project.");await te(s);let h=`/v1${e.route.replace(/:(\w+)/g,(S,x)=>encodeURIComponent(F(r,x)))}`,f=Object.fromEntries(Object.entries(r).filter(([S])=>!e.route.includes(`:${S}`))),g=await t.post(h,f);return await ee(s,{[e.variable(r)]:g.key},"Soba"),`Made ${g.id} and wrote it to ${o} as ${e.variable(r)}. It was not shown.`}}}var Te={api_key_env:i("The environment variable holding the key, e.g. OPENAI_API_KEY. Read from this machine; never pass the key itself."),env_file:i("Where that variable is, if not the environment. Default .env.local.")},oe={name:i(),base_url:i("https, OpenAI-compatible. Not needed with a service."),cost_class:{type:"string",enum:["frontier","open-weights"]},max_cost_per_run:c("number","Dollars."),...Te},y=i("From soba_list_providers."),se={name:i(),kind:{type:"string",enum:["discount","grant","plan"]},discount_type:{type:"string",enum:["percent","fixed"]},amount:c("number","20 is 20%, or dollars when fixed."),duration_months:c("number"),plans:{type:["array","null"],items:{type:"string"}},first_time_only:d(),grants:{type:"array",items:{type:"object",properties:{feature:i(),name:i(),type:{type:"string",enum:["boolean","number","text"]},amount:c("number"),expiry_days:c("number")},required:["feature"]}},plan:i("The plan a plan reward gives, by id."),duration_days:{type:"number"},trigger:{type:"string",enum:["none","signup","first_connect"]},codes:{type:"array",description:"The whole list: one left out is removed.",items:{type:"object",properties:{code:i(),cap:c("number")},required:["code"]}}},ie={type:"string",enum:["admin","member","billing"]};function ae(e,t){let{app:n,environment:r,...o}=t;if(e.kind==="setup")return{path:"/v1/manage/settings",environment:r?{environment:r}:{},rest:o};if(typeof n!="string"||!n)throw new Error("Say which app: pass its id as `app`. soba_list_apps lists them.");if(!r)throw new Error("Say which environment: development or production.");return{path:`/v1/apps/${encodeURIComponent(n)}/settings`,environment:{environment:r},rest:o}}var D={app:{...I,description:`${I.description} Not needed with a setup key.`},environment:{...p,description:"Required with an account; a setup key is development."}},le=[{name:"soba_get_settings",title:"Read the app's settings",description:"Connect popup, model picker, which AI users may connect, and the app's limits, in one environment. The Models, Connect popup, Model picker and Settings pages.",credentials:["setup","account"],inputSchema:{type:"object",properties:D,additionalProperties:!1},run:async(e,t)=>{let n=ae(e,t),r=e.kind==="account"?n.environment:{};return JSON.stringify(await $(e,"GET",n.path,r),null,2)}},{name:"soba_update_settings",title:"Change the app's settings",description:"Changes only what you send. connect_popup, model_picker, own_ai, ask_to_connect and connect_return_url belong to one environment; the rest hold in both and need an account.",credentials:["setup","account"],inputSchema:{type:"object",properties:{...D,connect_popup:{type:"object",properties:{theme:{type:"string",enum:["light","dark","system"]},accent:c("string","Hex, like #4F46E5. Null is the default."),background:c("string","Hex. The whole popup follows it."),logo:{type:"string",enum:["favicon","soba","custom","none"]},logo_url:c("string","https. Makes logo custom."),hosted:d(),show_code:d(),button:{type:"string",enum:["solid","outline"],description:"Continue with Soba: filled in the accent, or outlined."}},additionalProperties:!1},model_picker:{type:"object",properties:{users_choose:d("False is no picker."),menu:{type:"string",enum:["submenus","two_panes","tabs"]},presets:{type:"object",properties:{automatic:d(),fast:d(),best:d()},additionalProperties:!1},search:d()},additionalProperties:!1},own_ai:{type:["array","null"],items:{type:"string"},description:"AIs users may connect: claude, chatgpt, gemini, local\u2026 Null is all."},ask_to_connect:d("Ask to connect before using AI the app pays for."),connect_return_url:c("string"),name:i(),icon:c("string","An https image address or one emoji."),run_limit_minutes:c("number"),max_cost_per_run:c("number","Dollars, over every plan."),route_allow:{type:["array","null"],items:{type:"string"},description:"Cost classes the app may ever run on, over every plan. Null is all."},provider_failover:d("Try another of the app's providers when one fails."),outage_fallback:d("Use the app's providers while Soba is down. Lets a holder of the secret key fetch the provider keys: only when a person asked."),use_soba:d("Use Soba's compute for now, with no provider of the app's own.")},additionalProperties:!1},run:async(e,t)=>{let n=ae(e,t),r=await $(e,"PATCH",n.path,{...n.environment,...n.rest});return`Saved. Settings are now:
|
|
587
|
+
${JSON.stringify(r,null,2)}`}},a("soba_list_workspaces","List workspaces","GET","/workspaces","Your workspaces."),a("soba_create_app","Create an app","POST","/workspaces/:workspace/apps","Makes an app. Counts against the tier's app limit.",{name:i()},["name"]),a("soba_list_keys","List keys","GET","/apps/:app/keys","The app's keys, as previews, and what each may spend a month."),re({name:"soba_create_app_key",title:"Make a key",description:"Makes a secret key and writes it to the project's env file, never into the conversation. development is SOBA_KEY; production is SOBA_PROD_KEY.",route:"/apps/:app/keys",properties:{app:I,environment:p,replace_idle:d("Replace one never used.")},required:["app","environment"],variable:e=>e.environment==="production"?"SOBA_PROD_KEY":"SOBA_KEY"}),re({name:"soba_create_workspace_key",title:"Make a workspace key",description:"Makes a key that makes apps and mints their keys, and writes it to the env file as SOBA_WORKSPACE_KEY. Only when a person asked for one.",route:"/workspaces/:workspace/keys",properties:{workspace:i("From soba_list_workspaces."),name:i()},required:["workspace"],variable:()=>"SOBA_WORKSPACE_KEY"}),a("soba_set_key_cap","Cap a key","PATCH","/apps/:app/keys/:key","The most a key may spend a month, in dollars. Null is no cap.",{key:i("From soba_list_keys."),monthly_cap:c("number")},["monthly_cap"]),a("soba_list_workspace_keys","List workspace keys","GET","/workspaces/:workspace/keys","By name. Never the keys."),a("soba_revoke_workspace_key","Revoke a workspace key","DELETE","/workspaces/:workspace/keys/:key","Anything using it stops at once. Only when a person asked.",{key:i()}),a("soba_get_billing","Read billing","GET","/workspaces/:workspace/billing","Whether the workspace is on a plan (live), its tier, the tiers and what they cost, card and invoices. No plan is needed to use production."),a("soba_go_live","Buy a plan","POST","/workspaces/:workspace/billing/go_live","Only when a person chooses a plan: production works without one, on the workspace's one-time free connected users. Answers with Stripe's page to pay for the plan. Give the person the link: never ask for card details or fill them in. Then call soba_get_billing until live is true.",{tier:i("The one a person chose, from soba_get_billing.")},["tier"]),a("soba_change_card","Change the card","POST","/workspaces/:workspace/billing/card","Answers with Stripe's page. Give the person the link."),a("soba_change_tier","Change the tier","POST","/workspaces/:workspace/billing/tier","Charges the card on file. Tell the person the fee and get a yes first. An owner only.",{tier:i(),confirm_fee:{type:"number",description:"The fee they agreed to."}},["tier","confirm_fee"]),a("soba_cancel_subscription","Cancel the subscription","POST","/workspaces/:workspace/billing/cancel","Ends with the period. Only when a person asked for exactly this.",{confirm:i("The workspace's name, which the person gave you.")},["confirm"]),a("soba_get_stripe","Read the Stripe connection","GET","/workspaces/:workspace/stripe","Whether the workspace's own Stripe is connected, which its users pay into.",{environment:p},["environment"]),a("soba_connect_stripe","Connect Stripe","POST","/workspaces/:workspace/stripe/connect","Answers with Stripe's screen. The person accepts it, signed in to Soba as themselves. Then call soba_get_stripe until connected is true.",{environment:p},["environment"]),a("soba_disconnect_stripe","Disconnect Stripe","DELETE","/workspaces/:workspace/stripe","Nobody can buy a plan after. Only when a person asked for exactly this.",{environment:p,confirm:i("The workspace's name, which the person gave you.")},["environment","confirm"]),a("soba_list_repricing","Subscribers on old prices","GET","/apps/:app/repricing","People still paying a plan's old price, waiting for a decision."),a("soba_decide_repricing","Keep or move subscribers","POST","/apps/:app/repricing","keep leaves them on the old price; move changes what they pay at their next renewal. Tell the person how many and from what to what, and get a yes first.",{old_price:i("From soba_list_repricing."),decision:{type:"string",enum:["keep","move"]},confirm_subscribers:{type:"number",description:"To move: how many they agreed to."}},["old_price","decision"]),a("soba_check_stripe","Check Stripe","POST","/apps/:app/stripe/check","Compares the app's plans with what is in Stripe."),a("soba_restore_stripe_plan","Restore a plan in Stripe","POST","/apps/:app/plans/:plan/stripe/restore","Puts a plan back where it was changed in Stripe directly.",{plan:i()}),a("soba_accept_stripe_change","Leave a change in Stripe","POST","/apps/:app/plans/:plan/stripe/accept","Leaves a change somebody made in Stripe.",{plan:i(),kind:i("As the check reported it.")},["kind"]),a("soba_try_checkout","Try checkout","POST","/apps/:app/plans/:plan/try_checkout","A checkout link for a plan, as a preview buyer. In live mode paying it takes real money.",{plan:i()}),a("soba_set_seats","Set a seat count","PUT","/apps/:app/plans/:plan/seats","Corrects how many seats one user is billed for. Only with a number a person gave you.",{plan:i(),user:i("Your id for them."),quantity:{type:"number"}},["user","quantity"]),a("soba_set_logo","Set a logo from a file","PUT","/apps/:app/logo","The app's icon, or one environment's connect popup logo. PNG, JPEG, GIF, WebP or SVG, up to 2MB.",{file:i("The image's path in this project."),use:{type:"string",enum:["icon","connect_popup"]},environment:{...p,description:"With connect_popup."}},["file"],U),a("soba_set_custom_model_logo","Set a custom model's logo","PUT","/apps/:app/custom_models/:alias/logo","From an image file.",{alias:i(),file:i("The image's path in this project.")},["file"],U),a("soba_set_workspace_logo","Set the workspace's picture","PUT","/workspaces/:workspace/logo","From an image file.",{file:i("The image's path in this project.")},["file"],U),a("soba_update_workspace","Rename the workspace","PATCH","/workspaces/:workspace/settings","Its name, or its picture as an https address or one emoji.",{name:i(),icon:c("string")}),a("soba_transfer_workspace","Transfer the workspace","POST","/workspaces/:workspace/transfer","Hands it over; the owner becomes an admin. Only when the owner asked for exactly this.",{member:i("Their id or email."),confirm:i("The workspace's name, which they gave you.")},["member","confirm"]),a("soba_delete_workspace","Delete the workspace","POST","/workspaces/:workspace/delete","Deletes every app, user, run and key in it. It cannot come back. Only when the owner asked for exactly this and gave you its name.",{confirm:i("The workspace's name, which they gave you.")},["confirm"]),a("soba_update_app","Rename an app","PATCH","/apps/:app","Its name.",{name:i()},["name"]),a("soba_delete_app","Delete an app","DELETE","/apps/:app","Deletes the app and everything that is its. It cannot come back. Only when a person asked for exactly this."),{name:"soba_pair_machine",title:"Pair your machine",description:"A link that pairs the person's own machine with the app, as its first user. They open it and approve it in the Soba app.",credentials:["setup","account"],inputSchema:{type:"object",properties:{app:D.app},additionalProperties:!1},run:async(e,t)=>{let n=e.kind==="setup"?"/v1/manage/pairing":`/v1/apps/${encodeURIComponent(F(t,"app"))}/pairing`,{url:r}=await e.post(n,{});return`Give the person this link, to open and approve themselves: ${r}`}},a("soba_revoke_key","Revoke a key","DELETE","/apps/:app/keys/:key","Anything using it stops at once. Only when a person asked for it.",{key:i("From soba_list_keys.")}),a("soba_list_providers","List providers","GET","/apps/:app/providers","The AI accounts the app pays for, with their models. Keys are never shown."),a("soba_list_provider_services","List known services","GET","/apps/:app/providers/services","OpenAI, Anthropic, Groq and the rest: what soba_add_provider takes as `service`."),a("soba_add_provider","Add a provider","POST","/apps/:app/providers","Adds an AI account the app pays for, used when a user's own AI can't serve a run. This spends the app's money, so only when a person asked.",{service:i("From soba_list_provider_services."),...oe},[],ne),a("soba_update_provider","Change a provider","PATCH","/apps/:app/providers/:provider","Changes what you send. A different host in base_url needs api_key_env with it.",{provider:y,enabled:d(),...oe},[],ne),a("soba_remove_provider","Remove a provider","DELETE","/apps/:app/providers/:provider","Removes it, its key and its models. Only when a person asked for it.",{provider:y}),a("soba_clear_provider_key","Forget a provider's key","DELETE","/apps/:app/providers/:provider/key","Forgets the stored key and keeps the provider. Only when a person asked for it.",{provider:y}),a("soba_order_providers","Order providers","PUT","/apps/:app/providers/order","The order they are tried in, first tried first.",{providers:{type:"array",items:{type:"string"}}},["providers"]),a("soba_list_available_models","What a provider offers","GET","/apps/:app/providers/:provider/available","Asks the provider which models it serves.",{provider:y}),a("soba_set_provider_model","Add or change a model","PUT","/apps/:app/providers/:provider/models","Adds a model to a provider, or changes how users see it. Prices are looked up unless sent.",{provider:y,model:i("The provider's own id for it."),input_per_mtok:{type:"number"},output_per_mtok:{type:"number"},alias:c("string"),label:c("string","The name users see. Needs an alias."),note:c("string"),shown:d("In the model picker."),is_default:d(),tier:{type:["string","null"],enum:["fast","best",null]}},["model"]),a("soba_remove_provider_model","Remove a model","DELETE","/apps/:app/providers/:provider/models","Takes one model off a provider.",{provider:y,model:i()},["model"]),a("soba_list_custom_models","List custom models","GET","/apps/:app/custom_models","The app's own names over models from its providers."),a("soba_set_custom_model","Make or change a custom model","PUT","/apps/:app/custom_models/:alias","One name users pick over one or more models. With a percent on every model (coming to 100) runs are split; without, they are tried in order.",{alias:i("Lowercase and dashes. Fixed once made."),label:i("The name users see."),note:c("string"),icon:c("string"),is_default:d("What a user who picked nothing starts on."),models:{type:"array",items:{type:"object",properties:{provider:i(),model:i(),percent:c("number")},required:["provider","model"]}}}),a("soba_remove_custom_model","Remove a custom model","DELETE","/apps/:app/custom_models/:alias","Takes the name away. Its models stay.",{alias:i()}),a("soba_list_rewards","List rewards","GET","/apps/:app/rewards","Discounts, grants and free plans, with their codes.",{environment:p}),a("soba_create_reward","Create a reward","POST","/apps/:app/rewards","Only with amounts a person gave you.",{environment:p,...se},["environment","name","kind"]),a("soba_update_reward","Change a reward","PATCH","/apps/:app/rewards/:reward","Changes what you send. Only with amounts a person gave you.",{reward:i("Its id or slug."),environment:p,...se}),a("soba_archive_reward","Archive a reward","DELETE","/apps/:app/rewards/:reward","Its codes stop working; who holds it keeps it. Only when a person asked.",{reward:i(),environment:p}),a("soba_give_user_reward","Give a user a reward","POST","/apps/:app/rewards/:reward/give","Once per user per reward. Only when a person asked for that user to get it.",{reward:i(),user:i("Your id for them, or Soba's."),environment:p},["user"]),a("soba_sync_stripe","Put plans in Stripe","POST","/apps/:app/stripe/sync","Puts the app's paid plans into the workspace's connected Stripe now."),a("soba_list_users","List users","GET","/apps/:app/users","The app's users.",{environment:p,...N}),a("soba_get_user","Read a user","GET","/apps/:app/users/:user","Their plan, usage, machines and latest runs.",{user:i("Your id for them, or Soba's."),environment:p}),a("soba_set_user_plan","Put a user on a plan","PATCH","/apps/:app/users/:user","A paid plan given here is a gift: nothing is billed. Null takes their plan away, which leaves them with no limit. Only when a person asked for that user.",{user:i(),plan:c("string","A plan id, or null."),environment:p},["plan"]),a("soba_list_machines","List machines","GET","/apps/:app/machines","Users' machines.",{environment:p,...N}),a("soba_get_machine","Read a machine","GET","/apps/:app/machines/:machine","One machine and the AI on it.",{machine:i()}),a("soba_list_runs","List runs","GET","/apps/:app/runs","Runs with totals, speed and cost. Never what was said in them.",{environment:p,range:i("1d, 7d, 30d, 90d or all."),status:i(),class:i("A cost class."),model:i(),error:i(),...N}),a("soba_get_run","Read a run","GET","/apps/:app/runs/:run","One run.",{run:i()}),a("soba_get_activations","Read activations","GET","/apps/:app/activations","Users activated this period."),a("soba_get_overview","Read the overview","GET","/apps/:app/overview","Users, runs, what was spent and what was saved.",{environment:p}),a("soba_list_members","List members","GET","/workspaces/:workspace/members","Who is in the workspace, and open invites."),a("soba_invite_member","Invite somebody","POST","/workspaces/:workspace/invites","Emails an invitation. Only when a person named who to invite.",{email:i(),role:ie},["email"]),a("soba_revoke_invite","Revoke an invite","DELETE","/workspaces/:workspace/invites/:invite","Its link stops working.",{invite:i()}),a("soba_set_member_role","Change a member's role","PATCH","/workspaces/:workspace/members/:member","Only when a person asked. Owners are changed in the dashboard.",{member:i("Their id or email."),role:ie},["role"]),a("soba_remove_member","Remove a member","DELETE","/workspaces/:workspace/members/:member","Ends their access. Only when a person asked.",{member:i("Their id or email.")})];var P={type:"object",properties:{},additionalProperties:!1},Re=["user-subscription","user-hardware","user-api-key","open-weights","frontier"],k={app:{type:"string",description:"The app's id, from soba_list_apps. Not needed with a setup key."},environment:{type:"string",enum:["development","production"],description:"Which catalogue. Required to create with an account credential; a setup key is development only."}},ce={type:"string",description:"The plan's id, from soba_list_plans."},pe={name:{type:"string"},description:{type:"string"},price:{type:"number",description:"Dollars a month. 0 is a free plan."},unit:{type:"string",enum:["run","task","token","cost","credit"],description:"What both allowances are counted in. `cost` counts hundredths of a cent (10,000 to the dollar); a token or cost overage price is per 1M tokens or per $1."},included_units:{type:["number","null"],description:"Runs a month on AI the app pays for (open-weights, frontier). Null is unlimited."},trial_days:{type:"number"},route_prefer:{type:"array",items:{type:"string",enum:["user-subscription","user-hardware","user-api-key","open-weights","frontier"]},description:"What a run may use, best first. This is also the ceiling: a class left out can never be billed to this app."},max_cost_per_run:{type:["number","null"],description:"Dollars one run may cost."},own_included_units:{type:["number","null"],description:"Runs a month on the user's own AI (their machine, subscription or key), counted apart from included_units. Null is unlimited."},own_unit:{type:["string","null"],enum:["run","task","token","cost","credit",null],description:"What own_included_units counts, when not unit: a hybrid plan gives 200 runs on the user's own AI and 2,000 credits on yours. Null means the same as unit."},connected_reward:{type:"string",enum:["none","included","credit"]},connected_included_units:{type:["number","null"]},connected_credit:{type:["number","null"]},route_allow:{type:"array",items:{type:"string",enum:Re},description:"Classes allowed but not ranked, on top of route_prefer."},overage_per_unit:{type:["number","null"],description:"Dollars past the allowance, on a cost or credit plan."},meter:{type:"boolean",description:"On a run, task or token plan: keep going past the allowance, at cost plus markup_percent."},byo_overage:{type:"string",enum:["stop","meter"],description:"When the own-AI allowance is spent: stop, or continue on AI the app pays for."},markup_percent:{type:"number"},markup_overrides:{type:"object",additionalProperties:{type:"number"},description:"Percent per model vendor, over markup_percent."},credits_per_dollar:{type:"number",description:"Credits $1 of AI cost uses."},credit_price:{type:["number","null"],description:"Dollars per 1,000 credits."},credit_packs:{type:["array","null"],items:{type:"object",properties:{credits:{type:"number"},price:{type:"number"}},required:["credits","price"],additionalProperties:!1}},credit_expiry:{type:"string",enum:["never","month_end"]},task_noun:{type:["string","null"],description:"What the app calls a run, plural."},contact_url:{type:["string","null"],description:'A "Talk to us" link (https:// or mailto:). The price becomes 0.'},features:{type:"array",description:"What the app itself enforces, shown on the pricing card.",items:{type:"object",properties:{id:{type:"string",description:"snake_case; the app's code reads it."},name:{type:"string"},type:{type:"string",enum:["boolean","number","text"]},value:{type:["boolean","number","string","null"],description:"Null is unlimited, on a number."},unit:{type:"string"},resets:{type:"string",enum:["month"]},price:{type:"object",description:"Per-unit pricing (seats). amountMicros is millionths of a dollar.",properties:{amountMicros:{type:"number"},included:{type:"number"}},required:["amountMicros","included"]}},required:["id","name","type","value"]}}},Me={is_default:{type:"boolean",description:"Where new users start. A free plan only."},is_popular:{type:"boolean",description:'Shown as "Most popular".'}};function v(e,t){let{app:n,environment:r,plan:o,...s}=t;if(e.kind==="account"&&(typeof n!="string"||!n))throw new Error("Say which app: pass its id as `app`. soba_list_apps lists them.");return{path:e.kind==="setup"?"/v1/manage/plans":`/v1/apps/${encodeURIComponent(n)}/plans`,fields:s,plan:()=>{if(typeof o!="string"||!o)throw new Error("Say which plan: pass its id as `plan`. soba_list_plans lists them.");return encodeURIComponent(o)}}}function de(e,t){if(t.environment)return{environment:t.environment};if(e.kind==="setup")return{};throw new Error("Say which environment: development or production.")}function he(e){let t=e.steps.map(r=>`${r.done?"[x]":"[ ]"} ${r.title} \u2014 ${r.state}`),n=e.complete?"Every step is done. Nothing here needs you again.":`Next: ${e.next}. Call soba_next_step for what to do.`;return`${t.join(`
|
|
557
588
|
`)}
|
|
558
589
|
|
|
559
|
-
${
|
|
590
|
+
${n}`}function Ce(e,t){return e.steps.find(n=>n.id===t)}var Ie=[{name:"soba_status",title:"Read the setup checklist",description:"Soba's setup checklist for this app and which steps are done. Call this first, and again after every change, so you are acting on what is true rather than on what you did last.",inputSchema:P,run:async e=>he(await e.get("/v1/manage/progress"))},{name:"soba_next_step",title:"What to do next",description:"The first outstanding step, with an instruction written for you. Do what it says using your own tools \u2014 read the repo, make the edits, show the diff. Then call soba_status again to confirm it took.",inputSchema:P,run:async e=>{let t=await e.get("/v1/manage/progress");if(t.complete)return"Setup is complete. There is nothing to do.";let n=Ce(t,t.next);return n?n.effect==="human"?n.id==="price"?`Next: ${n.title}
|
|
560
591
|
|
|
561
|
-
${
|
|
592
|
+
${n.lede}
|
|
562
593
|
|
|
563
|
-
Default to the free plan: call soba_create_free_plan, which adds "Bring your own" and starts new users on it. Prices are not yours to decide: if the person wants paid plans, ask what each should cost and include, then call soba_create_plan with the answers.`:
|
|
594
|
+
Default to the free plan: call soba_create_free_plan, which adds "Bring your own" and starts new users on it. Prices are not yours to decide: if the person wants paid plans, ask what each should cost and include, then call soba_create_plan with the answers.`:n.id==="run"?`Next: ${n.title}
|
|
564
595
|
|
|
565
|
-
${
|
|
596
|
+
${n.lede}
|
|
566
597
|
|
|
567
|
-
There is nothing to do here and nothing to press. This step ticks when a request arrives from the app's own call site, so the way to finish it is to run the app and use it. A curl will not do it: the gateway stamps a key at authentication and cannot tell one from a deployment.`:
|
|
598
|
+
There is nothing to do here and nothing to press. This step ticks when a request arrives from the app's own call site, so the way to finish it is to run the app and use it. A curl will not do it: the gateway stamps a key at authentication and cannot tell one from a deployment.`:n.id==="compute"?`Next: ${n.title}
|
|
568
599
|
|
|
569
|
-
${
|
|
600
|
+
${n.lede}
|
|
570
601
|
|
|
571
|
-
Default to Soba: call soba_use_soba, which ticks this step. Leave it for the dashboard only if the person said they want their own model account, because that needs their key.`:`Next: ${
|
|
602
|
+
Default to Soba: call soba_use_soba, which ticks this step. Leave it for the dashboard only if the person said they want their own model account, because that needs their key.`:`Next: ${n.title}
|
|
572
603
|
|
|
573
|
-
${
|
|
604
|
+
${n.lede}
|
|
574
605
|
|
|
575
|
-
This one is done in the dashboard, not from here \u2014 there is no tool on this server for it. Tell whoever asked to open the Set up page and take this step, then call soba_status to confirm it landed.`:`Next: ${
|
|
606
|
+
This one is done in the dashboard, not from here \u2014 there is no tool on this server for it. Tell whoever asked to open the Set up page and take this step, then call soba_status to confirm it landed.`:`Next: ${n.title} (${n.effect})
|
|
576
607
|
|
|
577
|
-
${
|
|
608
|
+
${n.instruction??n.lede}
|
|
578
609
|
|
|
579
|
-
When you are done, call soba_status to confirm it registered.`:
|
|
610
|
+
When you are done, call soba_status to confirm it registered.`:he(t)}},{name:"soba_create_key",title:"Mint a secret key",description:"Mints this app's secret key and returns it ONCE. Write it straight into the project's .env.local as SOBA_KEY, confirm .env.local is gitignored, and do not print it back to the terminal or put it in a file that is committed.",inputSchema:{type:"object",properties:{name:{type:"string",description:"What to call it in the dashboard's key list."},environment:{type:"string",enum:["development","production"],description:"Defaults to production, like the dashboard. Only say development if this key is for a machine that never serves real users."}},additionalProperties:!1},run:async(e,t)=>{let n=await e.post("/v1/manage/keys",{name:t.name??"MCP",environment:t.environment});return`Created ${n.preview} (${n.environment}).
|
|
580
611
|
|
|
581
|
-
SOBA_KEY=${
|
|
612
|
+
SOBA_KEY=${n.key}
|
|
582
613
|
|
|
583
|
-
This is the only time it exists. Put it in .env.local now.`}},{name:"soba_set_connect_url",title:"Point Connect back at the app",description:"Sets where someone who started pairing in their terminal gets sent to sign in. It must be the public https page that renders <ConnectCompute />. If no such page exists yet, do not guess one \u2014 build the page first.",inputSchema:{type:"object",properties:{url:{type:"string",description:"The https URL of the page. Loopback is allowed in development."}},required:["url"],additionalProperties:!1},run:async(
|
|
614
|
+
This is the only time it exists. Put it in .env.local now.`}},{name:"soba_set_connect_url",title:"Point Connect back at the app",description:"Sets where someone who started pairing in their terminal gets sent to sign in. It must be the public https page that renders <ConnectCompute />. If no such page exists yet, do not guess one \u2014 build the page first.",inputSchema:{type:"object",properties:{url:{type:"string",description:"The https URL of the page. Loopback is allowed in development."}},required:["url"],additionalProperties:!1},run:async(e,t)=>(await e.patch("/v1/manage/app",{connect_return_url:t.url}),`Connect now returns to ${t.url}.`)},{name:"soba_set_model_picker",title:"Set the model picker",description:"Sets the <ModelPicker /> the app's users see, the same card as the dashboard's Model Picker. users_choose false means no picker: every message uses Automatic. menu is how providers are laid out. presets are the rows at the top. Send only what should change; the answer is the whole state after it. A prop in the app's code still wins over this.",inputSchema:{type:"object",properties:{users_choose:{type:"boolean",description:"Whether the app's users get a picker at all."},menu:{type:"string",enum:["submenus","two_panes","tabs"],description:"submenus: each provider opens beside the menu. two_panes: providers left, models right. tabs: a tab per provider."},presets:{type:"object",properties:{automatic:{type:"boolean"},fast:{type:"boolean"},best:{type:"boolean"}},additionalProperties:!1,description:"Which of Automatic, Fast and Best head the menu."},search:{type:"boolean",description:"A search field once the list is long enough to need one."}},additionalProperties:!1},run:async(e,t)=>{let r=(await e.patch("/v1/manage/app",{model_picker:t})).model_picker;if(!r.users_choose)return"No picker: every message uses Automatic.";let o=["automatic","fast","best"].filter(s=>r.presets[s]);return`Picker on, ${(r.menu??"submenus").replace("_"," ")}. Presets: ${o.length?o.join(", "):"none"}. Search ${r.search?"on":"off"}.`}},{name:"soba_use_soba",title:"Just use Soba for now",description:"Answers the Providers step: Soba supplies the runs no user's AI serves, and the step ticks. The default unless the person asked to use their own model account. Adding a provider later takes over without undoing this.",inputSchema:P,run:async e=>(await e.patch("/v1/manage/app",{compute_skipped:!0}),"Soba will supply those runs. Call soba_status to confirm the step ticked.")},{name:"soba_list_apps",title:"List apps",description:"Every app you can reach, by workspace, with the id the plan tools take.",credentials:["account"],inputSchema:P,run:async e=>{let{data:t}=await e.get("/v1/workspaces"),n=[];for(let r of t){let o=await e.get(`/v1/workspaces/${r.id}/apps`);n.push(`${r.name}:`,...o.data.map(s=>` ${s.name} \u2014 ${s.id}`))}return n.join(`
|
|
615
|
+
`)||"No workspaces."}},{name:"soba_list_plans",title:"List plans",description:"The app's live plans with every field, as JSON. Read this before changing one. A setup key sees its own environment, development.",credentials:["setup","account"],inputSchema:{type:"object",properties:{...k},additionalProperties:!1},run:async(e,t)=>{let{path:n}=v(e,t),r=e.kind==="account"&&t.environment,o=r?`?environment=${encodeURIComponent(String(r))}`:"",{data:s}=await e.get(`${n}${o}`);return s.length?JSON.stringify(s,null,2):"No plans yet."}},{name:"soba_create_free_plan",title:"Create the free plan",description:'Adds the free "Bring your own" plan: unlimited runs on the AI each user connects, at no cost to the app, and the plan new users start on. The default for an app with no plans. Refused if the app already has one.',credentials:["setup","account"],inputSchema:{type:"object",properties:{...k},additionalProperties:!1},run:async(e,t)=>{let{path:n}=v(e,t),r=await e.post(n,{...de(e,t),template:"byo"});return e.kind==="setup"?`Created the plan "${r.name}". Call soba_status to confirm the steps ticked.`:`Created the plan "${r.name}".`}},{name:"soba_create_plan",title:"Create a plan",description:"Creates a plan: the price, the allowance, what a run may fall back to, and what connecting a machine earns back. Only call this with numbers a person gave you. Do not invent a price. A production plan is on sale at once.",credentials:["setup","account"],inputSchema:{type:"object",properties:{...k,...pe},required:["name","price","route_prefer"],additionalProperties:!1},run:async(e,t)=>{let{path:n,fields:r}=v(e,t),o=await e.post(n,{...de(e,t),...r}),s=o.environment?` in ${o.environment}`:"";return`Created the plan "${o.name}"${s}${o.id?` (${o.id})`:""}.`}},{name:"soba_update_plan",title:"Change a plan",description:"Changes the fields you send on one plan and leaves the rest. Only with numbers a person gave you. Sending route_prefer also sets the ceiling to it. Sending features replaces the whole list.",credentials:["setup","account"],inputSchema:{type:"object",properties:{app:k.app,plan:ce,...pe,...Me},required:["plan"],additionalProperties:!1},run:async(e,t)=>{let{path:n,fields:r,plan:o}=v(e,t),s=await e.patch(`${n}/${o()}`,r);return`Updated. The plan is now:
|
|
616
|
+
${JSON.stringify(s,null,2)}`}},{name:"soba_archive_plan",title:"Archive a plan",description:"Takes a plan off sale. Users already on it keep it, and its history stays. Only when a person asked for this plan to go: there is no tool to bring it back.",credentials:["setup","account"],inputSchema:{type:"object",properties:{app:k.app,plan:ce},required:["plan"],additionalProperties:!1},run:async(e,t)=>{let{path:n,plan:r}=v(e,t);return await e.delete(`${n}/${r()}`),"Archived."}},{name:"soba_give_reward",title:"Give a user a reward",description:"Gives one user a reward the app already has \u2014 money off, extra AI usage, or a plan for some days. Once per user per reward. Only call this when a person asked for that user to get it.",inputSchema:{type:"object",properties:{reward:{type:"string",description:"The reward's ID, e.g. early_bird."},user:{type:"string",description:"The app's own id for the user."}},required:["reward","user"],additionalProperties:!1},run:async(e,t)=>(await e.post("/v1/manage/rewards/give",t),`Gave ${t.user} the reward ${t.reward}.`)}],me=e=>[...Ie,...le].filter(t=>(t.credentials??["setup"]).includes(e));var Le="https://soba.so",Ne="2025-06-18",Ue="0.0.8";function De(e){let t={token:process.env.SOBA_MANAGEMENT_KEY??null,baseUrl:process.env.SOBA_MANAGE_URL??Le},n=!1,r=!!process.env.SOBA_MANAGE_URL;for(let o=0;o<e.length;o++){let s=e[o];s==="--token"?t.token=e[++o]??null:s?.startsWith("--token=")?t.token=s.slice(8):s==="--account"?n=!0:s==="--url"?(t.baseUrl=e[++o]??t.baseUrl,r=!0):s?.startsWith("--url=")&&(t.baseUrl=s.slice(6),r=!0)}if(t.token||(t.token=process.env.SOBA_ACCESS_TOKEN||process.env.SOBA_WORKSPACE_KEY||null),!t.token&&n)try{let o=process.env.SOBA_CONFIG_DIR||fe.join(Oe.homedir(),".soba"),s=JSON.parse(Pe(fe.join(o,"cli.json"),"utf8")),u=new URL(s.url).origin;r&&new URL(t.baseUrl).origin!==u&&(m(`this terminal is signed in to ${u}, not ${t.baseUrl}.`),process.exit(2)),t.token=s.token??null,t.baseUrl=u}catch{m("this terminal is not signed in. Run `npx @soba-so/cli login` first."),process.exit(2)}return t.baseUrl=t.baseUrl.replace(/\/+$/,""),t}var q=De(process.argv.slice(2)),j=q.token;j||(m("no management key. Pass --token mk_soba_\u2026 or set SOBA_MANAGEMENT_KEY."),m("Mint one in your Soba dashboard, on the Set up page. Or pass --account to use"),m("this terminal's `soba login`, for plans in any app and environment."),process.exit(2));/^(mk|pat|wk)_soba_/.test(j)||(m("that is not a management key. It starts with mk_soba_ (or pat_/wk_soba_), and sk_soba_ is a"),m("different credential \u2014 your app's secret key. Do not paste that here."),process.exit(2));var _=new A(j,q.baseUrl),W=me(_.kind),$e=new Map(W.map(e=>[e.name,e])),ge=_.kind==="setup"?L:[];z(async(e,t)=>{switch(e){case"initialize":return{protocolVersion:Ne,capabilities:{tools:{},prompts:{}},serverInfo:{name:"soba",version:Ue},instructions:_.kind==="account"?"Soba, in any app you can reach: settings, models, plans, users. Call soba_list_apps for the app, and read what is there before changing it. Prices are a person's to decide, and a production plan is on sale at once: confirm it with them first.":"Soba's setup checklist. Call soba_status first, then soba_next_step, and do what it says with your own tools \u2014 the repo is yours to edit, not this server's. Call soba_status again afterwards to confirm the step registered rather than assuming it did."};case"notifications/initialized":case"notifications/cancelled":return{};case"ping":return{};case"prompts/list":return{prompts:ge.map(n=>({name:n.name,title:n.title,description:n.description}))};case"prompts/get":{let n=typeof t.name=="string"?t.name:"",r=_.kind==="setup"?V.get(n):void 0;if(!r)throw new Error(`no such prompt: ${n}`);return{description:r.description,messages:[{role:"user",content:{type:"text",text:r.text}}]}}case"tools/list":return{tools:W.map(n=>({name:n.name,title:n.title,description:n.description,inputSchema:n.inputSchema}))};case"tools/call":{let n=typeof t.name=="string"?t.name:"",r=$e.get(n);if(!r)return B(`no such tool: ${n}`);let o=t.arguments??{};try{return{content:[{type:"text",text:await r.run(_,o)}]}}catch(s){return s instanceof w?B(Fe(s)):B(s instanceof Error?s.message:String(s))}}default:throw new Error("method not found")}});function B(e){return{content:[{type:"text",text:e}],isError:!0}}function Fe(e){return e.status===401?_.kind==="account"?"Soba refused the credential. It expired or was revoked: run `npx @soba-so/cli login`.":"Soba refused the management key. It may have been revoked, or it may belong to a different app. Mint a new one on the Set up page.":e.message}m(`ready \u2014 ${W.length} tools, ${ge.length} prompt against ${q.baseUrl}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soba-so/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Sets Soba up from inside your coding agent: it reads the checklist, does the next step, and reads it back.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://soba.so/docs/quickstart",
|