onlymcp 0.25.4 → 0.25.5
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/dist/bin/cli.js +1 -1
- package/dist/bin/mcp.js +1 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{cancel as Er,confirm as Rr,intro as Ut,isCancel as Mt,log as y,multiselect as Ps,outro as de,spinner as Ye}from"@clack/prompts";import{Command as Is}from"commander";import _s from"open";import Ns from"qrcode";import{homedir as Lr}from"node:os";import{createWriteStream as Es,existsSync as D,mkdirSync as Rs}from"node:fs";import{pipeline as Os}from"node:stream/promises";import{Readable as Ls}from"node:stream";import{dirname as Ms,join as Or}from"node:path";import{hostname as ri}from"node:os";import{execFile as qr}from"node:child_process";import{hostname as Zr}from"node:os";import{readFile as Xr}from"node:fs/promises";import{promisify as Qr}from"node:util";import{randomUUID as Wt}from"node:crypto";import{link as Ur,mkdir as zr,readFile as Fr,rename as Gr,rm as Hr,writeFile as Bt}from"node:fs/promises";import{basename as Wr,dirname as Vt,join as Br}from"node:path";import{existsSync as jr}from"node:fs";import{homedir as Ft}from"node:os";import{join as Z}from"node:path";function Se(){return process.env.ONLYMCP_HOME??Z(Ft(),".claude","onlymcp")}function zt(){return process.env.ONLYMCP_HOME??Ft()}function Gt(){return Z(Se(),"device-id")}function Ht(){return Z(Se(),"cache")}function Ce(){return Z(Se(),"stub-ignore")}function $e(){let e=[];process.env.CLAUDE_PLUGIN_ROOT&&e.push(process.env.CLAUDE_PLUGIN_ROOT);for(let t of(process.env.ONLYMCP_STUB_DIRS??"").split(":"))t&&e.push(t);for(let t of[Z(zt(),".claude"),Z(zt(),".codex")])jr(t)&&!e.includes(t)&&e.push(t);return e.length>0?e:[Z(Se(),"plugin")]}var Kr=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,Kt;function Jt(){return Kt??=Vr(),Kt}async function qe(e){try{let t=(await Fr(e,"utf8")).trim().toLowerCase();return Kr.test(t)?t:null}catch{return null}}async function Vr(){let e=Gt(),t=await qe(e);if(t)return t;try{return await zr(Vt(e),{recursive:!0}),await Yr(e)}catch{return null}}var Jr=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS","EXDEV"]);async function Yr(e){let t=Wt(),n=Br(Vt(e),`.${Wr(e)}.${process.pid}.${Wt()}.tmp`);try{await Bt(n,`${t}
|
|
3
3
|
`,{flag:"wx",mode:384});try{return await Ur(n,e),t}catch(i){let o=i.code;if(o!=="EEXIST"&&!Jr.has(o??""))throw i;if(o!=="EEXIST")try{return await Bt(e,`${t}
|
|
4
|
-
`,{flag:"wx",mode:384}),t}catch(s){if(s.code!=="EEXIST")throw s}}let r=await qe(e);return r||(await Gr(n,e),await qe(e)??t)}finally{await Hr(n,{force:!0}).catch(()=>{})}}var ie="0.25.
|
|
4
|
+
`,{flag:"wx",mode:384}),t}catch(s){if(s.code!=="EEXIST")throw s}}let r=await qe(e);return r||(await Gr(n,e),await qe(e)??t)}finally{await Hr(n,{force:!0}).catch(()=>{})}}var ie="0.25.5";var ei=Qr(qr),ti=`onlymcp-cli/${ie} (${process.platform} ${process.arch}; node ${process.versions.node})`,Yt=200;async function qt(e,t){let n;try{return await Promise.race([e,new Promise(r=>{n=setTimeout(()=>r(null),t),n.unref?.()})])}catch{return null}finally{n&&clearTimeout(n)}}async function ni(){try{if(process.platform==="linux"){let e=Xr("/sys/class/dmi/id/product_version","utf8"),n=(await qt(e,Yt))?.trim();return!n||/^(to be filled|default string|system version|none|n\/a)/i.test(n)?null:n}if(process.platform==="darwin"){let e=ei("sysctl",["-n","hw.model"]);return(await qt(e,Yt))?.stdout.trim()||null}}catch{}return null}async function Ze(){let e="unknown";try{e=Zr()||"unknown"}catch{}let t=await ni();return(t&&t!==e?`${e} (${t})`:e).slice(0,60)}var Zt=null;async function pe(){Zt??=await Ze();let e=await Jt();return{"user-agent":ti,"x-onlymcp-device":Zt,...e?{"x-onlymcp-device-id":e}:{}}}var b=class extends Error{constructor(n,r={},i=0){super(n);this.code=n;this.params=r;this.status=i;this.name="ApiError"}code;params;status},z=class{constructor(t,n){this.baseUrl=t;this.token=n}baseUrl;token;async call(t,n={}){let r=this.token();if(!r)throw new b("errors.NOT_LOGGED_IN");let i=await fetch(`${this.baseUrl}${t}`,{...n,headers:{...await pe(),...n.headers??{},authorization:`Bearer ${r}`,"content-type":"application/json"}});if(i.status===204)return;let o=await i.json().catch(()=>({}));if(!i.ok)throw new b(o.code??"errors.UNKNOWN",o.params??{},i.status);return o}getMe(){return this.call("/api/me")}reportRun(t,n){return this.call("/api/devices/current/run",{method:"POST",body:JSON.stringify({kind:t,files:n}),signal:AbortSignal.timeout(5e3)})}signOut(){return this.call("/api/auth/sign-out",{method:"POST",body:"{}",signal:AbortSignal.timeout(5e3)})}listSkills(){return this.call("/api/skills")}getSkill(t,n){return this.call(`/api/skills/${encodeURIComponent(t)}${this.teamQuery(n)}`)}putSkill(t,n,r={}){return this.call(`/api/skills/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({body:n,...r})})}skillFileUrl(t,n){let r=n.split("/").map(encodeURIComponent).join("/");return`/api/skills/${encodeURIComponent(t)}/files/${r}`}getSkillFile(t,n){return this.call(this.skillFileUrl(t,n))}putSkillFile(t,n,r,i="utf8"){return this.call(this.skillFileUrl(t,n),{method:"PUT",body:JSON.stringify({content:r,encoding:i})})}listAgents(){return this.call("/api/agents")}putAgent(t,n){return this.call(`/api/agents/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)})}getAgent(t,{use:n=!1,team:r}={}){let i=[n?"use=1":null,r===void 0?null:`team=${encodeURIComponent(r)}`].filter(Boolean);return this.call(`/api/agents/${encodeURIComponent(t)}${i.length?`?${i.join("&")}`:""}`)}readMemory(t,n){return this.call(`${this.memoryUrl(t)}${this.teamQuery(n)}`)}writeMemory(t,n,r,i){return this.call(this.memoryUrl(t),{method:"PUT",body:JSON.stringify({content:n,deviceLabel:r,...i===void 0?{}:{ifMatch:i}})})}memoryUrl(t){return`/api/memory/${t.split("/").map(encodeURIComponent).join("/")}`}teamQuery(t,n="?"){return t===void 0?"":`${n}team=${encodeURIComponent(t)}`}listMemory(){return this.call("/api/memory")}searchContent(t,n={}){let r=new URLSearchParams({q:t});n.types?.length&&r.set("types",n.types.join(",")),n.limit&&r.set("limit",String(n.limit));for(let i of["type","project","tag"])n[i]!==void 0&&r.set(i,n[i]);return this.call(`/api/search?${r.toString()}`)}graphNodeByRid(t,n){return this.call(`/api/graph/rid/${t}/${encodeURIComponent(n)}`)}graphAround(t,n,r={}){let i=new URLSearchParams({scope:"all",focus:t,depth:String(n),walk:"links"});return r.types?.length&&i.set("types",r.types.join(",")),r.folder!==void 0&&i.set("folder",r.folder),r.project!==void 0&&i.set("project",r.project),this.call(`/api/graph?${i.toString()}`)}memoryTree(t="all"){return this.call(`/api/memory/tree?scope=${encodeURIComponent(t)}`)}moveMemory(t,n,r=!0,i=ri()){return this.call("/api/memory/move",{method:"POST",body:JSON.stringify({from:t,to:n,updateLinks:r,deviceLabel:i})})}async exportArchive(t={}){let n=this.token();if(!n)throw new b("errors.NOT_LOGGED_IN");let r=new URLSearchParams;t.scope&&r.set("scope",t.scope),t.types?.length&&r.set("types",t.types.join(","));let i=r.size>0?`?${r.toString()}`:"",o=await fetch(`${this.baseUrl}/api/export${i}`,{headers:{...await pe(),authorization:`Bearer ${n}`}});if(!o.ok){let s=await o.json().catch(()=>({}));throw new b(s.code??"errors.UNKNOWN",s.params??{},o.status)}return o}deleteMemory(t){return this.call(this.memoryUrl(t),{method:"DELETE"})}deleteSkill(t){return this.call(`/api/skills/${encodeURIComponent(t)}`,{method:"DELETE"})}deleteSkillFile(t,n){return this.call(this.skillFileUrl(t,n),{method:"DELETE"})}deleteAgent(t){return this.call(`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE"})}listConnections(){return this.call("/api/mcp-connections")}listTeams(){return this.call("/api/teams")}shareWithTeam(t,n){return this.call(`/api/teams/${encodeURIComponent(t)}/share`,{method:"POST",body:JSON.stringify(n)})}returnFromTeam(t,n){return this.call(`/api/teams/${encodeURIComponent(t)}/unshare`,{method:"POST",body:JSON.stringify(n)})}createConnection(t){return this.call("/api/mcp-connections",{method:"POST",body:JSON.stringify(t)})}updateConnection(t,n){return this.call(`/api/mcp-connections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}deleteConnection(t){return this.call(`/api/mcp-connections/${t}`,{method:"DELETE"})}listCapabilities(t){return this.call(`/api/mcp-connections/${t}/capabilities`)}toggleCapability(t,n,r){return this.call(`/api/mcp-connections/${t}/capabilities/${n}`,{method:"PATCH",body:JSON.stringify({enabled:r})})}};import{Entry as ii}from"@napi-rs/keyring";function oi(e,t){let n=()=>new ii(e,t);return{save(r){n().setPassword(r)},read(){try{return n().getPassword()}catch{return null}},clear(){try{n().deletePassword()}catch{}}}}var j=oi("onlymcp","session-token");var si={sleep:e=>new Promise(t=>setTimeout(t,e))};async function Xt(e,t,n,r=si){let i=n;for(;;){await r.sleep(i*1e3);let s=await(await fetch(`${e}/api/auth/device/token`,{method:"POST",headers:{...await pe(),"content-type":"application/json"},body:JSON.stringify({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:t,client_id:"onlymcp-cli"})})).json().catch(()=>({}));if(s.access_token)return s.access_token;switch(s.error){case"authorization_pending":break;case"slow_down":i+=5;break;case"access_denied":throw new b("errors.DEVICE_ACCESS_DENIED");case"expired_token":throw new b("errors.DEVICE_CODE_EXPIRED");default:throw new b("errors.DEVICE_LOGIN_FAILED",{error:s.error})}}}import Ae from"cacache";var ai=Number(process.env.ONLYMCP_TTL_SECONDS??360*60),oe=class{constructor(t=Ht()){this.dir=t}dir;async get(t){try{let n=await Ae.get(this.dir,t),r=n.metadata;return!r||r.expiresAt<=Date.now()?(await Ae.rm.entry(this.dir,t),null):n.data.toString("utf8")}catch{return null}}async set(t,n,r=ai){await Ae.put(this.dir,t,n,{metadata:{expiresAt:Date.now()+r*1e3}})}async clear(){await Ae.rm.all(this.dir)}};import{appendFileSync as Hi,existsSync as Le,mkdirSync as cn,readFileSync as pn,writeFileSync as Wi}from"node:fs";import{dirname as mn,join as Bi}from"node:path";function Qt(e){return{language:"bash",text:e}}function Y(e,t){return{language:"json",text:JSON.stringify(e,null,2),path:t}}var li={id:"claude-code",name:"Claude Code",category:"coding",brand:"claudecode",methods:["remote-header","remote-oauth","stdio"],docsUrl:"https://code.claude.com/docs/en/mcp-quickstart",verifiedOn:"2026-09-25",caveats:["clients.caveat.claudeCodeConnectorSynced"],install:{configPath:"~/.claude.json",format:"json",stubDir:null},remote:e=>[Qt(`claude mcp add --transport http --scope user onlymcp ${e.endpoint} --header "Authorization: Bearer ${e.token}"`)]},ci={id:"claude-app",name:"Claude",category:"chat",brand:"claude",methods:["remote-oauth"],docsUrl:"https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp",verifiedOn:"2026-09-25",caveats:["clients.caveat.claudeHeaderBeta"],install:null,oauthRedirectHosts:["claude.ai","claude.com"],remote:()=>null},di={id:"chatgpt",name:"ChatGPT",category:"chat",brand:"openai",methods:["remote-oauth"],docsUrl:"https://help.openai.com/en/articles/12584461-developer-mode-and-mcp-apps-in-chatgpt",verifiedOn:"2026-09-25",caveats:["clients.caveat.chatgptDeveloperMode"],install:null,oauthRedirectHosts:["chatgpt.com"],remote:()=>null},pi={id:"codex",name:"Codex",category:"coding",brand:"openai",methods:["remote-header","remote-oauth","stdio"],docsUrl:"https://learn.chatgpt.com/docs/extend/mcp?surface=cli",verifiedOn:"2026-09-25",caveats:["clients.caveat.codexTokenEnv"],install:{configPath:"~/.codex/config.toml",format:"toml",stubDir:"~/.codex/skills"},remote:e=>[Qt([`export ONLYMCP_TOKEN=${e.token}`,`codex mcp add onlymcp --url ${e.endpoint} --bearer-token-env-var ONLYMCP_TOKEN`].join(`
|
|
5
5
|
`))]},mi={id:"antigravity",aliases:["gemini-cli"],name:"Antigravity",category:"coding",brand:"antigravity",methods:["remote-oauth","remote-header","stdio"],docsUrl:"https://antigravity.google/docs/mcp",verifiedOn:"2026-10-29",caveats:[],install:{configPath:"~/.gemini/config/mcp_config.json",format:"json",stubDir:null},oauthRedirectHosts:["antigravity.google"],remote:e=>[Y({mcpServers:{onlymcp:{serverUrl:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.gemini/config/mcp_config.json")]},ui={id:"gemini-app",name:"Gemini",category:"chat",brand:"googlegemini",methods:["remote-oauth"],docsUrl:"https://support.google.com/gemini/answer/17209137",verifiedOn:"2026-10-10",caveats:["clients.caveat.geminiAppSpark"],install:null,remote:()=>null},gi={id:"grok",name:"Grok",category:"chat",brand:"grok",methods:["remote-oauth"],docsUrl:"https://docs.x.ai/grok/connectors",verifiedOn:"2026-10-17",caveats:["clients.caveat.grokConnectors","clients.caveat.grokBusinessAdmin"],install:null,oauthRedirectHosts:["grok.com"],remote:()=>null},fi={id:"copilot-vscode",name:"GitHub Copilot (VS Code)",category:"ide",brand:"githubcopilot",oauthClientNames:["GitHub Copilot"],methods:["remote-header","remote-oauth","stdio"],docsUrl:"https://code.visualstudio.com/docs/agents/reference/mcp-configuration",verifiedOn:"2026-10-29",caveats:["clients.caveat.copilotPolicy"],install:null,deepLink:"vscode",remote:e=>[Y({servers:{onlymcp:{type:"http",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},".vscode/mcp.json")]},hi={id:"cursor",name:"Cursor",category:"ide",brand:"cursor",methods:["remote-header","remote-oauth","stdio"],docsUrl:"https://cursor.com/docs/mcp",verifiedOn:"2026-09-25",caveats:[],install:null,deepLink:"cursor",remote:e=>[Y({mcpServers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.cursor/mcp.json")]},yi={id:"windsurf",name:"Devin Desktop (Windsurf)",category:"ide",brand:null,methods:["remote-header","stdio"],docsUrl:"https://docs.devin.ai/desktop/cascade/mcp",verifiedOn:"2026-10-29",caveats:["clients.caveat.windsurfAllowlist"],install:null,remote:e=>[Y({mcpServers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.config/devin/mcp_config.json")]},bi={id:"cline",name:"Cline",category:"ide",brand:"cline",methods:["remote-header","stdio"],docsUrl:"https://docs.cline.bot/mcp/mcp-overview",verifiedOn:"2026-10-29",caveats:[],install:null,remote:e=>[Y({mcpServers:{onlymcp:{type:"streamableHttp",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.cline/data/settings/cline_mcp_settings.json")]},ki={id:"zed",name:"Zed",category:"ide",brand:"zedindustries",methods:["remote-header","remote-oauth","stdio"],docsUrl:"https://zed.dev/docs/ai/mcp",verifiedOn:"2026-09-25",caveats:[],install:null,remote:e=>[Y({context_servers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"settings.json")]},xi={id:"opencode",name:"opencode",category:"coding",brand:"opencode",methods:["remote-header","remote-oauth","stdio"],docsUrl:"https://opencode.ai/docs/mcp-servers/",verifiedOn:"2026-10-29",caveats:[],install:null,remote:e=>[Y({mcp:{onlymcp:{type:"remote",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"opencode.json")]},wi={id:"gitlab-duo",name:"GitLab Duo",category:"ide",brand:"gitlab",methods:["remote-oauth"],docsUrl:"https://docs.gitlab.com/user/gitlab_duo/model_context_protocol/mcp_clients",verifiedOn:"2026-10-29",caveats:["clients.caveat.gitlabDuoUserFile"],install:null,remote:e=>[Y({mcpServers:{onlymcp:{type:"http",url:e.endpoint}}},"~/.gitlab/duo/mcp.json")]},Te=[ci,di,ui,gi,li,pi,mi,xi,fi,hi,yi,bi,ki,wi];function Xe(e){return Te.find(t=>t.id===e||t.aliases?.includes(e))}var vi=/^[a-z0-9][a-z0-9._-]*(\/[a-z0-9][a-z0-9._-]*)*\.md$/i;function A(e){return vi.test(e)&&!e.split("/").includes("..")}var Si=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,Ci=8,$i=200;function q(e){if(e.length===0||e.length>$i||e==="SKILL.md")return!1;let t=e.split("/");return t.length>Ci?!1:t.every(n=>Si.test(n)&&n!==".."&&n!==".")}function Ai(e){return e.includes("\\")||/^[A-Za-z]:/.test(e)?!0:e.split("/").some(t=>t===""||t==="."||t==="..")}var Ti=[/^\.env(\..+)?$/i,/^\.credentials\.json$/i,/^id_(rsa|dsa|ecdsa|ed25519)(\.pub)?$/i,/\.(pem|key|p12|pfx|jks|keystore)$/i,/^\.(npmrc|netrc|pgpass|htpasswd)$/i,/^\.git-credentials$/i];function Ie(e){return Ti.some(t=>t.test(e))}var Pi=new Set([".git","node_modules","__pycache__",".venv","venv",".pytest_cache",".mypy_cache","dist","build",".next",".cache"]);function Qe(e){return Pi.has(e)}var Ii=[{rule:"anthropic",re:/\bsk-ant-[A-Za-z0-9_-]{20,}/},{rule:"openai",re:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}/},{rule:"github",re:/\bgh[pousr]_[A-Za-z0-9]{36,}/},{rule:"aws",re:/\bAKIA[0-9A-Z]{16}\b/},{rule:"slack",re:/\bxox[baprs]-[A-Za-z0-9-]{10,}/},{rule:"google",re:/\bAIza[0-9A-Za-z_-]{35}\b/},{rule:"jwt",re:/\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\./},{rule:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/},{rule:"url-credentials",re:/\b[a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:[^\s:/@]{6,}@/i},{rule:"assignment",re:/\b(api[_-]?key|secret|passwd|password|token|credential)\b\s*[:=]\s*['"][^'"\s]{16,}['"]/i}];function _i(e,t){let n=e.indexOf(t);return`${e.slice(Math.max(0,n-24),n)}\u2026${t.slice(0,4)}\u2026 (${t.length} characters)`}function nn(e){let t=[],n=e.split(`
|
|
6
6
|
`);for(let r=0;r<n.length;r+=1){let i=n[r];for(let{rule:o,re:s}of Ii){let d=s.exec(i);if(d){t.push({rule:o,line:r+1,excerpt:_i(i,d[0])});break}}}return t}function Q(e){if(!e.startsWith(`---
|
|
7
7
|
`))return null;let t=e.indexOf(`
|
package/dist/bin/mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{Server as oo}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as io}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as so,GetPromptRequestSchema as ao,ListPromptsRequestSchema as lo,ListResourceTemplatesRequestSchema as co,ListResourcesRequestSchema as po,ListToolsRequestSchema as mo,ReadResourceRequestSchema as uo}from"@modelcontextprotocol/sdk/types.js";import{hostname as Wn}from"node:os";import{execFile as Mn}from"node:child_process";import{hostname as Un}from"node:os";import{readFile as Dn}from"node:fs/promises";import{promisify as jn}from"node:util";import{randomUUID as ot}from"node:crypto";import{link as An,mkdir as Tn,readFile as $n,rename as In,rm as _n,writeFile as it}from"node:fs/promises";import{basename as Nn,dirname as at,join as En}from"node:path";import{existsSync as Cn}from"node:fs";import{homedir as Qe}from"node:os";import{join as O}from"node:path";function ne(){return process.env.ONLYMCP_HOME??O(Qe(),".claude","onlymcp")}function Xe(){return process.env.ONLYMCP_HOME??Qe()}function et(){return O(ne(),"device-id")}function tt(){return O(ne(),"cache")}function nt(){return O(ne(),"stub-ignore")}function rt(){let t=[];process.env.CLAUDE_PLUGIN_ROOT&&t.push(process.env.CLAUDE_PLUGIN_ROOT);for(let e of(process.env.ONLYMCP_STUB_DIRS??"").split(":"))e&&t.push(e);for(let e of[O(Xe(),".claude"),O(Xe(),".codex")])Cn(e)&&!t.includes(e)&&t.push(e);return t.length>0?t:[O(ne(),"plugin")]}var Ln=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,st;function lt(){return st??=Rn(),st}async function Se(t){try{let e=(await $n(t,"utf8")).trim().toLowerCase();return Ln.test(e)?e:null}catch{return null}}async function Rn(){let t=et(),e=await Se(t);if(e)return e;try{return await Tn(at(t),{recursive:!0}),await On(t)}catch{return null}}var Pn=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS","EXDEV"]);async function On(t){let e=ot(),n=En(at(t),`.${Nn(t)}.${process.pid}.${ot()}.tmp`);try{await it(n,`${e}
|
|
3
3
|
`,{flag:"wx",mode:384});try{return await An(n,t),e}catch(o){let i=o.code;if(i!=="EEXIST"&&!Pn.has(i??""))throw o;if(i!=="EEXIST")try{return await it(t,`${e}
|
|
4
|
-
`,{flag:"wx",mode:384}),e}catch(s){if(s.code!=="EEXIST")throw s}}let r=await Se(t);return r||(await In(n,t),await Se(t)??e)}finally{await _n(n,{force:!0}).catch(()=>{})}}var re="0.25.
|
|
4
|
+
`,{flag:"wx",mode:384}),e}catch(s){if(s.code!=="EEXIST")throw s}}let r=await Se(t);return r||(await In(n,t),await Se(t)??e)}finally{await _n(n,{force:!0}).catch(()=>{})}}var re="0.25.5";var zn=jn(Mn),Gn=`onlymcp-cli/${re} (${process.platform} ${process.arch}; node ${process.versions.node})`,ct=200;async function dt(t,e){let n;try{return await Promise.race([t,new Promise(r=>{n=setTimeout(()=>r(null),e),n.unref?.()})])}catch{return null}finally{n&&clearTimeout(n)}}async function Fn(){try{if(process.platform==="linux"){let t=Dn("/sys/class/dmi/id/product_version","utf8"),n=(await dt(t,ct))?.trim();return!n||/^(to be filled|default string|system version|none|n\/a)/i.test(n)?null:n}if(process.platform==="darwin"){let t=zn("sysctl",["-n","hw.model"]);return(await dt(t,ct))?.stdout.trim()||null}}catch{}return null}async function Hn(){let t="unknown";try{t=Un()||"unknown"}catch{}let e=await Fn();return(e&&e!==t?`${t} (${e})`:t).slice(0,60)}var pt=null;async function we(){pt??=await Hn();let t=await lt();return{"user-agent":Gn,"x-onlymcp-device":pt,...t?{"x-onlymcp-device-id":t}:{}}}var m=class extends Error{constructor(n,r={},o=0){super(n);this.code=n;this.params=r;this.status=o;this.name="ApiError"}code;params;status},oe=class{constructor(e,n){this.baseUrl=e;this.token=n}baseUrl;token;async call(e,n={}){let r=this.token();if(!r)throw new m("errors.NOT_LOGGED_IN");let o=await fetch(`${this.baseUrl}${e}`,{...n,headers:{...await we(),...n.headers??{},authorization:`Bearer ${r}`,"content-type":"application/json"}});if(o.status===204)return;let i=await o.json().catch(()=>({}));if(!o.ok)throw new m(i.code??"errors.UNKNOWN",i.params??{},o.status);return i}getMe(){return this.call("/api/me")}reportRun(e,n){return this.call("/api/devices/current/run",{method:"POST",body:JSON.stringify({kind:e,files:n}),signal:AbortSignal.timeout(5e3)})}signOut(){return this.call("/api/auth/sign-out",{method:"POST",body:"{}",signal:AbortSignal.timeout(5e3)})}listSkills(){return this.call("/api/skills")}getSkill(e,n){return this.call(`/api/skills/${encodeURIComponent(e)}${this.teamQuery(n)}`)}putSkill(e,n,r={}){return this.call(`/api/skills/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({body:n,...r})})}skillFileUrl(e,n){let r=n.split("/").map(encodeURIComponent).join("/");return`/api/skills/${encodeURIComponent(e)}/files/${r}`}getSkillFile(e,n){return this.call(this.skillFileUrl(e,n))}putSkillFile(e,n,r,o="utf8"){return this.call(this.skillFileUrl(e,n),{method:"PUT",body:JSON.stringify({content:r,encoding:o})})}listAgents(){return this.call("/api/agents")}putAgent(e,n){return this.call(`/api/agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(n)})}getAgent(e,{use:n=!1,team:r}={}){let o=[n?"use=1":null,r===void 0?null:`team=${encodeURIComponent(r)}`].filter(Boolean);return this.call(`/api/agents/${encodeURIComponent(e)}${o.length?`?${o.join("&")}`:""}`)}readMemory(e,n){return this.call(`${this.memoryUrl(e)}${this.teamQuery(n)}`)}writeMemory(e,n,r,o){return this.call(this.memoryUrl(e),{method:"PUT",body:JSON.stringify({content:n,deviceLabel:r,...o===void 0?{}:{ifMatch:o}})})}memoryUrl(e){return`/api/memory/${e.split("/").map(encodeURIComponent).join("/")}`}teamQuery(e,n="?"){return e===void 0?"":`${n}team=${encodeURIComponent(e)}`}listMemory(){return this.call("/api/memory")}searchContent(e,n={}){let r=new URLSearchParams({q:e});n.types?.length&&r.set("types",n.types.join(",")),n.limit&&r.set("limit",String(n.limit));for(let o of["type","project","tag"])n[o]!==void 0&&r.set(o,n[o]);return this.call(`/api/search?${r.toString()}`)}graphNodeByRid(e,n){return this.call(`/api/graph/rid/${e}/${encodeURIComponent(n)}`)}graphAround(e,n,r={}){let o=new URLSearchParams({scope:"all",focus:e,depth:String(n),walk:"links"});return r.types?.length&&o.set("types",r.types.join(",")),r.folder!==void 0&&o.set("folder",r.folder),r.project!==void 0&&o.set("project",r.project),this.call(`/api/graph?${o.toString()}`)}memoryTree(e="all"){return this.call(`/api/memory/tree?scope=${encodeURIComponent(e)}`)}moveMemory(e,n,r=!0,o=Wn()){return this.call("/api/memory/move",{method:"POST",body:JSON.stringify({from:e,to:n,updateLinks:r,deviceLabel:o})})}async exportArchive(e={}){let n=this.token();if(!n)throw new m("errors.NOT_LOGGED_IN");let r=new URLSearchParams;e.scope&&r.set("scope",e.scope),e.types?.length&&r.set("types",e.types.join(","));let o=r.size>0?`?${r.toString()}`:"",i=await fetch(`${this.baseUrl}/api/export${o}`,{headers:{...await we(),authorization:`Bearer ${n}`}});if(!i.ok){let s=await i.json().catch(()=>({}));throw new m(s.code??"errors.UNKNOWN",s.params??{},i.status)}return i}deleteMemory(e){return this.call(this.memoryUrl(e),{method:"DELETE"})}deleteSkill(e){return this.call(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}deleteSkillFile(e,n){return this.call(this.skillFileUrl(e,n),{method:"DELETE"})}deleteAgent(e){return this.call(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"})}listConnections(){return this.call("/api/mcp-connections")}listTeams(){return this.call("/api/teams")}shareWithTeam(e,n){return this.call(`/api/teams/${encodeURIComponent(e)}/share`,{method:"POST",body:JSON.stringify(n)})}returnFromTeam(e,n){return this.call(`/api/teams/${encodeURIComponent(e)}/unshare`,{method:"POST",body:JSON.stringify(n)})}createConnection(e){return this.call("/api/mcp-connections",{method:"POST",body:JSON.stringify(e)})}updateConnection(e,n){return this.call(`/api/mcp-connections/${e}`,{method:"PATCH",body:JSON.stringify(n)})}deleteConnection(e){return this.call(`/api/mcp-connections/${e}`,{method:"DELETE"})}listCapabilities(e){return this.call(`/api/mcp-connections/${e}/capabilities`)}toggleCapability(e,n,r){return this.call(`/api/mcp-connections/${e}/capabilities/${n}`,{method:"PATCH",body:JSON.stringify({enabled:r})})}};var Bn="https://only-mcp.com";function mt(t=process.env.ONLYMCP_API_URL){if(t===void 0)return Bn;let e;try{e=new URL(t).protocol}catch{}if(e!=="http:"&&e!=="https:"){let n=t.replace(/\/\/[^/@]*@/,"//***@");throw new Error(`ONLYMCP_API_URL is not a valid http(s) URL: ${JSON.stringify(n)}`)}return t}import{Entry as Kn}from"@napi-rs/keyring";function Vn(t,e){let n=()=>new Kn(t,e);return{save(r){n().setPassword(r)},read(){try{return n().getPassword()}catch{return null}},clear(){try{n().deletePassword()}catch{}}}}var ut=Vn("onlymcp","session-token");import ie from"cacache";var Jn=Number(process.env.ONLYMCP_TTL_SECONDS??360*60),se=class{constructor(e=tt()){this.dir=e}dir;async get(e){try{let n=await ie.get(this.dir,e),r=n.metadata;return!r||r.expiresAt<=Date.now()?(await ie.rm.entry(this.dir,e),null):n.data.toString("utf8")}catch{return null}}async set(e,n,r=Jn){await ie.put(this.dir,e,n,{metadata:{expiresAt:Date.now()+r*1e3}})}async clear(){await ie.rm.all(this.dir)}};var ft=["OnlyMCP holds this user's skills, agents and memory in the cloud, identical","on every machine. The names below are names only, not content: call","get_skill(name) to load a skill before following it, and","get_agent_definition(name) for an agent. Call list_skills or list_agents for","anything not named here. Memory is live: memory_read(path) and","memory_write(path, content). All of it is writable, not just readable:","skill_write, agent_write and the matching *_delete tools; connection_create","adds another MCP server to this account.","Link with [[name]] or typed: [[skill:name]], [[agent:name]], [[mcp:slug]], [[memory:path]]."].join(" "),qn=["Memory is a vault, not a scratch file: read MEMORY.md first, it is the index.","After finishing a task, write one solutions/sol-*.md for what was not obvious","and one entry in history/YYYY-MM-DD.md. Link related files with [[name]];","memory_links(path) says which of a file's links point nowhere yet."].join(" ");function gt(t,e,n,r){if(n.length===0)return"";let o=[];for(let c of n){let a=n.length-o.length-1,f=a>0?` (+${a} more, call ${e})`:"",g=`
|
|
5
5
|
|
|
6
6
|
${t}: ${[...o,c].join(", ")}${f}`;if(r+g.length>1800)break;o.push(c)}if(o.length===0)return`
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onlymcp",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.5",
|
|
4
4
|
"description": "Skills, agents and memory from the OnlyMCP cloud in every MCP client. Ships the stdio MCP server and the CLI that sets up Claude Code, Codex and Antigravity.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Francesco Palazzo",
|