awslabs.stepfunctions-tool-mcp-server 0.1.4__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/Dockerfile +2 -2
  2. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/PKG-INFO +1 -1
  3. awslabs_stepfunctions_tool_mcp_server-0.1.6/awslabs/stepfunctions_tool_mcp_server/aws_helper.py +57 -0
  4. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/awslabs/stepfunctions_tool_mcp_server/server.py +8 -9
  5. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/pyproject.toml +2 -1
  6. awslabs_stepfunctions_tool_mcp_server-0.1.6/tests/test_aws_helper.py +66 -0
  7. awslabs_stepfunctions_tool_mcp_server-0.1.6/tests/test_server.py +23 -0
  8. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/uv.lock +3 -1
  9. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/.gitignore +0 -0
  10. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/.pre-commit-config.yaml +0 -0
  11. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/.python-version +0 -0
  12. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/CHANGELOG.md +0 -0
  13. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/LICENSE +0 -0
  14. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/NOTICE +0 -0
  15. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/README.md +0 -0
  16. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/awslabs/__init__.py +0 -0
  17. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/awslabs/stepfunctions_tool_mcp_server/__init__.py +0 -0
  18. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/docker-healthcheck.sh +0 -0
  19. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/run_tests.sh +0 -0
  20. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/.gitignore +0 -0
  21. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/README.md +0 -0
  22. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/__init__.py +0 -0
  23. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_create_state_machine_tool.py +0 -0
  24. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_filter_state_machines_by_tag.py +0 -0
  25. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_format_state_machine_response.py +0 -0
  26. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_get_schema_arn_from_state_machine_arn.py +0 -0
  27. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_get_schema_from_registry.py +0 -0
  28. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_invoke_express_state_machine_impl.py +0 -0
  29. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_invoke_standard_state_machine_impl.py +0 -0
  30. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_main.py +0 -0
  31. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_register_state_machines.py +0 -0
  32. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_sanitize_tool_name.py +0 -0
  33. {awslabs_stepfunctions_tool_mcp_server-0.1.4 → awslabs_stepfunctions_tool_mcp_server-0.1.6}/tests/test_validate_state_machine_name.py +0 -0
@@ -10,7 +10,7 @@
10
10
  # and limitations under the License.
11
11
 
12
12
  #FROM public.ecr.aws/sam/build-python3.10:1.137.1-20250411084548
13
- FROM public.ecr.aws/sam/build-python3.10@sha256:04cdbe84bec08d17d621192bc3f0a9e4a85a83f2ac99aa9241659dfac0d845ea AS uv
13
+ FROM public.ecr.aws/sam/build-python3.10@sha256:e78695db10ca8cb129e59e30f7dc9789b0dbd0181dba195d68419c72bac51ac1 AS uv
14
14
 
15
15
  # Install the project into `/app`
16
16
  WORKDIR /app
@@ -44,7 +44,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
44
44
  # Make the directory just in case it doesn't exist
45
45
  RUN mkdir -p /root/.local
46
46
 
47
- FROM public.ecr.aws/sam/build-python3.10@sha256:04cdbe84bec08d17d621192bc3f0a9e4a85a83f2ac99aa9241659dfac0d845ea
47
+ FROM public.ecr.aws/sam/build-python3.10@sha256:e78695db10ca8cb129e59e30f7dc9789b0dbd0181dba195d68419c72bac51ac1
48
48
 
49
49
  # Place executables in the environment at the front of the path and include other binaries
50
50
  ENV PATH="/app/.venv/bin:$PATH:/usr/sbin"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.stepfunctions-tool-mcp-server
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: An AWS Labs Model Context Protocol (MCP) server for AWS Step Functions
5
5
  Project-URL: Homepage, https://awslabs.github.io/mcp/
6
6
  Project-URL: Documentation, https://awslabs.github.io/mcp/servers/stepfunctions-tool-mcp-server/
