Skip to main content
Glama

deploy_website

Deploy static website files to a 1Panel server by specifying the domain and build directory, streamlining website hosting and file uploads through natural language commands.

Instructions

Deploy website to 1Panel server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buildDirYesBuild directory name (e.g. /Users/username/project/dist, /Users/username/project/build)
domainYesWebsite domain

Implementation Reference

  • The main handler function for the 'deploy_website' tool. It deploys a static website by checking the build directory, creating or using an existing website in 1Panel, uploading files, and returning deployment status.
    export async function deployWebsite(buildDirPath, domain = "") { if (!fs.existsSync(buildDirPath)) { return { content: [ { type: "text", text: `Build directory ${buildDir} does not exist`, }, ], isError: true, }; } console.log(`Start deploying directory ${buildDirPath} to 1Panel`); const onePanelAPI = new OnePanelAPI({ baseURL: process.env.ONEPANEL_BASE_URL, apiKey: process.env.ONEPANEL_API_KEY, version: process.env.ONEPANEL_API_VERSION || "v2", languageCode: process.env.ONEPANEL_LANGUAGE || "zh", }); const siteConfig = { domain: domain, }; let website = await onePanelAPI.getWebsiteDetail(domain); if (!website) { website = await onePanelAPI.createWebsite(siteConfig); console.log(`Create website: domain: ${domain}`); } else { console.log(`Website already exists: domain: ${domain}`); } console.log("Upload files to website"); const uploadResult = await onePanelAPI.uploadStaticFiles( domain, buildDirPath ); return { content: [ { type: "text", text: JSON.stringify( { domain: domain, url: `http://${domain}`, status: "success", uploadStats: { totalFiles: uploadResult.totalFiles, successCount: uploadResult.successCount, failCount: uploadResult.failCount, }, }, null, 2 ), }, ], }; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ruibaby/1panel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server