Skip to main content
Glama
hidenorigoto

Sakura Cloud MCP Server

by hidenorigoto

create_apprun

Create a new AppRun application on Sakura Cloud by specifying name, Docker image, plan, and optional environment variables and zone.

Instructions

Create a new AppRun application

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the AppRun application
descriptionNoDescription of the AppRun application
dockerImageYesDocker image to use for the AppRun application
planIdYesPlan ID for the AppRun application
environmentNoEnvironment variables for the AppRun application
zoneNoThe zone to use (e.g., "tk1v", "is1a", "tk1a"). Defaults to "tk1v" if not specified.

Implementation Reference

  • Input schema definition for the create_apprun tool, defining parameters like name, dockerImage, planId, etc.
    name: 'create_apprun', description: 'Create a new AppRun application', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the AppRun application' }, description: { type: 'string', description: 'Description of the AppRun application' }, dockerImage: { type: 'string', description: 'Docker image to use for the AppRun application' }, planId: { type: 'string', description: 'Plan ID for the AppRun application' }, environment: { type: 'array', description: 'Environment variables for the AppRun application', items: { type: 'object', properties: { key: { type: 'string' }, value: { type: 'string' } } } }, zone: { type: 'string', description: 'The zone to use (e.g., "tk1v", "is1a", "tk1a"). Defaults to "tk1v" if not specified.' } }, required: ['name', 'dockerImage', 'planId'] }
  • The handler function that implements create_apprun by validating inputs, preparing the request body, and calling the Sakura Cloud AppRun API to create the application.
    } else if (request.params.name === 'create_apprun') { try { validateCredentials(); const name = request.params.arguments?.name as string; const description = request.params.arguments?.description as string || ''; const dockerImage = request.params.arguments?.dockerImage as string; const planId = request.params.arguments?.planId as string; const environment = request.params.arguments?.environment as Array<{key: string, value: string}> || []; if (!name || !dockerImage || !planId) { throw new Error('Name, Docker image, and plan ID are required'); } const zone = request.params.arguments?.zone as string || DEFAULT_ZONE; const createBody = { name: name, description: description, planId: planId, image: dockerImage, environment: environment.map(env => ({ key: env.key, value: env.value })), }; const createResult = await fetchFromAppRunAPI('/applications', 'POST', createBody); return { content: [ { type: 'text', text: JSON.stringify(createResult, null, 2) } ] }; } catch (error) { console.error('Error calling tool:', error); throw error; }
  • Helper function used by create_apprun (and other AppRun tools) to make authenticated HTTPS requests to the Sakura Cloud AppRun API.
    async function fetchFromAppRunAPI(path: string, method: string = 'GET', bodyData?: any): Promise<any> { return new Promise((resolve, reject) => { validateCredentials(); const options = { hostname: 'secure.sakura.ad.jp', port: 443, path: `/cloud/api/apprun/1.0/apprun/api${path}`, method: method, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': `Basic ${Buffer.from(`${SACLOUD_API_TOKEN}:${SACLOUD_API_SECRET}`).toString('base64')}` } }; const req = https.request(options, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { try { if (data) { const parsedData = JSON.parse(data); resolve(parsedData); } else { resolve({}); } } catch (err) { reject(new Error(`Failed to parse response: ${err}`)); } }); }); req.on('error', (error) => { reject(error); }); if (bodyData && (method === 'POST' || method === 'PUT')) { req.write(JSON.stringify(bodyData)); } req.end(); }); }
  • The tool is registered by being included in the list returned by ListToolsRequestSchema handler.
    name: 'create_apprun', description: 'Create a new AppRun application', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the AppRun application' }, description: { type: 'string', description: 'Description of the AppRun application' }, dockerImage: { type: 'string', description: 'Docker image to use for the AppRun application' }, planId: { type: 'string', description: 'Plan ID for the AppRun application' }, environment: { type: 'array', description: 'Environment variables for the AppRun application', items: { type: 'object', properties: { key: { type: 'string' }, value: { type: 'string' } } } }, zone: { type: 'string', description: 'The zone to use (e.g., "tk1v", "is1a", "tk1a"). Defaults to "tk1v" if not specified.' } }, required: ['name', 'dockerImage', 'planId'] } },

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/hidenorigoto/sacloud-mcp'

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