@@ -0,0 +1,57 @@
1
+ """AWS Helper for Step Functions Tool MCP Server."""
2
+
3
+ import boto3
4
+ import botocore.config
5
+ import os
6
+ from typing import Any, Optional
7
+
8
+
9
+ class AwsHelper:
10
+ """Helper class for AWS operations."""
11
+
12
+ @staticmethod
13
+ def get_aws_region() -> Optional[str]:
14
+ """Get AWS region from environment variable.
15
+
16
+ Returns:
17
+ str: AWS region if set in environment, None otherwise
18
+ """
19
+ return os.environ.get('AWS_REGION', 'us-east-1')
20
+
21
+ @staticmethod
22
+ def get_aws_profile() -> Optional[str]:
23
+ """Get AWS profile from environment variable.
24
+
25
+ Returns:
26
+ str: AWS profile if set in environment, None otherwise
27
+ """
28
+ return os.environ.get('AWS_PROFILE')
29
+
30
+ @staticmethod
31
+ def create_boto3_client(service_name: str, region_name: Optional[str] = None) -> Any:
32
+ """Create a boto3 client with the appropriate configuration.
33
+
34
+ Args:
35
+ service_name: AWS service name (e.g., 'stepfunctions', 'schemas')
36
+ region_name: Optional region override
37
+
38
+ Returns:
39
+ boto3.client: Configured boto3 client
40
+ """
41
+ from awslabs.stepfunctions_tool_mcp_server.server import __version__
42
+
43
+ # Create config with user agent
44
+ config = botocore.config.Config(
45
+ user_agent_extra=f'awslabs/mcp/aws-stepfunctions-tool-mcp-server/{__version__}'
46
+ )
47
+
48
+ # Get profile and region
49
+ profile = AwsHelper.get_aws_profile()
50
+ region = region_name or AwsHelper.get_aws_region()
51
+
52
+ # Create client with or without profile
53
+ if profile:
54
+ session = boto3.Session(profile_name=profile)
55
+ return session.client(service_name, region_name=region, config=config)
56
+ else:
57
+ return boto3.client(service_name, region_name=region, config=config)
@@ -1,11 +1,14 @@
1
1
  """awslabs Step Functions Tool MCP Server implementation."""
2
2
 
3
+ # This version should match the version in pyproject.toml
4
+ __version__ = '0.1.5'
5
+
3
6
  import asyncio
4
- import boto3
5
7
  import json
6
8
  import logging
7
9
  import os
8
10
  import re
11
+ from awslabs.stepfunctions_tool_mcp_server.aws_helper import AwsHelper
9
12
  from mcp.server.fastmcp import Context, FastMCP
10
13
  from typing import Optional
11
14
 
@@ -14,11 +17,8 @@ from typing import Optional
14
17
  logging.basicConfig(level=logging.INFO)
15
18
  logger = logging.getLogger(__name__)
16
19
 
17
- AWS_PROFILE = os.environ.get('AWS_PROFILE', 'default')
18
- logger.info(f'AWS_PROFILE: {AWS_PROFILE}')
19
-
20
- AWS_REGION = os.environ.get('AWS_REGION', 'us-east-1')
21
- logger.info(f'AWS_REGION: {AWS_REGION}')
20
+ logger.info(f'AWS_PROFILE: {AwsHelper.get_aws_profile()}')
21
+ logger.info(f'AWS_REGION: {AwsHelper.get_aws_region()}')
22
22
 
23
23
  STATE_MACHINE_PREFIX = os.environ.get('STATE_MACHINE_PREFIX', '')
24
24
  logger.info(f'STATE_MACHINE_PREFIX: {STATE_MACHINE_PREFIX}')
