updsts
Automatically update AWS credential files with temporary STS tokens and retrieve credential info, enabling secure credential management via Agent tools.
README
updsts
A simple CUI tool and local MCP server for reflecting AWS STS credential information into the credential file
English | 日本語
<!-- TOC tocDepth:2..3 chapterDepth:2..6 -->
- 1. Overview
- 2. Features
- 3. Runtime Environment
- 4. Installation / Usage
- 5. Registering as MCP Server
- 6. CUI Tool Command Options
- 7. AWS Credentials File
- 8. Available MCP Tools
- 9. Security Notes
- 10. License
<!-- /TOC -->
1. Overview
updsts is a command-line tool that retrieves AWS STS (Security Token Service) credentials from existing AWS credential (.aws/credentials) file information and automatically reflects them in the credential file.
It also has local MCP server functionality that automatically updates temporary credential information in AWS credential files, enabling operation through common Agent tools.
2. Features
- Obtain temporary AWS STS credentials using MFA authentication
- Automatically update AWS credentials file with new session tokens
- Support for TOTP-based MFA devices
- List all AWS profiles in credentials file
- Preserve existing credential profiles safely
- Can be operated from common Agent tools when functioning as a local MCP server.
(Of course, care is taken to ensure that confidential information such as secret keys and session tokens is not sent to the LLM.) - Support for proxy environments
3. Runtime Environment
This project uses uv as the package manager.
Using uv allows you to automatically reproduce the runtime environment.
For uv installation, see here:
4. Installation / Usage
Install and use in a uv environment.
# Install directly from git repository
uv tool install git+{repository_url}
After installation, you can use the updsts command directly as a tool.
updsts --help
5. Registering as MCP Server
By registering as an MCP server, you can operate updsts from common Agent tools.
{
// Example configuration for registering as MCP server
//
// (Note)
// Registration keys may differ depending on the Agent tool used,
// so please refer to the manual of each Agent tool you use for detailed procedures.
"mcpServers" {
// Configuration for starting updsts as MCP server using uv
"updsts-uv": {
"type": "stdio",
"command": "updsts",
"args": [
"mcp",
"--mcp-server"
],
"env": {},
}
}
}
6. CUI Tool Command Options
6-1. Common Options
-v, --verbose LEVEL: Set output information detail level (0: normal, 1: verbose, 2: debug)-c, --credential-file FILE: Path to the AWS credentials file (default: ~/.aws/credentials)
6-2. get Command
Get and update STS credentials for the specified AWS profile.
updsts get -n <profile_name> -t <totp_token>
-n, --profile: AWS profile name to get STS token (required)-t, --totp-token: TOTP token generated by MFA device (required)-sn, --sts-profile-name: STS profile name to generate in AWS credentials file (optional, default: AWS profile name + "_sts")-d, --duration: Token duration in seconds (optional, default: 3600)-c, --credential-file: Path to credentials file (optional, default: ~/.aws/credentials)
6-3. list Command
Display all AWS profiles in the credentials file.
updsts list
6-4. mcp Command
Start the module as a local MCP server.
You can operate updsts using Agent tools.
updsts mcp --mcp-server
If the --mcp-server option is not specified, it will output the MCP tool list.
updsts mcp
7. AWS Credentials File
7-1. AWS Credentials File Format
updsts works with standard AWS CLI credentials file format.
It preserves existing profiles while updating only the specified sections.
Example credentials file:
[default]
# Access Key ID (required)
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
# Secret Access Key (required)
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLE
# IAM user's MFA device ARN (required. User must add this)
mfa_device_arn = arn:aws:iam::123456789012:mfa/user
# TOTP secret name managed by mktotp mcp server (optional. User can add this)
# If this is configured and the `mktotp` mcp server is available, Agent will auto-generate and use TOTP token.
totp_secret_name = my_totp_secret
# The section enclosed by the following tags is automatically created/updated by updsts.
# ${{{ key=<profile name that requested STS> [auto update by updsts]
[default_sts]
aws_access_key_id = ASIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYtempKEY
aws_session_token = IQoJb3JpZ2luX2VjE...
expiration_datetime = 2025-10-05T15:30:00+09:00
# $}}} [auto update by updsts]
updsts automatically manages sections between special tags while leaving other profiles intact.
Tags are automatically added during the first execution, so there is no need to add them manually.
7-2. AWS Credentials File Storage Location
By default, AWS credentials are stored in the following location.
※ This is the same file used by the AWS CLI.
~/.aws/credentials
You can specify a different location with the -c option.
8. Available MCP Tools
When started as an MCP server, the following tools are available from Agent tools.
updsts_update_sts_credential
Get STS credentials for the specified AWS profile and create/update the sts profile in the credential file.
- Parameters:
profile_name(str): AWS profile name to update (required)totp_token(str): TOTP token from MFA device (required)sts_profile_name(str | None): STS profile name to create in AWS credentials file (optional)- If None or empty string,
<profile_name>_stswill be used (default: None)
- If None or empty string,
cred_file(str | None): Path to credentials file (optional)- If None or empty string, default location (~/.aws/credentials) is used (default: None)
duration(int): STS token duration in seconds (optional, default: 3600)
- Returns (dict[str, str] | None): Dictionary containing updated credential details or None if failed
updsts_get_credential_info
Get AWS credential information for the specified profile name in the credential file.
However, for security reasons, aws_secret_access_key and aws_session_token are returned masked.
- Parameters:
profile_name(str): AWS profile name to retrieve (required)cred_file(str | None): Path to credentials file (optional)- If None or empty string, default location (~/.aws/credentials) is used (default: None)
- Returns (dict[str, str] | None): Dictionary containing credential details or None if not found
updsts_get_credential_info_list
Get AWS credential information for all profiles in the credentials file.
However, for security reasons, aws_secret_access_key and aws_session_token are returned masked.
- Parameters:
cred_file(str | None): Path to credentials file (optional)- If None or empty string, default location (~/.aws/credentials) is used (default: None)
- Returns (list[dict[str, str]]): List of dictionaries containing credential details or empty list if no profiles found
9. Security Notes
- AWS credentials files contain sensitive information, so protect them with appropriate permission settings (recommended: 600)
10. License
This project is licensed under the MIT License.
See the LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。