A Python class that generates MCP server for any AWS service which has boto3 client
Project description
AWS Service MCP Generator
A Python library that automatically generates MCP servers for any AWS service that has a boto3 client.
Installation
You can install the package using either pip or uv:
Using pip
pip install aws_service_mcp_generator
Using uv
uv add aws_service_mcp_generator
For development installation:
# Clone the repository
git clone https://github.com/kenliao94/aws_service_mcp_generator.git
cd aws_service_mcp_generator
# Create and activate a virtual environment (optional but recommended)
uv venv --python 3.10
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the package in development mode
uv pip install -e .
Usage
The AWS Service MCP Generator allows you to quickly create MCP servers for any AWS service. Here's how to use it:
Basic Usage
from mcp.server.fastmcp import FastMCP
from aws_service_mcp_generator.generator import AWSToolGenerator
# Initialize FastMCP server
mcp = FastMCP()
# Create a generator for an AWS service
sns_generator = AWSToolGenerator(
service_name="sns",
service_display_name="Simple Notification Service",
mcp=mcp
)
# Generate MCP tools for all operations
sns_generator.generate()
# Start the MCP server
mcp.run()
Advanced Configuration
You can customize the behavior of specific operations:
from mcp.server.fastmcp import FastMCP
from aws_service_mcp_generator.generator import AWSToolGenerator
mcp = FastMCP()
# Configure specific operations
tool_configuration = {
"list_topics": {
"documentation_override": "List all SNS topics in the specified region"
},
"create_topic": {
"validator": lambda mcp, client, kwargs: (
True if kwargs.get("Name") else (False, "Topic name is required")
)
},
"delete_topic": {
"ignore": True # Skip this operation
},
"publish": {
# Complete override of the function behavior
"func_override": lambda mcp, boto3_client_getter, operation: mcp.tool(description="Enhanced SNS publish with additional logging")(
async def publish_with_logging(message: str, topic_arn: str, region: str = "us-east-1"):
"""Publish a message to an SNS topic with additional logging"""
try:
client = boto3_client_getter(region)
print(f"Publishing message to {topic_arn} in {region}")
response = client(operation)(Message=message, TopicArn=topic_arn)
print(f"Successfully published message with ID: {response.get('MessageId')}")
return {
"success": True,
"message_id": response.get("MessageId"),
"timestamp": str(response.get("Timestamp", ""))
}
except Exception as e:
print(f"Error publishing message: {str(e)}")
return {"error": str(e)}
)
}
}
# Create generator with custom configuration
sns_generator = AWSToolGenerator(
service_name="sns",
service_display_name="Simple Notification Service",
mcp=mcp,
tool_configuration=tool_configuration
)
sns_generator.generate()
mcp.run()
Contributing
Contributions are welcome! Here's how you can contribute to this project:
-
Fork the Repository
- Fork the repository on GitHub
-
Clone Your Fork
git clone https://github.com/your-username/aws_service_mcp_generator.git cd aws_service_mcp_generator
-
Set Up Development Environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -e . uv add --dev pyright ruff
-
Create a Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Implement your feature or bug fix
- Add or update tests as necessary
- Update documentation if needed
-
Run Tests
pytest
-
Run Linters
ruff check .
-
Commit Your Changes
git commit -m "Add feature: your feature description"
-
Push to Your Fork
git push origin feature/your-feature-name
-
Submit a Pull Request
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Fill in the PR template with details about your changes
Code Style
This project follows these coding standards:
- Line length: 99 characters
- Quote style: Single quotes
- Python version: 3.10+
- Use type hints
Running Tests
pytest
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws_service_mcp_generator-2.0.2.tar.gz.
File metadata
- Download URL: aws_service_mcp_generator-2.0.2.tar.gz
- Upload date:
- Size: 56.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c7daabaacb3aee5e4f9c5e8307514291c19de93cb42c8ec5ae2c67aded57504
|
|
| MD5 |
5786bdb4e6c351efa9cf5d81604b1fae
|
|
| BLAKE2b-256 |
2eb367221f8a82462235ea28f394d74df8dedca00db4b0e7d4ea527c0f0ca158
|
Provenance
The following attestation bundles were made for aws_service_mcp_generator-2.0.2.tar.gz:
Publisher:
python-publish.yml on kenliao94/aws_service_mcp_generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aws_service_mcp_generator-2.0.2.tar.gz -
Subject digest:
0c7daabaacb3aee5e4f9c5e8307514291c19de93cb42c8ec5ae2c67aded57504 - Sigstore transparency entry: 211444948
- Sigstore integration time:
-
Permalink:
kenliao94/aws_service_mcp_generator@74774facd2b524ac51c726adb99a5adcec3d56b5 -
Branch / Tag:
refs/tags/V2.0.2 - Owner: https://github.com/kenliao94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@74774facd2b524ac51c726adb99a5adcec3d56b5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aws_service_mcp_generator-2.0.2-py3-none-any.whl.
File metadata
- Download URL: aws_service_mcp_generator-2.0.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13542787baeb504a8484d8ef11c8567aa3bf86959dcef4f82842105a4629fcd0
|
|
| MD5 |
e9ad0064805a9d86d2254265496c4faa
|
|
| BLAKE2b-256 |
05d7b85eb6951fcfc287e98b40dac83894cd4f8984f05f0ea6346885c87cba9d
|
Provenance
The following attestation bundles were made for aws_service_mcp_generator-2.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on kenliao94/aws_service_mcp_generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aws_service_mcp_generator-2.0.2-py3-none-any.whl -
Subject digest:
13542787baeb504a8484d8ef11c8567aa3bf86959dcef4f82842105a4629fcd0 - Sigstore transparency entry: 211444950
- Sigstore integration time:
-
Permalink:
kenliao94/aws_service_mcp_generator@74774facd2b524ac51c726adb99a5adcec3d56b5 -
Branch / Tag:
refs/tags/V2.0.2 - Owner: https://github.com/kenliao94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@74774facd2b524ac51c726adb99a5adcec3d56b5 -
Trigger Event:
release
-
Statement type: