onlymcp 0.24.0 → 0.24.2
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 +2 -2
- package/dist/bin/mcp.js +1 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{cancel as mr,confirm as dr,intro as wt,isCancel as bt,log as u,multiselect as es,outro as ie,spinner as De}from"@clack/prompts";import{Command as ts}from"commander";import ns from"open";import rs from"qrcode";import{homedir as fr}from"node:os";import{createWriteStream as is,existsSync as T,mkdirSync as os}from"node:fs";import{pipeline as ss}from"node:stream/promises";import{Readable as as}from"node:stream";import{dirname as ls,join as ur}from"node:path";import{hostname as Ur}from"node:os";import{execFile as _r}from"node:child_process";import{hostname as Er}from"node:os";import{readFile as Rr}from"node:fs/promises";import{promisify as Nr}from"node:util";import{randomUUID as Tt}from"node:crypto";import{link as kr,mkdir as xr,readFile as wr,rename as vr,rm as Sr,writeFile as It}from"node:fs/promises";import{basename as Cr,dirname as Et,join as Ar}from"node:path";import{existsSync as br}from"node:fs";import{homedir as At}from"node:os";import{join as H}from"node:path";function ge(){return process.env.ONLYMCP_HOME??H(At(),".claude","onlymcp")}function Ct(){return process.env.ONLYMCP_HOME??At()}function $t(){return H(ge(),"device-id")}function Pt(){return H(ge(),"cache")}function he(){return H(ge(),"stub-ignore")}function ye(){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[H(Ct(),".claude"),H(Ct(),".codex")])br(t)&&!e.includes(t)&&e.push(t);return e.length>0?e:[H(ge(),"plugin")]}var $r=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,_t;function Rt(){return _t??=Pr(),_t}async function ze(e){try{let t=(await wr(e,"utf8")).trim().toLowerCase();return $r.test(t)?t:null}catch{return null}}async function Pr(){let e=$t(),t=await ze(e);if(t)return t;try{return await xr(Et(e),{recursive:!0}),await Ir(e)}catch{return null}}var Tr=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS","EXDEV"]);async function Ir(e){let t=Tt(),n=Ar(Et(e),`.${Cr(e)}.${process.pid}.${Tt()}.tmp`);try{await It(n,`${t}
|
|
3
3
|
`,{flag:"wx",mode:384});try{return await kr(n,e),t}catch(i){let o=i.code;if(o!=="EEXIST"&&!Tr.has(o??""))throw i;if(o!=="EEXIST")try{return await It(e,`${t}
|
|
4
|
-
`,{flag:"wx",mode:384}),t}catch(s){if(s.code!=="EEXIST")throw s}}let r=await ze(e);return r||(await vr(n,e),await ze(e)??t)}finally{await Sr(n,{force:!0}).catch(()=>{})}}var Z="0.24.
|
|
5
|
-
`))]},Kr={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=>[U({mcpServers:{onlymcp:{serverUrl:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.gemini/config/mcp_config.json")]},Vr={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},Jr={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},Yr={id:"copilot-vscode",name:"GitHub Copilot (VS Code)",category:"ide",brand:"githubcopilot",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=>[U({servers:{onlymcp:{type:"http",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},".vscode/mcp.json")]},qr={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=>[U({mcpServers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.cursor/mcp.json")]},Zr={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=>[U({mcpServers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.config/devin/mcp_config.json")]},Xr={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=>[U({mcpServers:{onlymcp:{type:"streamableHttp",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.cline/data/settings/cline_mcp_settings.json")]},Qr={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=>[U({context_servers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"settings.json")]},ei={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=>[U({mcp:{onlymcp:{type:"remote",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"opencode.json")]},ti={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=>[U({mcpServers:{onlymcp:{type:"http",url:e.endpoint}}},"~/.gitlab/duo/mcp.json")]},ke=[Br,Wr,Vr,Jr,Hr,Gr,Kr,ei,Yr,qr,Zr,Xr,Qr,ti];function He(e){return ke.find(t=>t.id===e||t.aliases?.includes(e))}var ni=/^[a-z0-9][a-z0-9._-]*(\/[a-z0-9][a-z0-9._-]*)*\.md$/i;function S(e){return ni.test(e)&&!e.split("/").includes("..")}var ri=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,ii=8,oi=200;function D(e){if(e.length===0||e.length>oi||e==="SKILL.md")return!1;let t=e.split("/");return t.length>ii?!1:t.every(n=>ri.test(n)&&n!==".."&&n!==".")}function si(e){return e.includes("\\")||/^[A-Za-z]:/.test(e)?!0:e.split("/").some(t=>t===""||t==="."||t==="..")}var ai=[/^\.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 we(e){return ai.some(t=>t.test(e))}var li=new Set([".git","node_modules","__pycache__",".venv","venv",".pytest_cache",".mypy_cache","dist","build",".next",".cache"]);function Be(e){return li.has(e)}var ci=[{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 pi(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 zt(e){let t=[],n=e.split(`
|
|
4
|
+
`,{flag:"wx",mode:384}),t}catch(s){if(s.code!=="EEXIST")throw s}}let r=await ze(e);return r||(await vr(n,e),await ze(e)??t)}finally{await Sr(n,{force:!0}).catch(()=>{})}}var Z="0.24.2";var Or=Nr(_r),Lr=`onlymcp-cli/${Z} (${process.platform} ${process.arch}; node ${process.versions.node})`,Nt=200;async function Ot(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 Mr(){try{if(process.platform==="linux"){let e=Rr("/sys/class/dmi/id/product_version","utf8"),n=(await Ot(e,Nt))?.trim();return!n||/^(to be filled|default string|system version|none|n\/a)/i.test(n)?null:n}if(process.platform==="darwin"){let e=Or("sysctl",["-n","hw.model"]);return(await Ot(e,Nt))?.stdout.trim()||null}}catch{}return null}async function Fe(){let e="unknown";try{e=Er()||"unknown"}catch{}let t=await Mr();return(t&&t!==e?`${e} (${t})`:e).slice(0,60)}var Lt=null;async function oe(){Lt??=await Fe();let e=await Rt();return{"user-agent":Lr,"x-onlymcp-device":Lt,...e?{"x-onlymcp-device-id":e}:{}}}var y=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},_=class{constructor(t,n){this.baseUrl=t;this.token=n}baseUrl;token;async call(t,n={}){let r=this.token();if(!r)throw new y("errors.NOT_LOGGED_IN");let i=await fetch(`${this.baseUrl}${t}`,{...n,headers:{...await oe(),...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 y(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});return n.types?.length&&r.set("types",n.types.join(",")),n.limit&&r.set("limit",String(n.limit)),this.call(`/api/search?${r.toString()}`)}memoryTree(t="all"){return this.call(`/api/memory/tree?scope=${encodeURIComponent(t)}`)}moveMemory(t,n,r=!0,i=Ur()){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 y("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 oe(),authorization:`Bearer ${n}`}});if(!o.ok){let s=await o.json().catch(()=>({}));throw new y(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 Dr}from"@napi-rs/keyring";function jr(e,t){let n=()=>new Dr(e,t);return{save(r){n().setPassword(r)},read(){try{return n().getPassword()}catch{return null}},clear(){try{n().deletePassword()}catch{}}}}var I=jr("onlymcp","session-token");var zr={sleep:e=>new Promise(t=>setTimeout(t,e))};async function Mt(e,t,n,r=zr){let i=n;for(;;){await r.sleep(i*1e3);let s=await(await fetch(`${e}/api/auth/device/token`,{method:"POST",headers:{...await oe(),"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 y("errors.DEVICE_ACCESS_DENIED");case"expired_token":throw new y("errors.DEVICE_CODE_EXPIRED");default:throw new y("errors.DEVICE_LOGIN_FAILED",{error:s.error})}}}import be from"cacache";var Fr=Number(process.env.ONLYMCP_TTL_SECONDS??360*60),X=class{constructor(t=Pt()){this.dir=t}dir;async get(t){try{let n=await be.get(this.dir,t),r=n.metadata;return!r||r.expiresAt<=Date.now()?(await be.rm.entry(this.dir,t),null):n.data.toString("utf8")}catch{return null}}async set(t,n,r=Fr){await be.put(this.dir,t,n,{metadata:{expiresAt:Date.now()+r*1e3}})}async clear(){await be.rm.all(this.dir)}};import{appendFileSync as yi,existsSync as Ce,mkdirSync as Bt,readFileSync as Gt,writeFileSync as bi}from"node:fs";import{dirname as Kt,join as ki}from"node:path";function Ut(e){return{language:"bash",text:e}}function U(e,t){return{language:"json",text:JSON.stringify(e,null,2),path:t}}var Hr={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=>[Ut(`claude mcp add --transport http --scope user onlymcp ${e.endpoint} --header "Authorization: Bearer ${e.token}"`)]},Br={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},Wr={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},Gr={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=>[Ut([`export ONLYMCP_TOKEN=${e.token}`,`codex mcp add onlymcp --url ${e.endpoint} --bearer-token-env-var ONLYMCP_TOKEN`].join(`
|
|
5
|
+
`))]},Kr={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=>[U({mcpServers:{onlymcp:{serverUrl:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.gemini/config/mcp_config.json")]},Vr={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},Jr={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},Yr={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=>[U({servers:{onlymcp:{type:"http",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},".vscode/mcp.json")]},qr={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=>[U({mcpServers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.cursor/mcp.json")]},Zr={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=>[U({mcpServers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.config/devin/mcp_config.json")]},Xr={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=>[U({mcpServers:{onlymcp:{type:"streamableHttp",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"~/.cline/data/settings/cline_mcp_settings.json")]},Qr={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=>[U({context_servers:{onlymcp:{url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"settings.json")]},ei={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=>[U({mcp:{onlymcp:{type:"remote",url:e.endpoint,headers:{Authorization:`Bearer ${e.token}`}}}},"opencode.json")]},ti={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=>[U({mcpServers:{onlymcp:{type:"http",url:e.endpoint}}},"~/.gitlab/duo/mcp.json")]},ke=[Br,Wr,Vr,Jr,Hr,Gr,Kr,ei,Yr,qr,Zr,Xr,Qr,ti];function He(e){return ke.find(t=>t.id===e||t.aliases?.includes(e))}var ni=/^[a-z0-9][a-z0-9._-]*(\/[a-z0-9][a-z0-9._-]*)*\.md$/i;function S(e){return ni.test(e)&&!e.split("/").includes("..")}var ri=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,ii=8,oi=200;function D(e){if(e.length===0||e.length>oi||e==="SKILL.md")return!1;let t=e.split("/");return t.length>ii?!1:t.every(n=>ri.test(n)&&n!==".."&&n!==".")}function si(e){return e.includes("\\")||/^[A-Za-z]:/.test(e)?!0:e.split("/").some(t=>t===""||t==="."||t==="..")}var ai=[/^\.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 we(e){return ai.some(t=>t.test(e))}var li=new Set([".git","node_modules","__pycache__",".venv","venv",".pytest_cache",".mypy_cache","dist","build",".next",".cache"]);function Be(e){return li.has(e)}var ci=[{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 pi(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 zt(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 ci){let p=s.exec(i);if(p){t.push({rule:o,line:r+1,excerpt:pi(i,p[0])});break}}}return t}function W(e){if(!e.startsWith(`---
|
|
7
7
|
`))return null;let t=e.indexOf(`
|
|
8
8
|
---`,3);return t<0?null:e.slice(4,t)}function E(e,t){if(!/^[a-zA-Z0-9_-]+$/.test(t))return;let n=new RegExp(`^${t}:[ \\t]*(.*)$`,"m").exec(e);if(!n)return;let i=n[1].trim().replace(/^(['"])(.*)\1$/,"$2").trim();return i.length>0?i:void 0}function Q(e){let t=W(e);if(t===null)return null;let n=E(t,"description");if(!n)return null;let r=E(t,"tools"),i=r?r.replace(/^\[(.*)\]$/,"$1").split(",").map(s=>s.trim()).filter(s=>s.length>0):[],o=E(t,"model");return o?{description:n,model:o,tools:i}:{description:n,tools:i}}function We(e){let t=W(e);return(t===null?void 0:E(t,"description"))??""}function B(e){let t=W(e);return t===null?!1:E(t,"x-onlymcp-stub")==="true"}function se(e){if(!e.startsWith(`---
|
package/dist/bin/mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{Server as vr}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as kr}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as Sr,GetPromptRequestSchema as wr,ListPromptsRequestSchema as Cr,ListResourceTemplatesRequestSchema as Ar,ListResourcesRequestSchema as Tr,ListToolsRequestSchema as Ir,ReadResourceRequestSchema as $r}from"@modelcontextprotocol/sdk/types.js";import{hostname as fn}from"node:os";import{execFile as sn}from"node:child_process";import{hostname as an}from"node:os";import{readFile as ln}from"node:fs/promises";import{promisify as cn}from"node:util";import{randomUUID as Me}from"node:crypto";import{link as Jt,mkdir as qt,readFile as Yt,rename as Zt,rm as Xt,writeFile as Ue}from"node:fs/promises";import{basename as Qt,dirname as ze,join as en}from"node:path";import{existsSync as Vt}from"node:fs";import{homedir as Ne}from"node:os";import{join as w}from"node:path";function B(){return process.env.ONLYMCP_HOME??w(Ne(),".claude","onlymcp")}function Ee(){return process.env.ONLYMCP_HOME??Ne()}function Le(){return w(B(),"device-id")}function Pe(){return w(B(),"cache")}function Re(){return w(B(),"stub-ignore")}function Oe(){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[w(Ee(),".claude"),w(Ee(),".codex")])Vt(e)&&!t.includes(e)&&t.push(e);return t.length>0?t:[w(B(),"plugin")]}var tn=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,De;function je(){return De??=nn(),De}async function ce(t){try{let e=(await Yt(t,"utf8")).trim().toLowerCase();return tn.test(e)?e:null}catch{return null}}async function nn(){let t=Le(),e=await ce(t);if(e)return e;try{return await qt(ze(t),{recursive:!0}),await on(t)}catch{return null}}var rn=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS","EXDEV"]);async function on(t){let e=Me(),n=en(ze(t),`.${Qt(t)}.${process.pid}.${Me()}.tmp`);try{await Ue(n,`${e}
|
|
3
3
|
`,{flag:"wx",mode:384});try{return await Jt(n,t),e}catch(o){let i=o.code;if(i!=="EEXIST"&&!rn.has(i??""))throw o;if(i!=="EEXIST")try{return await Ue(t,`${e}
|
|
4
|
-
`,{flag:"wx",mode:384}),e}catch(s){if(s.code!=="EEXIST")throw s}}let r=await ce(t);return r||(await Zt(n,t),await ce(t)??e)}finally{await Xt(n,{force:!0}).catch(()=>{})}}var K="0.24.
|
|
4
|
+
`,{flag:"wx",mode:384}),e}catch(s){if(s.code!=="EEXIST")throw s}}let r=await ce(t);return r||(await Zt(n,t),await ce(t)??e)}finally{await Xt(n,{force:!0}).catch(()=>{})}}var K="0.24.2";var dn=cn(sn),pn=`onlymcp-cli/${K} (${process.platform} ${process.arch}; node ${process.versions.node})`,Fe=200;async function He(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 mn(){try{if(process.platform==="linux"){let t=ln("/sys/class/dmi/id/product_version","utf8"),n=(await He(t,Fe))?.trim();return!n||/^(to be filled|default string|system version|none|n\/a)/i.test(n)?null:n}if(process.platform==="darwin"){let t=dn("sysctl",["-n","hw.model"]);return(await He(t,Fe))?.stdout.trim()||null}}catch{}return null}async function un(){let t="unknown";try{t=an()||"unknown"}catch{}let e=await mn();return(e&&e!==t?`${t} (${e})`:t).slice(0,60)}var Ge=null;async function de(){Ge??=await un();let t=await je();return{"user-agent":pn,"x-onlymcp-device":Ge,...t?{"x-onlymcp-device-id":t}:{}}}var a=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},V=class{constructor(e,n){this.baseUrl=e;this.token=n}baseUrl;token;async call(e,n={}){let r=this.token();if(!r)throw new a("errors.NOT_LOGGED_IN");let o=await fetch(`${this.baseUrl}${e}`,{...n,headers:{...await de(),...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 a(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});return n.types?.length&&r.set("types",n.types.join(",")),n.limit&&r.set("limit",String(n.limit)),this.call(`/api/search?${r.toString()}`)}memoryTree(e="all"){return this.call(`/api/memory/tree?scope=${encodeURIComponent(e)}`)}moveMemory(e,n,r=!0,o=fn()){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 a("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 de(),authorization:`Bearer ${n}`}});if(!i.ok){let s=await i.json().catch(()=>({}));throw new a(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 gn="https://only-mcp.com";function We(t=process.env.ONLYMCP_API_URL){if(t===void 0)return gn;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 hn}from"@napi-rs/keyring";function yn(t,e){let n=()=>new hn(t,e);return{save(r){n().setPassword(r)},read(){try{return n().getPassword()}catch{return null}},clear(){try{n().deletePassword()}catch{}}}}var Be=yn("onlymcp","session-token");import J from"cacache";var bn=Number(process.env.ONLYMCP_TTL_SECONDS??360*60),q=class{constructor(e=Pe()){this.dir=e}dir;async get(e){try{let n=await J.get(this.dir,e),r=n.metadata;return!r||r.expiresAt<=Date.now()?(await J.rm.entry(this.dir,e),null):n.data.toString("utf8")}catch{return null}}async set(e,n,r=bn){await J.put(this.dir,e,n,{metadata:{expiresAt:Date.now()+r*1e3}})}async clear(){await J.rm.all(this.dir)}};var Ke=["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(" "),xn=["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 Ve(t,e,n,r){if(n.length===0)return"";let o=[];for(let d of n){let l=n.length-o.length-1,h=l>0?` (+${l} more, call ${e})`:"",b=`
|
|
5
5
|
|
|
6
6
|
${t}: ${[...o,d].join(", ")}${h}`;if(r+b.length>1800)break;o.push(d)}if(o.length===0)return`
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onlymcp",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
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",
|