updsts
# updsts
A simple CUI tool and local MCP server for reflecting AWS STS credentials into the credentials file
English | [日本語](README_ja.md)
<!-- TOC tocDepth:2..3 chapterDepth:2..6 -->
- [updsts](#updsts)
- [1. Overview](#1-overview)
- [2. Features](#2-features)
- [3. Runtime Environment](#3-runtime-environment)
- [4. Installation/Usage](#4-installationusage)
- [4-1. Install as a uv tool](#4-1-install-as-a-uv-tool)
- [4-2. Using uvx](#4-2-using-uvx)
- [4-3. Registering as an MCP server](#4-3-registering-as-an-mcp-server)
- [4-4. Installing the MCP server as a Claude plugin](#4-4-installing-the-mcp-server-as-a-claude-plugin)
- [5. CUI Tool Command Options](#5-cui-tool-command-options)
- [5-1. Common Options](#5-1-common-options)
- [5-2. `get` Command](#5-2-get-command)
- [5-3. `list` Command](#5-3-list-command)
- [5-4. `mcp` Command](#5-4-mcp-command)
- [6. Credentials File](#6-credentials-file)
- [6-1. Credentials File Format](#6-1-credentials-file-format)
- [6-2. Credentials File Location](#6-2-credentials-file-location)
- [7. Available MCP Tools](#7-available-mcp-tools)
- [`updsts_update_sts_credential`](#updsts_update_sts_credential)
- [`updsts_get_credential_status`](#updsts_get_credential_status)
- [`updsts_get_credential_status_list`](#updsts_get_credential_status_list)
- [8. Security Notes](#8-security-notes)
- [9. License](#9-license)
<!-- /TOC -->
## 1. Overview
updsts is a command-line tool that retrieves AWS STS (Security Token Service) credentials using the credentials already registered in an existing credentials file (~/.aws/credentials), and reflects them in the file as a separate profile.
It also works as a local MCP server, so common Agent tools can read and update the STS profile.
This makes it easier to automate AWS operations that use STS credentials.
## 2. Features
- Obtain temporary AWS STS credentials using MFA authentication
- Update the STS profile in the credentials file
- Support for TOTP-based MFA devices
- List all AWS profiles in the credentials file (confidential information is masked)
- Leave profiles other than the one being updated untouched
- Can be operated from common Agent tools when running as a local MCP server
(Confidential information such as secret keys and session tokens is returned masked and is never passed to the LLM.)
- Support for proxy environments (reads the `http_proxy` / `https_proxy` environment variables)
## 3. Runtime Environment
This project uses uv as the package manager.
Using uv allows you to reproduce the runtime environment automatically.
Python 3.12 or later is required (uv installs a suitable Python automatically if needed).
For how to install uv, see:
- [Installing uv](https://docs.astral.sh/uv/getting-started/installation/)
## 4. Installation/Usage
Use updsts with uv or uvx.
### 4-1. Install as a uv tool
```bash
# Install from PyPI
uv tool install updsts
```
After installation, you can run the `updsts` command directly.
```bash
updsts --help
```
### 4-2. Using uvx
Without installing it, start updsts directly from PyPI with the uvx command.
```bash
uvx updsts --help
# Add @latest to always use the latest version
uvx updsts@latest --help
```
### 4-3. Registering as an MCP server
By registering updsts as an MCP server, you can operate it from common Agent tools.
For how to register an MCP server, refer to the manual of the Agent tool you use.
```jsonc
{
// Example configuration for registering as an MCP server
//
// (Note)
// Registration keys differ depending on the Agent tool.
"mcpServers": {
// Configuration for starting updsts as an MCP server using uvx
"updsts-uv": {
"type": "stdio",
"command": "uvx",
"args": [
"updsts@latest", // To pin the version, specify it like "updsts@0.10.1"
"mcp",
"--mcp-server"
],
"env": {}
}
}
}
```
### 4-4. Installing the MCP server as a Claude plugin
updsts can be installed as a Claude plugin.
```bash
# Add the marketplace
/plugin marketplace add zv-louis/zv-plugin-marketplace
# Install from the marketplace
/plugin install updsts-mcp@zv-plugins
```
## 5. CUI Tool Command Options
### 5-1. Common Options
- `-v, --verbose LEVEL`: Set the output verbosity (0: normal, 1: verbose, 2: debug)
- `-c, --credential_file FILE`: Path to the credentials file (default: ~/.aws/credentials)
### 5-2. `get` Command
Get and update the STS credentials for the specified AWS profile.
```bash
updsts get -n <profile_name> -t <totp_token>
```
- `-n, --profile_name`: AWS profile name to get the STS token for (required)
- `-t, --totp_token`: TOTP token generated by the MFA device (required)
- `-sn, --sts_profile_name`: STS profile name to create in the credentials file (optional, default: AWS profile name + "_sts")
- `-d, --duration`: Token duration in seconds (optional, default: 3600)
- `-c, --credential_file`: Path to the credentials file (optional, default: ~/.aws/credentials)
### 5-3. `list` Command
Display all AWS profiles in the credentials file.
Confidential information (`aws_access_key_id`, `aws_secret_access_key`, `aws_session_token`) are displayed masked.
```bash
updsts list
```
### 5-4. `mcp` Command
Start updsts as a local MCP server.
You can operate updsts from Agent tools.
```bash
updsts mcp --mcp-server
```
If the `--mcp-server` option is not specified, the MCP tool list is output.
```bash
updsts mcp
```
## 6. Credentials File
### 6-1. Credentials File Format
updsts works with the standard AWS CLI credentials file format.
It preserves existing profiles while updating only the specified section.
Example credentials file:
```ini
[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. The user must add this)
mfa_device_arn = arn:aws:iam::123456789012:mfa/user
# TOTP secret name managed by the mktotp MCP server (optional. The user can add this)
# If this is set and the `mktotp` MCP server is available, the Agent will automatically generate and use the TOTP token.
totp_secret_name = my_totp_secret
# The section enclosed by the following tags is automatically created/updated by updsts.
# ${{{ key=<name of the profile 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 the section between the special tags and leaves other profiles intact.
The tags are added automatically on the first run, so there is no need to add them manually.
### 6-2. Credentials File Location
By default, the credentials file is stored in the following location.
※ This is the same file used by the AWS CLI.
```text
~/.aws/credentials
```
You can specify a different location with the `-c` option.
## 7. Available MCP Tools
When started as an MCP server, the following tools are available from Agent tools.
### `updsts_update_sts_credential`
Get the STS credentials for the specified AWS profile and create/update the STS profile in the credentials file.
- Parameters:
- `profile_name` (`str`): AWS profile name to update (required)
- `totp_token` (`str`): TOTP token from the MFA device (required)
- `sts_profile_name` (`str`): STS profile name to create in the credentials file (optional)
- If an empty string, `<profile_name>_sts` is used (default: empty string)
- `cred_file` (`str`): Path to the credentials file (optional)
- If an empty string, the default location (~/.aws/credentials) is used (default: empty string)
- `duration` (`int`): STS token duration in seconds (optional, default: 3600)
- Returns (`dict[str, str]`): A dictionary containing the update result
- `updated_profile_name`: Name of the STS profile that was updated
- `aws_access_key_id`: Access key ID of the retrieved STS credentials (masked)
- `aws_token_expiration`: Expiration of the STS credentials (ISO 8601 format in the local time zone)
- The secret access key and the session token are not returned
- On failure, an error (`ValueError`) is raised instead of a return value
### `updsts_get_credential_status`
Get the information of the specified AWS profile in the credentials file.
For security reasons, `aws_access_key_id`, `aws_secret_access_key` and `aws_session_token` are returned masked.
- Parameters:
- `profile_name` (`str`): AWS profile name to retrieve (required)
- `cred_file` (`str`): Path to the credentials file (optional)
- If an empty string, the default location (~/.aws/credentials) is used (default: empty string)
- Returns (`dict[str, str] | None`): A dictionary containing the credential details, or `None` if not found
### `updsts_get_credential_status_list`
Get the information of all AWS profiles in the credentials file.
For security reasons, `aws_access_key_id`, `aws_secret_access_key` and `aws_session_token` are returned masked.
- Parameters:
- `cred_file` (`str`): Path to the credentials file (optional)
- If an empty string, the default location (~/.aws/credentials) is used (default: empty string)
- Returns (`list[dict[str, str]]`): A list of dictionaries containing the credential details, or an empty list if no profiles are found
## 8. Security Notes
- The credentials file contains sensitive information, so protect it with appropriate permissions (recommended: 600)
- When updating, updsts writes a temporary file readable only by the owner, then replaces the credentials file with it and keeps the original file's permissions
- Secret keys and session tokens are never written to the log or returned to the Agent in raw form
## 9. License
This project is licensed under the MIT License.
See the [LICENSE](LICENSE) file for details.
TDQS
Scored across 3 tools
The three tools are largely distinct: one updates STS credentials, one gets info for a single profile, and one lists info for all profiles. The get_credential_info vs get_credential_info_list pair could be momentarily confused, but the singular/plural distinction is clear enough.
All names share the updsts_ prefix and follow a verb_noun snake_case pattern (update_sts_credential, get_credential_info, get_credential_info_list). Minor redundancy in the prefix and the trailing _list is a slight deviation, but overall predictable.
Three tools is a focused, well-scoped set for a narrow STS credential task (get single, get all, update). It is slightly thin, but each tool earns its place with no obvious padding.
The set covers the core lifecycle of viewing credential info and refreshing/updating STS credentials. A delete or explicit refresh/validation operation is absent, but agents can work around this for the stated purpose.