mcp-proxy-adapter 3.1.6__py3-none-any.whl → 4.0.0__py3-none-any.whl

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 (118) hide show
  1. mcp_proxy_adapter/api/app.py +65 -27
  2. mcp_proxy_adapter/api/handlers.py +1 -1
  3. mcp_proxy_adapter/api/middleware/error_handling.py +11 -10
  4. mcp_proxy_adapter/api/tool_integration.py +5 -2
  5. mcp_proxy_adapter/api/tools.py +3 -3
  6. mcp_proxy_adapter/commands/base.py +19 -1
  7. mcp_proxy_adapter/commands/command_registry.py +243 -6
  8. mcp_proxy_adapter/commands/hooks.py +260 -0
  9. mcp_proxy_adapter/commands/reload_command.py +211 -0
  10. mcp_proxy_adapter/commands/reload_settings_command.py +125 -0
  11. mcp_proxy_adapter/commands/settings_command.py +189 -0
  12. mcp_proxy_adapter/config.py +16 -1
  13. mcp_proxy_adapter/core/__init__.py +44 -0
  14. mcp_proxy_adapter/core/logging.py +87 -34
  15. mcp_proxy_adapter/core/settings.py +376 -0
  16. mcp_proxy_adapter/core/utils.py +2 -2
  17. mcp_proxy_adapter/custom_openapi.py +81 -2
  18. mcp_proxy_adapter/examples/README.md +124 -0
  19. mcp_proxy_adapter/examples/__init__.py +7 -0
  20. mcp_proxy_adapter/examples/basic_server/README.md +60 -0
  21. mcp_proxy_adapter/examples/basic_server/__init__.py +7 -0
  22. mcp_proxy_adapter/examples/basic_server/basic_custom_settings.json +39 -0
  23. mcp_proxy_adapter/examples/basic_server/config.json +35 -0
  24. mcp_proxy_adapter/examples/basic_server/custom_settings_example.py +238 -0
  25. mcp_proxy_adapter/examples/basic_server/server.py +98 -0
  26. mcp_proxy_adapter/examples/custom_commands/README.md +127 -0
  27. mcp_proxy_adapter/examples/custom_commands/__init__.py +27 -0
  28. mcp_proxy_adapter/examples/custom_commands/advanced_hooks.py +250 -0
  29. mcp_proxy_adapter/examples/custom_commands/auto_commands/__init__.py +6 -0
  30. mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_echo_command.py +103 -0
  31. mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_info_command.py +111 -0
  32. mcp_proxy_adapter/examples/custom_commands/config.json +62 -0
  33. mcp_proxy_adapter/examples/custom_commands/custom_health_command.py +169 -0
  34. mcp_proxy_adapter/examples/custom_commands/custom_help_command.py +215 -0
  35. mcp_proxy_adapter/examples/custom_commands/custom_openapi_generator.py +76 -0
  36. mcp_proxy_adapter/examples/custom_commands/custom_settings.json +96 -0
  37. mcp_proxy_adapter/examples/custom_commands/custom_settings_manager.py +241 -0
  38. mcp_proxy_adapter/examples/custom_commands/data_transform_command.py +135 -0
  39. mcp_proxy_adapter/examples/custom_commands/echo_command.py +122 -0
  40. mcp_proxy_adapter/examples/custom_commands/hooks.py +230 -0
  41. mcp_proxy_adapter/examples/custom_commands/intercept_command.py +123 -0
  42. mcp_proxy_adapter/examples/custom_commands/manual_echo_command.py +103 -0
  43. mcp_proxy_adapter/examples/custom_commands/server.py +223 -0
  44. mcp_proxy_adapter/examples/custom_commands/test_hooks.py +176 -0
  45. mcp_proxy_adapter/examples/deployment/README.md +49 -0
  46. mcp_proxy_adapter/examples/deployment/__init__.py +7 -0
  47. mcp_proxy_adapter/examples/deployment/config.development.json +8 -0
  48. {examples/basic_example → mcp_proxy_adapter/examples/deployment}/config.json +11 -7
  49. mcp_proxy_adapter/examples/deployment/config.production.json +12 -0
  50. mcp_proxy_adapter/examples/deployment/config.staging.json +11 -0
  51. mcp_proxy_adapter/examples/deployment/docker-compose.yml +31 -0
  52. mcp_proxy_adapter/examples/deployment/run.sh +43 -0
  53. mcp_proxy_adapter/examples/deployment/run_docker.sh +84 -0
  54. mcp_proxy_adapter/openapi.py +3 -2
  55. mcp_proxy_adapter/tests/api/test_custom_openapi.py +617 -0
  56. mcp_proxy_adapter/tests/api/test_handlers.py +522 -0
  57. mcp_proxy_adapter/tests/api/test_schemas.py +546 -0
  58. mcp_proxy_adapter/tests/api/test_tool_integration.py +531 -0
  59. mcp_proxy_adapter/tests/unit/test_base_command.py +391 -85
  60. mcp_proxy_adapter/version.py +1 -1
  61. {mcp_proxy_adapter-3.1.6.dist-info → mcp_proxy_adapter-4.0.0.dist-info}/METADATA +1 -1
  62. mcp_proxy_adapter-4.0.0.dist-info/RECORD +110 -0
  63. {mcp_proxy_adapter-3.1.6.dist-info → mcp_proxy_adapter-4.0.0.dist-info}/WHEEL +1 -1
  64. {mcp_proxy_adapter-3.1.6.dist-info → mcp_proxy_adapter-4.0.0.dist-info}/top_level.txt +0 -1
  65. examples/__init__.py +0 -19
  66. examples/anti_patterns/README.md +0 -51
  67. examples/anti_patterns/__init__.py +0 -9
  68. examples/anti_patterns/bad_design/README.md +0 -72
  69. examples/anti_patterns/bad_design/global_state.py +0 -170
  70. examples/anti_patterns/bad_design/monolithic_command.py +0 -272
  71. examples/basic_example/README.md +0 -245
  72. examples/basic_example/__init__.py +0 -8
  73. examples/basic_example/commands/__init__.py +0 -5
  74. examples/basic_example/commands/echo_command.py +0 -95
  75. examples/basic_example/commands/math_command.py +0 -151
  76. examples/basic_example/commands/time_command.py +0 -152
  77. examples/basic_example/docs/EN/README.md +0 -177
  78. examples/basic_example/docs/RU/README.md +0 -177
  79. examples/basic_example/server.py +0 -151
  80. examples/basic_example/tests/conftest.py +0 -243
  81. examples/check_vstl_schema.py +0 -106
  82. examples/commands/echo_command.py +0 -52
  83. examples/commands/echo_command_di.py +0 -152
  84. examples/commands/echo_result.py +0 -65
  85. examples/commands/get_date_command.py +0 -98
  86. examples/commands/new_uuid4_command.py +0 -91
  87. examples/complete_example/Dockerfile +0 -24
  88. examples/complete_example/README.md +0 -92
  89. examples/complete_example/__init__.py +0 -8
  90. examples/complete_example/commands/__init__.py +0 -5
  91. examples/complete_example/commands/system_command.py +0 -328
  92. examples/complete_example/config.json +0 -41
  93. examples/complete_example/configs/config.dev.yaml +0 -40
  94. examples/complete_example/configs/config.docker.yaml +0 -40
  95. examples/complete_example/docker-compose.yml +0 -35
  96. examples/complete_example/requirements.txt +0 -20
  97. examples/complete_example/server.py +0 -113
  98. examples/di_example/.pytest_cache/README.md +0 -8
  99. examples/di_example/server.py +0 -249
  100. examples/fix_vstl_help.py +0 -123
  101. examples/minimal_example/README.md +0 -65
  102. examples/minimal_example/__init__.py +0 -8
  103. examples/minimal_example/config.json +0 -14
  104. examples/minimal_example/main.py +0 -136
  105. examples/minimal_example/simple_server.py +0 -163
  106. examples/minimal_example/tests/conftest.py +0 -171
  107. examples/minimal_example/tests/test_hello_command.py +0 -111
  108. examples/minimal_example/tests/test_integration.py +0 -181
  109. examples/patch_vstl_service.py +0 -105
  110. examples/patch_vstl_service_mcp.py +0 -108
  111. examples/server.py +0 -69
  112. examples/simple_server.py +0 -128
  113. examples/test_package_3.1.4.py +0 -177
  114. examples/test_server.py +0 -134
  115. examples/tool_description_example.py +0 -82
  116. mcp_proxy_adapter/py.typed +0 -0
  117. mcp_proxy_adapter-3.1.6.dist-info/RECORD +0 -118
  118. {mcp_proxy_adapter-3.1.6.dist-info → mcp_proxy_adapter-4.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,177 +0,0 @@
1
- # Basic MCP Microservice Example
2
-
3
- This example demonstrates the basic functionality of MCP Microservice with multiple commands
4
- organized in separate files.
5
-
6
- ## Structure
7
-
8
- ```
9
- basic_example/
10
- ├── commands/ # Commands directory
11
- │ ├── __init__.py # Package initialization
12
- │ ├── echo_command.py # Echo command
13
- │ ├── math_command.py # Math command
14
- │ └── time_command.py # Time command
15
- ├── config.json # JSON configuration file
16
- ├── docs/ # Documentation
17
- │ ├── EN/ # English documentation
18
- │ │ └── README.md # This file
19
- │ └── RU/ # Russian documentation
20
- │ └── README.md # Russian version of this file
21
- ├── logs/ # Logs directory
22
- ├── server.py # Server startup and application logic
23
- └── tests/ # Tests directory
24
- └── conftest.py # Test configuration and fixtures
25
- ```
26
-
27
- ## Running the Example
28
-
29
- ```bash
30
- # Navigate to the project directory
31
- cd examples/basic_example
32
-
33
- # Create logs directory if it doesn't exist
34
- mkdir -p logs
35
-
36
- # Run the server with default configuration (config.json)
37
- python server.py
38
-
39
- # Or run with a specific configuration file
40
- python server.py --config other_config.json
41
- ```
42
-
43
- After starting, the server will be available at [http://localhost:8000](http://localhost:8000).
44
-
45
- ## Configuration
46
-
47
- The server reads configuration from JSON files. By default, it uses `config.json` in the same directory as `server.py`.
48
-
49
- You can specify a different configuration file with the `--config` parameter:
50
-
51
- ```bash
52
- python server.py --config my_custom_config.json
53
- ```
54
-
55
- If the specified configuration file doesn't exist, the server will try to fall back to `config.json`.
56
-
57
- The main configuration options are:
58
-
59
- ```json
60
- {
61
- "server": {
62
- "host": "0.0.0.0",
63
- "port": 8000,
64
- "debug": true,
65
- "log_level": "info"
66
- },
67
- "logging": {
68
- "level": "INFO",
69
- "file": "logs/basic_example.log"
70
- }
71
- }
72
- ```
73
-
74
- The server can run in two modes:
75
- - Normal mode: Uses a pre-configured application instance
76
- - Debug mode: Uses hot reload (when `"debug": true` in config)
77
-
78
- ## Available Commands
79
-
80
- ### 1. `echo` - Echo Command
81
-
82
- Returns the provided message.
83
-
84
- **Parameters:**
85
- - `message` (string) - Message to echo back
86
-
87
- **Example request:**
88
- ```json
89
- {
90
- "jsonrpc": "2.0",
91
- "method": "echo",
92
- "params": {
93
- "message": "Hello, World!"
94
- },
95
- "id": 1
96
- }
97
- ```
98
-
99
- ### 2. `math` - Math Command
100
-
101
- Performs a math operation on two numbers.
102
-
103
- **Parameters:**
104
- - `a` (number) - First number
105
- - `b` (number) - Second number
106
- - `operation` (string) - Operation (add, subtract, multiply, divide)
107
-
108
- **Example request:**
109
- ```json
110
- {
111
- "jsonrpc": "2.0",
112
- "method": "math",
113
- "params": {
114
- "a": 10,
115
- "b": 5,
116
- "operation": "add"
117
- },
118
- "id": 1
119
- }
120
- ```
121
-
122
- ### 3. `time` - Time Command
123
-
124
- Returns the current time and date.
125
-
126
- **Parameters:**
127
- - `format` (string, optional) - Time format (default: "%Y-%m-%d %H:%M:%S")
128
- - `timezone` (string, optional) - Timezone (default: "UTC")
129
-
130
- **Example request:**
131
- ```json
132
- {
133
- "jsonrpc": "2.0",
134
- "method": "time",
135
- "params": {
136
- "format": "%d.%m.%Y %H:%M:%S",
137
- "timezone": "Europe/London"
138
- },
139
- "id": 1
140
- }
141
- ```
142
-
143
- ## Testing the API
144
-
145
- ### Via Web Interface
146
-
147
- Open [http://localhost:8000/docs](http://localhost:8000/docs) in your browser to access the Swagger UI interactive documentation.
148
-
149
- ### Via Command Line
150
-
151
- ```bash
152
- # Call echo command via JSON-RPC
153
- curl -X POST "http://localhost:8000/api/jsonrpc" \
154
- -H "Content-Type: application/json" \
155
- -d '{"jsonrpc": "2.0", "method": "echo", "params": {"message": "Hello!"}, "id": 1}'
156
-
157
- # Call math command via simplified endpoint
158
- curl -X POST "http://localhost:8000/cmd" \
159
- -H "Content-Type: application/json" \
160
- -d '{"command": "math", "params": {"a": 10, "b": 5, "operation": "add"}}'
161
-
162
- # Call time command via endpoint /api/command/{command_name}
163
- curl -X POST "http://localhost:8000/api/command/time" \
164
- -H "Content-Type: application/json" \
165
- -d '{"format": "%d.%m.%Y %H:%M:%S", "timezone": "UTC"}'
166
- ```
167
-
168
- ## Key Features Demonstrated
169
-
170
- 1. Command organization in separate files
171
- 2. Automatic command discovery and registration
172
- 3. Different command types and parameter handling
173
- 4. Error handling and automatic command reregistration
174
- 5. Different ways to call commands (JSON-RPC, /cmd, /api/command/{command_name})
175
- 6. Support for debug mode with hot reload
176
- 7. Safe command registration for preventing conflicts
177
- 8. JSON configuration files with command-line options
@@ -1,177 +0,0 @@
1
- # Базовый пример MCP Microservice
2
-
3
- Этот пример демонстрирует базовую функциональность MCP Microservice с несколькими командами,
4
- организованными в отдельные файлы.
5
-
6
- ## Структура
7
-
8
- ```
9
- basic_example/
10
- ├── commands/ # Директория с командами
11
- │ ├── __init__.py # Инициализация пакета
12
- │ ├── echo_command.py # Команда эхо
13
- │ ├── math_command.py # Математическая команда
14
- │ └── time_command.py # Команда времени
15
- ├── config.json # Файл конфигурации JSON
16
- ├── docs/ # Документация
17
- │ ├── EN/ # Английская документация
18
- │ │ └── README.md # Английская версия данного файла
19
- │ └── RU/ # Русская документация
20
- │ └── README.md # Этот файл
21
- ├── logs/ # Директория для логов
22
- ├── server.py # Файл запуска сервера и логики приложения
23
- └── tests/ # Директория с тестами
24
- └── conftest.py # Конфигурация и фикстуры для тестов
25
- ```
26
-
27
- ## Запуск примера
28
-
29
- ```bash
30
- # Перейти в директорию проекта
31
- cd examples/basic_example
32
-
33
- # Создать директорию для логов, если она не существует
34
- mkdir -p logs
35
-
36
- # Запустить сервер с конфигурацией по умолчанию (config.json)
37
- python server.py
38
-
39
- # Или запустить с указанием другого файла конфигурации
40
- python server.py --config другой_конфиг.json
41
- ```
42
-
43
- После запуска сервер будет доступен по адресу [http://localhost:8000](http://localhost:8000).
44
-
45
- ## Конфигурация
46
-
47
- Сервер считывает конфигурацию из JSON-файлов. По умолчанию используется `config.json` в том же каталоге, где находится `server.py`.
48
-
49
- Вы можете указать другой файл конфигурации с помощью параметра `--config`:
50
-
51
- ```bash
52
- python server.py --config мой_конфиг.json
53
- ```
54
-
55
- Если указанный файл конфигурации не существует, сервер попытается использовать `config.json`.
56
-
57
- Основные параметры конфигурации:
58
-
59
- ```json
60
- {
61
- "server": {
62
- "host": "0.0.0.0",
63
- "port": 8000,
64
- "debug": true,
65
- "log_level": "info"
66
- },
67
- "logging": {
68
- "level": "INFO",
69
- "file": "logs/basic_example.log"
70
- }
71
- }
72
- ```
73
-
74
- Сервер может работать в двух режимах:
75
- - Обычный режим: использует предварительно настроенный экземпляр приложения
76
- - Режим отладки: использует горячую перезагрузку (когда `"debug": true` в конфигурации)
77
-
78
- ## Доступные команды
79
-
80
- ### 1. `echo` - Эхо-команда
81
-
82
- Возвращает переданное сообщение.
83
-
84
- **Параметры:**
85
- - `message` (string) - Сообщение для эхо
86
-
87
- **Пример запроса:**
88
- ```json
89
- {
90
- "jsonrpc": "2.0",
91
- "method": "echo",
92
- "params": {
93
- "message": "Hello, World!"
94
- },
95
- "id": 1
96
- }
97
- ```
98
-
99
- ### 2. `math` - Математическая команда
100
-
101
- Выполняет математическую операцию над двумя числами.
102
-
103
- **Параметры:**
104
- - `a` (number) - Первое число
105
- - `b` (number) - Второе число
106
- - `operation` (string) - Операция (add, subtract, multiply, divide)
107
-
108
- **Пример запроса:**
109
- ```json
110
- {
111
- "jsonrpc": "2.0",
112
- "method": "math",
113
- "params": {
114
- "a": 10,
115
- "b": 5,
116
- "operation": "add"
117
- },
118
- "id": 1
119
- }
120
- ```
121
-
122
- ### 3. `time` - Команда времени
123
-
124
- Возвращает текущее время и дату.
125
-
126
- **Параметры:**
127
- - `format` (string, опционально) - Формат времени (по умолчанию: "%Y-%m-%d %H:%M:%S")
128
- - `timezone` (string, опционально) - Часовой пояс (по умолчанию: "UTC")
129
-
130
- **Пример запроса:**
131
- ```json
132
- {
133
- "jsonrpc": "2.0",
134
- "method": "time",
135
- "params": {
136
- "format": "%d.%m.%Y %H:%M:%S",
137
- "timezone": "Europe/Moscow"
138
- },
139
- "id": 1
140
- }
141
- ```
142
-
143
- ## Тестирование API
144
-
145
- ### Через веб-интерфейс
146
-
147
- Откройте в браузере [http://localhost:8000/docs](http://localhost:8000/docs) для доступа к интерактивной документации Swagger UI.
148
-
149
- ### Через командную строку
150
-
151
- ```bash
152
- # Вызов команды echo через JSON-RPC
153
- curl -X POST "http://localhost:8000/api/jsonrpc" \
154
- -H "Content-Type: application/json" \
155
- -d '{"jsonrpc": "2.0", "method": "echo", "params": {"message": "Hello!"}, "id": 1}'
156
-
157
- # Вызов команды math через упрощенный эндпоинт
158
- curl -X POST "http://localhost:8000/cmd" \
159
- -H "Content-Type: application/json" \
160
- -d '{"command": "math", "params": {"a": 10, "b": 5, "operation": "add"}}'
161
-
162
- # Вызов команды time через endpoint /api/command/{command_name}
163
- curl -X POST "http://localhost:8000/api/command/time" \
164
- -H "Content-Type: application/json" \
165
- -d '{"format": "%d.%m.%Y %H:%M:%S", "timezone": "UTC"}'
166
- ```
167
-
168
- ## Ключевые особенности, демонстрируемые примером
169
-
170
- 1. Организация команд в отдельные файлы
171
- 2. Автоматическое обнаружение и регистрация команд
172
- 3. Различные типы команд и параметров
173
- 4. Обработка ошибок и автоматическая перерегистрация команд
174
- 5. Различные способы вызова команд (JSON-RPC, /cmd, /api/command/{command_name})
175
- 6. Поддержка режима отладки с горячей перезагрузкой
176
- 7. Безопасная регистрация команд для предотвращения конфликтов
177
- 8. JSON-файлы конфигурации с опциями командной строки
@@ -1,151 +0,0 @@
1
- """
2
- Basic MCP Proxy Adapter example.
3
-
4
- This example demonstrates how to use MCP Proxy Adapter to create
5
- a microservice with multiple commands organized in separate files.
6
- """
7
-
8
- import os
9
- import sys
10
- import json
11
- import argparse
12
- import uvicorn
13
- from typing import Dict, Any
14
- from pathlib import Path
15
-
16
- from mcp_proxy_adapter import Command, CommandResult, registry
17
- from mcp_proxy_adapter.api.app import create_app
18
- from mcp_proxy_adapter.config import config
19
- from mcp_proxy_adapter.core.logging import logger, setup_logging
20
-
21
- # Add commands directory to path for local imports
22
- sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
23
-
24
-
25
- def parse_args():
26
- """
27
- Parse command line arguments.
28
-
29
- Returns:
30
- Parsed arguments
31
- """
32
- parser = argparse.ArgumentParser(description="Basic MCP Microservice Example")
33
- parser.add_argument(
34
- "--config",
35
- default="config.json",
36
- help="Path to configuration file (default: config.json)"
37
- )
38
- return parser.parse_args()
39
-
40
-
41
- def setup_application(config_file=None):
42
- """
43
- Настраивает и возвращает FastAPI приложение.
44
- """
45
- # Get config file path
46
- if config_file is None:
47
- args = parse_args()
48
- config_file = args.config
49
-
50
- # Get absolute paths
51
- current_dir = Path(__file__).parent.absolute()
52
- config_path = current_dir / config_file
53
-
54
- # Try alternative config file if specified one doesn't exist
55
- if not config_path.exists() and config_file != "config.json":
56
- fallback_path = current_dir / "config.json"
57
- if fallback_path.exists():
58
- logger.warning(f"Config file {config_path} not found, using {fallback_path} instead")
59
- config_path = fallback_path
60
-
61
- # Create log directory if it doesn't exist
62
- logs_dir = current_dir / "logs"
63
- logs_dir.mkdir(exist_ok=True)
64
-
65
- # Load configuration if config file exists
66
- if config_path.exists():
67
- # Make sure we're only loading JSON files
68
- if not str(config_path).lower().endswith('.json'):
69
- logger.warning(f"Config file {config_path} is not a JSON file, only JSON format is supported")
70
- config_path = current_dir / "config.json"
71
- if not config_path.exists():
72
- logger.warning(f"Default config.json not found, using default values")
73
-
74
- if config_path.exists():
75
- config.load_from_file(str(config_path))
76
- logger.info(f"Loaded configuration from {config_path}")
77
- else:
78
- logger.warning(f"Configuration file {config_path} not found, using defaults")
79
-
80
- # Create FastAPI app
81
- app = create_app()
82
- app.title = "Basic MCP Proxy Adapter Example"
83
- app.description = "Example microservice with multiple commands using MCP Proxy Adapter"
84
- app.version = "1.0.0"
85
-
86
- # Discover and register commands from the commands directory
87
- package_path = "commands"
88
- try:
89
- # Clear existing commands to prevent conflicts in test environment
90
- registered_commands = registry.get_all_commands()
91
- for cmd_name in list(registered_commands.keys()):
92
- try:
93
- registry.unregister(cmd_name)
94
- except Exception as e:
95
- logger.debug(f"Error unregistering command {cmd_name}: {e}")
96
-
97
- # Discover and register commands
98
- registry.discover_commands(package_path)
99
- logger.info(f"Discovered commands from package: {package_path}")
100
- except Exception as e:
101
- logger.error(f"Error discovering commands: {e}")
102
-
103
- return app
104
-
105
-
106
- def main():
107
- """Run microservice with command discovery."""
108
- # Setup logging
109
- log_level = config.get("logging.level", "INFO")
110
- setup_logging(log_level)
111
-
112
- # Initialize application
113
- app = setup_application()
114
-
115
- # Get server configuration
116
- host = config.get("server.host", "localhost")
117
- port = config.get("server.port", 8000)
118
-
119
- # Check if port is overridden by environment variable (for testing)
120
- if "TEST_SERVER_PORT" in os.environ:
121
- port = int(os.environ["TEST_SERVER_PORT"])
122
- logger.info(f"Using test port from environment: {port}")
123
-
124
- # Run server
125
- logger.info(f"Starting server on {host}:{port}")
126
-
127
- debug = config.get("server.debug", False)
128
-
129
- if debug:
130
- # In debug mode, run with hot reload using import string
131
- uvicorn.run(
132
- "server:setup_application",
133
- host=host,
134
- port=port,
135
- reload=True,
136
- factory=True,
137
- log_level=config.get("logging.level", "info").lower()
138
- )
139
- else:
140
- # In normal mode, run with app instance
141
- uvicorn.run(
142
- app,
143
- host=host,
144
- port=port,
145
- reload=False,
146
- log_level=config.get("logging.level", "info").lower()
147
- )
148
-
149
-
150
- if __name__ == "__main__":
151
- main()