@aashari/mcp-server-aws-sso
Version:
Node.js/TypeScript MCP server for AWS Single Sign-On (SSO). Enables AI systems (LLMs) with tools to initiate SSO login (device auth flow), list accounts/roles, and securely execute AWS CLI commands using temporary credentials. Streamlines AI interaction w
295 lines (294 loc) • 7.06 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeviceAuthorizationInfoSchema = exports.ListAccountRolesResponseSchema = exports.RoleInfoSchema = exports.ListAccountRolesParamsSchema = exports.ListAccountsResponseSchema = exports.ListAccountsParamsSchema = exports.GetCredentialsParamsSchema = exports.AwsCredentialsSchema = exports.AwsSsoAccountWithRolesSchema = exports.AwsSsoRoleSchema = exports.AwsSsoAuthResultSchema = exports.SsoTokenSchema = exports.AwsSsoConfigSchema = void 0;
const zod_1 = require("zod");
/**
* AWS SSO type definitions
*/
/**
* Zod schema for AWS SSO configuration
*/
exports.AwsSsoConfigSchema = zod_1.z.object({
/**
* The SSO start URL
*/
startUrl: zod_1.z.string(),
/**
* The AWS region
*/
region: zod_1.z.string(),
});
/**
* Zod schema for SSO token data
*/
exports.SsoTokenSchema = zod_1.z.object({
/**
* The access token for SSO
*/
accessToken: zod_1.z.string(),
/**
* The expiration time in seconds
*/
expiresIn: zod_1.z.number(),
/**
* The refresh token for SSO
*/
refreshToken: zod_1.z.string().optional().default(''),
/**
* The token type
*/
tokenType: zod_1.z.string(),
/**
* The time the token was retrieved
*/
retrievedAt: zod_1.z.number(),
/**
* The time the token expires
*/
expiresAt: zod_1.z.number(),
/**
* The AWS region for the token
*/
region: zod_1.z.string().optional(),
});
/**
* Zod schema for AWS SSO auth result
*/
exports.AwsSsoAuthResultSchema = zod_1.z.object({
/**
* The access token for SSO
*/
accessToken: zod_1.z.string(),
/**
* The time the token expires (seconds since epoch)
*/
expiresAt: zod_1.z.number(),
/**
* The refresh token (if available)
*/
refreshToken: zod_1.z.string().nullable().optional(),
/**
* The token expiration time in seconds
*/
expiresIn: zod_1.z.number().optional(),
/**
* The AWS region for the token
*/
region: zod_1.z.string().optional(),
});
/**
* Zod schema for AWS SSO Role
*/
exports.AwsSsoRoleSchema = zod_1.z.object({
/**
* The name of the role
*/
roleName: zod_1.z.string(),
/**
* The ARN of the role
*/
roleArn: zod_1.z.string(),
/**
* The account ID the role belongs to
*/
accountId: zod_1.z.string(),
});
/**
* Zod schema for AWS SSO Account
*/
const AwsSsoAccountSchema = zod_1.z.object({
/**
* The account ID
*/
accountId: zod_1.z.string(),
/**
* The account name
*/
accountName: zod_1.z.string(),
/**
* The account email
*/
accountEmail: zod_1.z.string().optional(),
});
/**
* Zod schema for AWS SSO Account with roles
*/
exports.AwsSsoAccountWithRolesSchema = AwsSsoAccountSchema.extend({
/**
* The roles in the account
*/
roles: zod_1.z.array(exports.AwsSsoRoleSchema),
});
/**
* Zod schema for AWS credentials
*/
exports.AwsCredentialsSchema = zod_1.z.object({
/**
* The access key ID
*/
accessKeyId: zod_1.z.string(),
/**
* The secret access key
*/
secretAccessKey: zod_1.z.string(),
/**
* The session token
*/
sessionToken: zod_1.z.string(),
/**
* The expiration time
*/
expiration: zod_1.z.union([
zod_1.z.date(),
zod_1.z.number().transform((n) => new Date(n * 1000)),
zod_1.z.string().transform((s) => new Date(s)),
]),
/**
* Optional region override
*/
region: zod_1.z.string().optional(),
});
/**
* Zod schema for parameters for getting AWS credentials
*/
exports.GetCredentialsParamsSchema = zod_1.z.object({
/**
* The account ID to get credentials for
*/
accountId: zod_1.z.string(),
/**
* The role name to assume
*/
roleName: zod_1.z.string(),
/**
* Optional region override
*/
region: zod_1.z.string().optional(),
});
/**
* Zod schema for parameters for listing AWS SSO accounts
*/
exports.ListAccountsParamsSchema = zod_1.z.object({
/**
* Optional maximum number of accounts to return
*/
maxResults: zod_1.z.number().optional(),
/**
* Optional pagination token
*/
nextToken: zod_1.z.string().optional(),
});
/**
* Zod schema for AWS SSO account info from SDK
*/
const AccountInfoSchema = zod_1.z.object({
/**
* The account ID
*/
accountId: zod_1.z.string().optional(),
/**
* The account name
*/
accountName: zod_1.z.string().optional(),
/**
* The account email
*/
emailAddress: zod_1.z.string().optional(),
});
/**
* Zod schema for response for listing AWS SSO accounts
*/
exports.ListAccountsResponseSchema = zod_1.z.object({
/**
* The accounts returned
*/
accountList: zod_1.z.array(AccountInfoSchema),
/**
* Token for paginated results, if more are available
*/
nextToken: zod_1.z.string().optional(),
});
/**
* Zod schema for parameters for listing account roles
*/
exports.ListAccountRolesParamsSchema = zod_1.z.object({
/**
* The account ID to list roles for
*/
accountId: zod_1.z.string(),
/**
* Optional maximum number of roles to return
*/
maxResults: zod_1.z.number().optional(),
/**
* Optional pagination token
*/
nextToken: zod_1.z.string().optional(),
});
/**
* Zod schema for role information from AWS SSO API
*/
exports.RoleInfoSchema = zod_1.z.object({
/**
* The name of the role
*/
roleName: zod_1.z.string().optional(),
/**
* The ARN of the role (might not be present in all responses)
*/
roleArn: zod_1.z.string().optional(),
});
/**
* Zod schema for response for listing account roles
*/
exports.ListAccountRolesResponseSchema = zod_1.z.object({
/**
* The roles returned
*/
roleList: zod_1.z.array(exports.RoleInfoSchema),
/**
* Token for paginated results, if more are available
*/
nextToken: zod_1.z.string().optional(),
});
/**
* Zod schema for device authorization information
*/
exports.DeviceAuthorizationInfoSchema = zod_1.z.object({
/**
* The client ID for SSO
*/
clientId: zod_1.z.string(),
/**
* The client secret for SSO
*/
clientSecret: zod_1.z.string(),
/**
* The device code for SSO
*/
deviceCode: zod_1.z.string(),
/**
* The verification URI
*/
verificationUri: zod_1.z.string().optional(),
/**
* The complete verification URI including user code
*/
verificationUriComplete: zod_1.z.string().optional(),
/**
* The user code
*/
userCode: zod_1.z.string().optional(),
/**
* The expiration time in seconds
*/
expiresIn: zod_1.z.number(),
/**
* The polling interval in seconds
*/
interval: zod_1.z.number().optional(),
/**
* The AWS region for SSO
*/
region: zod_1.z.string(),
});