@@ -40,9 +40,8 @@ STATE_MACHINE_INPUT_SCHEMA_ARN_TAG_KEY = os.environ.get('STATE_MACHINE_INPUT_SCH
40
40
  logger.info(f'STATE_MACHINE_INPUT_SCHEMA_ARN_TAG_KEY: {STATE_MACHINE_INPUT_SCHEMA_ARN_TAG_KEY}')
41
41
 
42
42
  # Initialize AWS clients
43
- session = boto3.Session(profile_name=AWS_PROFILE, region_name=AWS_REGION)
44
- sfn_client = session.client('stepfunctions')
45
- schemas_client = session.client('schemas')
43
+ sfn_client = AwsHelper.create_boto3_client('stepfunctions')
44
+ schemas_client = AwsHelper.create_boto3_client('schemas')
46
45
 
47
46
  mcp = FastMCP(
48
47
  'awslabs.stepfunctions-tool-mcp-server',
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "awslabs.stepfunctions-tool-mcp-server"
3
- version = "0.1.4"
3
+ version = "0.1.6" # When updating this version, also update __version__ in awslabs/stepfunctions_tool_mcp_server/server.py
4
4
  description = "An AWS Labs Model Context Protocol (MCP) server for AWS Step Functions"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -47,6 +47,7 @@ dev = [
47
47
  "pytest-asyncio>=0.26.0",
48
48
  "pytest-cov>=4.1.0",
49
49
  "pytest-mock>=3.12.0",
50
+ "tomli>=2.0.1",
50
51
  ]
51
52
 
52
53
  [build-system]
@@ -0,0 +1,66 @@
1
+ """Tests for the AWS Helper."""
2
+
3
+ import os
4
+ from awslabs.stepfunctions_tool_mcp_server.aws_helper import AwsHelper
5
+ from awslabs.stepfunctions_tool_mcp_server.server import __version__
6
+ from unittest.mock import ANY, MagicMock, patch
7
+
8
+
9
+ class TestAwsHelper:
10
+ """Tests for the AwsHelper class."""
11
+
12
+ def test_get_aws_region_default(self):
13
+ """Test that get_aws_region returns the default region."""
14
+ with patch.dict(os.environ, {}, clear=True):
15
+ region = AwsHelper.get_aws_region()
16
+ assert region == 'us-east-1'
17
+
18
+ @patch.dict(os.environ, {'AWS_REGION': 'us-west-2'})
19
+ def test_get_aws_region_from_env(self):
20
+ """Test that get_aws_region returns the region from the environment."""
21
+ region = AwsHelper.get_aws_region()
22
+ assert region == 'us-west-2'
23
+
24
+ @patch.dict(os.environ, {'AWS_PROFILE': 'test-profile'})
25
+ def test_get_aws_profile_from_env(self):
26
+ """Test that get_aws_profile returns the profile from the environment."""
27
+ profile = AwsHelper.get_aws_profile()
28
+ assert profile == 'test-profile'
29
+
30
+ @patch('boto3.Session')
31
+ def test_create_boto3_client_with_profile(self, mock_boto3_session):
32
+ """Test client creation with profile."""
33
+ mock_session = MagicMock()
34
+ mock_boto3_session.return_value = mock_session
35
+
36
+ with patch.object(AwsHelper, 'get_aws_profile', return_value='test-profile'):
37
+ with patch.object(AwsHelper, 'get_aws_region', return_value='us-west-2'):
38
+ AwsHelper.create_boto3_client('stepfunctions')
39
+ mock_boto3_session.assert_called_once_with(profile_name='test-profile')
40
+ mock_session.client.assert_called_once_with(
41
+ 'stepfunctions', region_name='us-west-2', config=ANY
42
+ )
43
+
44
+ @patch('boto3.client')
45
+ def test_create_boto3_client_without_profile(self, mock_boto3_client):
46
+ """Test client creation without profile."""
47
+ with patch.object(AwsHelper, 'get_aws_profile', return_value=None):
48
+ with patch.object(AwsHelper, 'get_aws_region', return_value='us-west-2'):
49
+ AwsHelper.create_boto3_client('stepfunctions')
50
+ mock_boto3_client.assert_called_once_with(
51
+ 'stepfunctions', region_name='us-west-2', config=ANY
52
+ )
53
+
54
+ def test_create_boto3_client_user_agent(self):
55
+ """Test that create_boto3_client sets the user agent correctly."""
56
+ mock_session = MagicMock()
57
+ with patch('boto3.Session', return_value=mock_session):
58
+ with patch.object(AwsHelper, 'get_aws_profile', return_value='test-profile'):
59
+ AwsHelper.create_boto3_client('stepfunctions')
60
+ _, kwargs = mock_session.client.call_args
61
+ config = kwargs.get('config')
62
+ assert config is not None
63
+ assert (
64
+ config.user_agent_extra
65
+ == f'awslabs/mcp/aws-stepfunctions-tool-mcp-server/{__version__}'
66
+ )
@@ -0,0 +1,23 @@
1
+ """Tests for the Step Functions Tool MCP Server."""
2
+
3
+ from awslabs.stepfunctions_tool_mcp_server.server import __version__
4
+
5
+
6
+ def test_version_matches_pyproject():
7
+ """Test that the version in server.py matches pyproject.toml."""
8
+ import pathlib
9
+ import tomli
10
+
11
+ # Read pyproject.toml
12
+ pyproject_path = pathlib.Path(__file__).parent.parent / 'pyproject.toml'
13
+ with open(pyproject_path, 'rb') as f:
14
+ pyproject = tomli.load(f)
15
+
16
+ # Get version from pyproject.toml
17
+ pyproject_version = pyproject['project']['version']
18
+
19
+ # Verify versions match
20
+ assert __version__ == pyproject_version, (
21
+ f'Version mismatch: server.py has version {__version__}, '
22
+ f'but pyproject.toml has version {pyproject_version}'
23
+ )
@@ -37,7 +37,7 @@ wheels = [
37
37
 
38
38
  [[package]]
39
39
  name = "awslabs-stepfunctions-tool-mcp-server"
40
- version = "0.1.3"
40
+ version = "0.1.5"
41
41
  source = { editable = "." }
42
42
  dependencies = [
43
43
  { name = "boto3" },
@@ -55,6 +55,7 @@ dev = [
55
55
  { name = "pytest-cov" },
56
56
  { name = "pytest-mock" },
57
57
  { name = "ruff" },
58
+ { name = "tomli" },
58
59
  ]
59
60
 
60
61
  [package.metadata]
@@ -74,6 +75,7 @@ dev = [
74
75
  { name = "pytest-cov", specifier = ">=4.1.0" },
75
76
  { name = "pytest-mock", specifier = ">=3.12.0" },
76
77
  { name = "ruff", specifier = ">=0.9.7" },
78
+ { name = "tomli", specifier = ">=2.0.1" },
77
79
  ]
78
80
 
79
81
  [[package]]