Skip to main content
Glama
chrisleekr

MCP Server Boilerplate

by chrisleekr
authentication.ts1.85 kB
import { fromSSO } from '@aws-sdk/credential-providers'; import { AwsCredentialIdentity, AwsCredentialIdentityProvider, } from '@aws-sdk/types'; import { config } from '@/config/manager'; import { loggingContext } from '@/core/server/http/context'; export function getCredentials(): | AwsCredentialIdentityProvider | AwsCredentialIdentity { if (config.tools.aws.profile !== null && config.tools.aws.profile !== '') { loggingContext.log('info', 'Getting credentials from SSO', { data: { profile: config.tools.aws.profile }, }); return fromSSO({ profile: config.tools.aws.profile, }); } loggingContext.log('info', 'Getting credentials from environment variables', { data: { profile: config.tools.aws.profile }, }); return { accessKeyId: config.tools.aws.credentials.accessKeyId ?? '', secretAccessKey: config.tools.aws.credentials.secretAccessKey ?? '', sessionToken: config.tools.aws.credentials.sessionToken ?? '', }; } export function getCredentialsForBedrock(): | AwsCredentialIdentityProvider | AwsCredentialIdentity { if ( config.tools.aws.bedrock.profile !== null && config.tools.aws.bedrock.profile !== '' ) { loggingContext.log('info', 'Getting credentials for Bedrock from SSO', { data: { profile: config.tools.aws.bedrock.profile }, }); return fromSSO({ profile: config.tools.aws.bedrock.profile, }); } loggingContext.log( 'info', 'Getting credentials for Bedrock from environment variables', { data: { profile: config.tools.aws.bedrock.profile }, } ); return { accessKeyId: config.tools.aws.bedrock.credentials.accessKeyId ?? '', secretAccessKey: config.tools.aws.bedrock.credentials.secretAccessKey ?? '', sessionToken: config.tools.aws.bedrock.credentials.sessionToken ?? '', }; }

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/chrisleekr/mcp-server-boilerplate'

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