-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.py
More file actions
executable file
·48 lines (38 loc) · 1.6 KB
/
run_server.py
File metadata and controls
executable file
·48 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This script starts the MCP server directly by using the Python import approach."""
import argparse
import os
import sys
from awslabs.aws_iot_sitewise_mcp_server.server import main
# Add the project root to the Python path
root_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, root_dir)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='AWS IoT SiteWise MCP Server')
parser.add_argument(
'--allow-writes',
action='store_true',
help='Enable write operations (create, update, delete). By default, '
'server runs in read-only mode.',
)
args = parser.parse_args()
# Set environment variable to pass the flag to the server
os.environ['SITEWISE_MCP_ALLOW_WRITES'] = str(args.allow_writes)
if args.allow_writes:
print('Starting server with WRITE operations enabled...')
else:
print('Starting server in READ-ONLY mode. Use --allow-writes to enable write operations.')
main()