Skip to content

Commit 99a0fff

Browse files
charlie-7agsanket
andauthored
feat: add bulk metadata transfer job management tools (#1594)
Co-authored-by: Sanket Agrawal <[email protected]>
1 parent 85cd55f commit 99a0fff

File tree

9 files changed

+2966
-12
lines changed

9 files changed

+2966
-12
lines changed

src/aws-iot-sitewise-mcp-server/README.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ A comprehensive MCP (Model Context Protocol) server that provides full AWS IoT S
3030
- **Time Series Management**: Associate and manage time series data streams
3131
- **Edge Computing**: Support for local data processing and intermittent connectivity
3232

33+
#### 📦 Bulk Operations & Metadata Transfer
34+
35+
- **Bulk Export**: Export ALL IoT SiteWise resources (asset models, assets, etc.) in one operation using metadata transfer jobs
36+
- **Bulk Import Schema**: Create and validate structured schemas for bulk asset/model imports
37+
- **Metadata Transfer Jobs**: Manage large-scale data migration between S3 and IoT SiteWise
38+
- **Job Monitoring**: Track progress and status of bulk operations
39+
- **Multi-Source Support**: Transfer data between S3 buckets and IoT SiteWise
40+
- **Schema Validation**: Ensure data integrity with comprehensive validation before import
41+
3342
#### 🔒 Security & Configuration
3443

3544
- **Access Policies**: Fine-grained access control for users and resources
@@ -72,17 +81,19 @@ Step-by-step guidance for setting up data ingestion:
7281

7382
```bash
7483
# Install UV if you don't have it yet
75-
curl -sSf https://astral.sh/uv/install | sh
84+
curl -sSf https://astral.sh/uv/install.sh | sh
7685

7786
# Clone the repository
7887
git clone https://github.com/awslabs/mcp.git
79-
cd src/aws-iot-sitewise-mcp-server
88+
cd mcp/src/aws-iot-sitewise-mcp-server
8089

8190
# Install as a uv tool (this makes it available globally via uvx)
8291
uv tool install .
8392

8493
# The server is now available globally via uvx
8594
uvx awslabs.aws-iot-sitewise-mcp-server
95+
# use @latest flag for automatically pull updates on server
96+
uvx awslabs.aws-iot-sitewise-mcp-server@latest
8697

8798
# Note: The server runs silently, waiting for MCP client connections.
8899
# You'll need to configure an MCP client to connect to it.
@@ -96,7 +107,7 @@ pip install aws-iot-sitewise-mcp
96107

97108
# Or install from source
98109
git clone https://github.com/awslabs/mcp.git
99-
cd src/aws-iot-sitewise-mcp-server
110+
cd mcp/src/aws-iot-sitewise-mcp-server
100111
pip install .
101112

102113
# Run the server
@@ -105,7 +116,10 @@ python -m awslabs.aws_iot_sitewise_mcp_server.server
105116

106117
### AWS Configuration
107118

108-
Configure AWS credentials using any of these methods:
119+
Configure AWS credentials with permissions for:
120+
- AWS IoT SiteWise (full access for write operations)
121+
- AWS IoT TwinMaker (for metadata transfer operations)
122+
- Amazon S3 (for bulk import/export operations)
109123

110124
```bash
111125
# AWS CLI (recommended)
@@ -133,7 +147,7 @@ Add to your `claude_desktop_config.json`:
133147
"mcpServers": {
134148
"aws-iot-sitewise": {
135149
"command": "uvx",
136-
"args": ["awslabs.aws-iot-sitewise-mcp-server"],
150+
"args": ["awslabs.aws-iot-sitewise-mcp-server@latest"],
137151
"env": {
138152
"AWS_REGION": "us-west-2",
139153
"AWS_PROFILE": "your-profile-name",
@@ -152,7 +166,7 @@ Add to your `claude_desktop_config.json`:
152166
"mcpServers": {
153167
"aws-iot-sitewise": {
154168
"command": "uvx",
155-
"args": ["awslabs.aws-iot-sitewise-mcp-server"],
169+
"args": ["awslabs.aws-iot-sitewise-mcp-server@latest"],
156170
"env": {
157171
"AWS_REGION": "us-west-2",
158172
"AWS_PROFILE": "your-profile-name",
@@ -215,7 +229,7 @@ Configure in your workspace or global settings:
215229
"mcpServers": {
216230
"aws-iot-sitewise": {
217231
"command": "uvx",
218-
"args": ["awslabs.aws-iot-sitewise-mcp-server"],
232+
"args": ["awslabs.aws-iot-sitewise-mcp-server@latest"],
219233
"env": {
220234
"AWS_REGION": "us-west-2",
221235
"AWS_PROFILE": "your-profile-name",
@@ -234,7 +248,7 @@ Configure in your workspace or global settings:
234248
"mcpServers": {
235249
"aws-iot-sitewise": {
236250
"command": "uvx",
237-
"args": ["awslabs.aws-iot-sitewise-mcp-server"],
251+
"args": ["awslabs.aws-iot-sitewise-mcp-server@latest"],
238252
"env": {
239253
"AWS_REGION": "us-west-2",
240254
"AWS_PROFILE": "your-profile-name",
@@ -355,6 +369,16 @@ Configure in your workspace or global settings:
355369
| `unlink_time_series_asset_property` | Unlink streams |
356370
| `delete_time_series` | Remove time series |
357371

372+
### Metadata Transfer & Bulk Import Tools
373+
374+
| Tool Name | Description |
375+
|-----------|-------------|
376+
| `create_bulk_import_schema` | Construct and validate bulk import schemas for asset models and assets |
377+
| `create_metadata_transfer_job` | **🚀 PRIMARY TOOL for bulk export/import operations** - Use this for exporting all resources |
378+
| `cancel_metadata_transfer_job` | Cancel running metadata transfer jobs |
379+
| `get_metadata_transfer_job` | Get detailed information about metadata transfer jobs |
380+
| `list_metadata_transfer_jobs` | List metadata transfer jobs with filtering options |
381+
358382
### Access Control & Configuration Tools
359383

360384
| Tool Name | Description |
@@ -637,6 +661,18 @@ The implementation is validated against:
637661
- Check timestamp formats
638662
- Validate data types and ranges
639663

664+
4. **Metadata Transfer Issues**
665+
- Verify IoT TwinMaker service permissions
666+
- Check S3 bucket access for source/destination operations
667+
- Validate bulk import schema format
668+
- Monitor job status for detailed error messages
669+
670+
5. **Bulk Import Schema Errors**
671+
- Ensure asset model external IDs are unique
672+
- Verify property data types match requirements
673+
- Check hierarchy references are valid
674+
- Use create_bulk_import_schema tool for validation
675+
640676
### Getting Help
641677

642678
- Check AWS IoT SiteWise documentation

src/aws-iot-sitewise-mcp-server/awslabs/aws_iot_sitewise_mcp_server/client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,17 @@ def create_iam_client(region: str = 'us-east-1'):
4545
config = Config(user_agent_extra=f'awslabs/mcp/aws-iot-sitewise-mcp-server/{__version__}')
4646

4747
return boto3.client('iam', region_name=region, config=config)
48+
49+
50+
def create_twinmaker_client(region: str = 'us-east-1'):
51+
"""Create a standardized AWS IoT TwinMaker client with proper user agent.
52+
53+
Args:
54+
region: AWS region name (default: us-east-1)
55+
56+
Returns:
57+
boto3 IoT TwinMaker client instance
58+
"""
59+
config = Config(user_agent_extra=f'awslabs/mcp/aws-iot-sitewise-mcp-server/{__version__}')
60+
61+
return boto3.client('iottwinmaker', region_name=region, config=config)

0 commit comments

Comments
 (0)