awslabs / awslabs/mcp

Support non-profile credentials

Open
#481 7 comments 2 reactions 1 assignee Claimed by @clareliguori View on GitHub
awaiting-user-feedback feature-request stale
Dominant language
Python
Stars
9.7k
Forks
1.8k
Avg merge
3d 12h
Merged PRs (30d)
46

Description

### Describe the feature

Many of the MCP servers explicitly set the profile name for Boto sessions and set it to `default` profile name by default, preventing users from using other credential sources like session credentials in the environment. If there is no credentials file in the environment, then you get an error like `botocore.exceptions.ProfileNotFound: The config profile (default) could not be found`.

Additionally, the design guidelines (snippet below) show explicitly setting the profile_name by retrieving the value of "AWS_PROFILE" env var. This is unnecessary because Boto will do this for you.

```python
import boto3
import os

# Bedrock Runtime Client
aws_region: str = os.environ.get('AWS_REGION', 'us-east-1')

try:
if aws_profile := os.environ.get('AWS_PROFILE'):
bedrock_runtime_client = boto3.Session(
profile_name=aws_profile, region_name=aws_region
).client('bedrock-runtime')
else:
bedrock_runtime_client = boto3.Session(region_name=aws_region).client('bedrock-runtime')
except Exception as e:
logger.error(f'Error creating bedrock runtime client: {str(e)}')
raise
```

### Use Case

While I am testing MCP servers, I want to use temporary credentials stored in environment variables. These should be automatically picked up by Boto.

### Proposed Solution

I'm happy to go search and replace across all the MCP servers in the repo.

### Other Information

_No response_

### Acknowledgements

- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.