@soba-so/mcp 0.0.9 → 0.0.10

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.
Files changed (2) hide show
  1. package/dist/mcp.mjs +3 -3
  2. package/package.json +1 -1
package/dist/mcp.mjs CHANGED
@@ -583,7 +583,7 @@ ${H}`}],V=new Map(L.map(e=>[e.name,e]));function m(e){process.stderr.write(`soba
583
583
  `)?"":`
584
584
  `;return await ve(o,`${u}${M.basename(e)}
585
585
  `),o}var C={type:"string",description:"The app's id, from soba_list_apps."},d={type:"string",enum:["development","production"]},i=e=>({type:"string",...e?{description:e}:{}}),c=(e,t)=>({type:[e,"null"],...t?{description:t}:{}}),p=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:C}:{},...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=I(b.resolve(e)),n=I(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=I(b.dirname(s)),l=I(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:p(),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:{...C,description:`${C.description} Not needed with a setup key.`},environment:{...d,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:p(),show_code:p(),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:p("False is no picker."),menu:{type:"string",enum:["submenus","two_panes","tabs"]},presets:{type:"object",properties:{automatic:p(),fast:p(),best:p()},additionalProperties:!1},search:p(),effort:p("The Effort row under the models."),effort_style:{type:"string",enum:["switch","list"]},labels:p("False: logos alone for the AIs and providers."),suggested:p("False hides the Suggested group; true brings it back.")},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:p("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:p("Try another of the app's providers when one fails."),outage_fallback:p("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:p("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:
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=I(b.resolve(e)),n=I(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=I(b.dirname(s)),l=I(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:p(),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:{...C,description:`${C.description} Not needed with a setup key.`},environment:{...d,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:p(),show_code:p(),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:p("False is no picker."),menu:{type:"string",enum:["submenus","two_panes","tabs","single"]},presets:{type:"object",properties:{automatic:p(),fast:p(),best:p()},additionalProperties:!1},search:p(),effort:p("The Effort row under the models."),effort_style:{type:"string",enum:["switch","list"]},labels:p("False: logos alone for the AIs and providers."),suggested:p("False hides the Suggested group; true brings it back.")},additionalProperties:!1},own_ai:{type:["array","null"],items:{type:"string"},description:"AIs users may connect: claude, chatgpt, gemini, local\u2026 Null is the default (claude, chatgpt). [] turns users' own AI off: no run reaches it."},ask_to_connect:p("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:p("Try another of the app's providers when one fails."),outage_fallback:p("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:p("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
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:C,environment:d,replace_idle:p("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:d},["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:d},["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:d,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:{...d,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:p(),...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:p("In the model picker."),is_default:p(),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:p("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:d}),a("soba_create_reward","Create a reward","POST","/apps/:app/rewards","Only with amounts a person gave you.",{environment:d,...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:d,...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:d}),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:d},["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:d,...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:d}),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:d},["plan"]),a("soba_list_machines","List machines","GET","/apps/:app/machines","Users' machines.",{environment:d,...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:d,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:d}),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(`
588
588
  `)}
589
589
 
@@ -611,6 +611,6 @@ When you are done, call soba_status to confirm it registered.`:he(t)}},{name:"so
611
611
 
612
612
  SOBA_KEY=${n.key}
613
613
 
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."},effort:{type:"boolean",description:"An Effort row (Auto, Low, Medium, High, Extra, Max) for models that take it. On by default."},effort_style:{type:"string",enum:["switch","list"],description:"Effort as a row of steps (switch) or rows with a tick (list). Default: list in two_panes and tabs, switch elsewhere."},suggested:{type:"boolean",description:"False hides the Suggested group (every preset off); true brings it back with all three when none is on."},labels:{type:"boolean",description:"False: the AIs and providers as their logos alone, the name on hover. On by default."}},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"}. Effort ${r.effort!==!1?"on":"off"}${r.effort_style?` (${r.effort_style})`:""}. Labels ${r.labels!==!1?"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(`
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","single"],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."},effort:{type:"boolean",description:"An Effort row (Auto, Low, Medium, High, Extra, Max) for models that take it. On by default."},effort_style:{type:"string",enum:["switch","list"],description:"Effort as a row of steps (switch) or rows with a tick (list). Default: list in two_panes and tabs, switch elsewhere."},suggested:{type:"boolean",description:"False hides the Suggested group (every preset off); true brings it back with all three when none is on."},labels:{type:"boolean",description:"False: the AIs and providers as their logos alone, the name on hover. On by default."}},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"}. Effort ${r.effort!==!1?"on":"off"}${r.effort_style?` (${r.effort_style})`:""}. Labels ${r.labels!==!1?"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
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=>[...Ce,...le].filter(t=>(t.credentials??["setup"]).includes(e));var Le="https://soba.so",Ne="2025-06-18",Ue="0.0.9";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}`);
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=>[...Ce,...le].filter(t=>(t.credentials??["setup"]).includes(e));var Le="https://soba.so",Ne="2025-06-18",Ue="0.0.10";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.9",
3
+ "version": "0.0.10",
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",