UNPKG

@back4app/mcp-installer

Version:

CLI tool to install and configure Back4App MCP server across different IDEs

2 lines 1.77 kB
import u from"fs";import C from"path";import t from"os";import n from"path";var a={cursor:n.join(t.homedir(),".cursor","mcp.json"),windsurf:n.join(t.homedir(),".codeium","windsurf","mcp_config.json"),cline:n.join(t.homedir(),".cline","mcp_config.json"),claude:n.join(t.homedir(),".claude","mcp_config.json"),witsy:n.join(t.homedir(),".witsy","mcp_config.json"),enconvo:n.join(t.homedir(),".enconvo","mcp_config.json"),vscode:n.join(t.homedir(),".vscode","mcp.json")};function g(r){let o=a[r];if(!o)throw new Error(`Unsupported IDE: ${r}`);return o}function d(r,o=process.cwd()){switch(r){case"vscode":return n.join(o,".vscode","mcp.json");case"cursor":return n.join(o,".cursor","mcp.json");case"cline":return n.join(o,".cline","mcp_config.json");default:throw new Error(`Workspace installation not supported for ${r}`)}}function m(r){return!1}function y(){return Object.keys(a)}function h(r){return Object.keys(a).includes(r)}var c="back4app";function p(r){return r==="vscode"?"servers":"mcpServers"}function E(r){return{command:"npx",args:["-y","@back4app/mcp-server-back4app@latest"],env:{BACK4APP_ACCOUNT_KEY:r}}}function v(r){return m(r)?d(r):g(r)}async function f(r){let o=v(r),e=p(r);try{let s=u.readFileSync(o,"utf8"),i=JSON.parse(s);return i[e]||(i[e]={}),i}catch{let i={};return i[e]={},i}}async function S(r,o){let e=v(r),s=C.dirname(e);u.mkdirSync(s,{recursive:!0}),u.writeFileSync(e,JSON.stringify(o,null,2))}async function M(r,o){let e=await f(r),s=p(r);e[s][c]=E(o),await S(r,e)}async function b(r){let o=await f(r),e=p(r);return o[e]?.[c]?(delete o[e][c],await S(r,o),!0):!1}async function R(r){let o=await f(r),e=p(r);return!!o[e]?.[c]}export{g as a,y as b,h as c,E as d,f as e,S as f,M as g,b as h,R as i}; //# sourceMappingURL=chunk-7M5ETQCX.js.map