Skip to main content
Glama

AWS MCP Infrastructure

lambda.service.ts•2.18 kB
import { CreateFunctionCommand, DeleteFunctionCommand, GetFunctionCommand } from '@aws-sdk/client-lambda'; import { lambdaClient } from '../../config/aws.config'; import { logger } from '../../utils/logger'; export class LambdaService { async createFunction(parameters: any) { try { const functionName = parameters.functionName || `mcp-function-${Date.now()}`; const functionCode = ` exports.handler = async (event) => { return { statusCode: 200, body: JSON.stringify({ message: 'Hello from MCP Lambda!' }), }; }; `; const command = new CreateFunctionCommand({ FunctionName: functionName, Runtime: parameters.runtime || 'nodejs18.x', Role: parameters.roleArn, Handler: 'index.handler', Code: { ZipFile: Buffer.from(functionCode), }, Description: 'Function created by MCP Infrastructure', Tags: { CreatedBy: 'MCP-Infrastructure', Environment: parameters.environment || 'development', }, }); const response = await lambdaClient.send(command); logger.info(`Created Lambda function: ${functionName}`); return { functionName, functionArn: response.FunctionArn }; } catch (error) { logger.error('Error creating Lambda function:', error); throw error; } } async deleteFunction(functionName: string) { try { const command = new DeleteFunctionCommand({ FunctionName: functionName, }); await lambdaClient.send(command); logger.info(`Deleted Lambda function: ${functionName}`); return { success: true }; } catch (error) { logger.error('Error deleting Lambda function:', error); throw error; } } async getFunctionStatus(functionName: string) { try { const command = new GetFunctionCommand({ FunctionName: functionName, }); const response = await lambdaClient.send(command); return response.Configuration; } catch (error) { logger.error('Error getting function status:', error); throw error; } } }

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/gesguerra-wzln/aws-mcp-infrastucture'

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