mcp-proxy-adapter 2.1.3__tar.gz → 2.1.4__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 (70) hide show
  1. {mcp_proxy_adapter-2.1.3/mcp_proxy_adapter.egg-info → mcp_proxy_adapter-2.1.4}/PKG-INFO +98 -2
  2. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/README.md +97 -1
  3. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/openapi_server.py +35 -7
  4. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter.egg-info}/PKG-INFO +98 -2
  5. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter.egg-info/SOURCES.txt +10 -31
  6. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/pyproject.toml +1 -1
  7. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/setup.py +2 -2
  8. mcp_proxy_adapter-2.1.3/docs/README.md +0 -172
  9. mcp_proxy_adapter-2.1.3/docs/README_ru.md +0 -172
  10. mcp_proxy_adapter-2.1.3/docs/architecture.md +0 -251
  11. mcp_proxy_adapter-2.1.3/docs/architecture_ru.md +0 -343
  12. mcp_proxy_adapter-2.1.3/docs/command_development.md +0 -250
  13. mcp_proxy_adapter-2.1.3/docs/command_development_ru.md +0 -593
  14. mcp_proxy_adapter-2.1.3/docs/deployment.md +0 -251
  15. mcp_proxy_adapter-2.1.3/docs/deployment_ru.md +0 -1298
  16. mcp_proxy_adapter-2.1.3/docs/examples.md +0 -254
  17. mcp_proxy_adapter-2.1.3/docs/examples_ru.md +0 -401
  18. mcp_proxy_adapter-2.1.3/docs/mcp_proxy_adapter.md +0 -251
  19. mcp_proxy_adapter-2.1.3/docs/mcp_proxy_adapter_ru.md +0 -405
  20. mcp_proxy_adapter-2.1.3/docs/quickstart.md +0 -251
  21. mcp_proxy_adapter-2.1.3/docs/quickstart_ru.md +0 -397
  22. mcp_proxy_adapter-2.1.3/docs/testing.md +0 -255
  23. mcp_proxy_adapter-2.1.3/docs/testing_ru.md +0 -469
  24. mcp_proxy_adapter-2.1.3/docs/validation_ru.md +0 -287
  25. mcp_proxy_adapter-2.1.3/examples/mcp_proxy_config.json +0 -175
  26. mcp_proxy_adapter-2.1.3/scripts/code_analyzer/code_analyzer.py +0 -328
  27. mcp_proxy_adapter-2.1.3/scripts/code_analyzer/register_commands.py +0 -446
  28. mcp_proxy_adapter-2.1.3/scripts/publish.py +0 -85
  29. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/LICENSE +0 -0
  30. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/MANIFEST.in +0 -0
  31. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/code_index.yaml +0 -0
  32. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/__init__.py +0 -0
  33. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/adapter.py +0 -0
  34. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/analyzers/__init__.py +0 -0
  35. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/analyzers/docstring_analyzer.py +0 -0
  36. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/analyzers/type_analyzer.py +0 -0
  37. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/dispatchers/__init__.py +0 -0
  38. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/dispatchers/base_dispatcher.py +0 -0
  39. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/dispatchers/json_rpc_dispatcher.py +0 -0
  40. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/analyze_config.py +0 -0
  41. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/basic_integration.py +0 -0
  42. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/docstring_and_schema_example.py +0 -0
  43. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/extension_example.py +0 -0
  44. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/help_best_practices.py +0 -0
  45. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/help_usage.py +0 -0
  46. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/mcp_proxy_client.py +0 -0
  47. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/project_structure_example.py +0 -0
  48. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4/mcp_proxy_adapter}/examples/testing_example.py +0 -0
  49. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/models.py +0 -0
  50. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/registry.py +0 -0
  51. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/schema.py +0 -0
  52. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/validators/docstring_validator.py +0 -0
  53. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter/validators/metadata_validator.py +0 -0
  54. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter.egg-info/dependency_links.txt +0 -0
  55. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter.egg-info/requires.txt +0 -0
  56. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/mcp_proxy_adapter.egg-info/top_level.txt +0 -0
  57. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/requirements.txt +0 -0
  58. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/setup.cfg +0 -0
  59. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/conftest.py +0 -0
  60. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_adapter.py +0 -0
  61. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_adapter_coverage.py +0 -0
  62. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_basic_dispatcher.py +0 -0
  63. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_command_registry.py +0 -0
  64. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_examples.py +0 -0
  65. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_mcp_proxy_adapter.py +0 -0
  66. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_mcp_proxy_adapter_basic.py +0 -0
  67. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_part1.py +0 -0
  68. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_part2.py +0 -0
  69. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_schema.py +0 -0
  70. {mcp_proxy_adapter-2.1.3 → mcp_proxy_adapter-2.1.4}/tests/test_simple_adapter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 2.1.3
3
+ Version: 2.1.4
4
4
  Summary: Adapter for exposing Command Registry commands as tools for AI models via MCP Proxy.
5
5
  Home-page: https://github.com/vasilyvz/mcp-proxy-adapter
6
6
  Author: Vasiliy VZ
@@ -303,4 +303,100 @@ See [docs/](docs/) for detailed guides, architecture, and examples.
303
303
  7. **Add usage example** to examples/
304
304
  8. **Check help integration** (with/without param)
305
305
  9. **Check schema/OpenAPI generation**
306
- 10. **Document in README.md** (EN/RU)
306
+ 10. **Document in README.md** (EN/RU)
307
+
308
+ ## ❓ FAQ
309
+
310
+ ### Ошибка: got multiple values for argument 'command' при вызове команды help
311
+
312
+ **Проблема:**
313
+
314
+ Если в JSON-RPC запросе к endpoint `/cmd` используется команда `help` с параметром `command`, может возникнуть ошибка:
315
+
316
+ ```
317
+ TypeError: help_command() got multiple values for argument 'command'
318
+ ```
319
+
320
+ **Причина:**
321
+
322
+ В Python, если метод `execute(self, command, **params)` получает параметр `command` и в `params` также есть ключ `command`, возникает конфликт имён.
323
+
324
+ **Решение:**
325
+
326
+ Переименуйте первый аргумент метода `execute` в классе `MockDispatcher` (и аналогичных) с `command` на `command_name`:
327
+
328
+ ```python
329
+ def execute(self, command_name, **params):
330
+ if command_name not in self.commands:
331
+ raise KeyError(f"Unknown command: {command_name}")
332
+ return self.commands[command_name](**params)
333
+ ```
334
+
335
+ Это устранит конфликт и позволит корректно вызывать команду help с параметром `command` через JSON-RPC.
336
+
337
+ ## 🚀 Deployment & Packaging FAQ
338
+
339
+ ### Как собрать, проверить и опубликовать пакет (wheel/sdist) с примерами и документацией
340
+
341
+ 1. **Перенесите каталоги `examples` и `docs` внутрь основного пакета** (например, `mcp_proxy_adapter/examples`, `mcp_proxy_adapter/docs`).
342
+ 2. **Обновите `setup.py`:**
343
+ - Укажите `include_package_data=True`.
344
+ - В `package_data` добавьте:
345
+ ```python
346
+ package_data={
347
+ 'mcp_proxy_adapter': ['examples/*.py', 'examples/*.json', 'docs/*.md', '../README.md'],
348
+ },
349
+ ```
350
+ 3. **Обновите `MANIFEST.in`:**
351
+ - Убедитесь, что включены нужные файлы:
352
+ ```
353
+ include README.md
354
+ include LICENSE
355
+ include requirements.txt
356
+ include pyproject.toml
357
+ include code_index.yaml
358
+ recursive-include mcp_proxy_adapter/examples *.py *.json
359
+ recursive-include mcp_proxy_adapter/docs *.md
360
+ ```
361
+ 4. **Соберите пакет:**
362
+ ```bash
363
+ rm -rf dist build mcp_proxy_adapter.egg-info
364
+ python3 -m build
365
+ ```
366
+ 5. **Создайте новое виртуальное окружение и установите пакет:**
367
+ ```bash
368
+ python3 -m venv ../mcp_proxy_adapter_test_env
369
+ source ../mcp_proxy_adapter_test_env/bin/activate
370
+ pip install --upgrade pip
371
+ pip install dist/mcp_proxy_adapter-*.whl
372
+ ```
373
+ 6. **Проверьте, что примеры и документация попали в пакет:**
374
+ ```bash
375
+ ls -l ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/examples
376
+ ls -l ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/docs
377
+ ```
378
+ 7. **Запустите пример сервера:**
379
+ ```bash
380
+ python ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/examples/openapi_server.py
381
+ ```
382
+ 8. **Проверьте работоспособность через curl:**
383
+ ```bash
384
+ curl http://localhost:8000/openapi.json | jq .
385
+ ```
386
+ 9. **Публикация на PyPI:**
387
+ - Проверьте, что у вас настроен `~/.pypirc` и установлен twine:
388
+ ```bash
389
+ pip install twine
390
+ twine upload dist/*
391
+ ```
392
+
393
+ ### Типовые проблемы и решения
394
+ - **Примеры или документация не попадают в пакет:**
395
+ - Убедитесь, что они находятся внутри основного пакета и правильно указаны в `package_data` и `MANIFEST.in`.
396
+ - **Каталог docs не виден в wheel:**
397
+ - Проверьте расширения файлов и шаблоны в `package_data`/`MANIFEST.in`.
398
+ - **Проверяйте установку только через wheel, а не через sdist!**
399
+
400
+ **Best practice:**
401
+ - Для публикации документации используйте GitHub и PyPI project page (README.md).
402
+ - Для примеров — всегда размещайте их внутри пакета, если хотите распространять с wheel.
@@ -271,4 +271,100 @@ See [docs/](docs/) for detailed guides, architecture, and examples.
271
271
  7. **Add usage example** to examples/
272
272
  8. **Check help integration** (with/without param)
273
273
  9. **Check schema/OpenAPI generation**
274
- 10. **Document in README.md** (EN/RU)
274
+ 10. **Document in README.md** (EN/RU)
275
+
276
+ ## ❓ FAQ
277
+
278
+ ### Ошибка: got multiple values for argument 'command' при вызове команды help
279
+
280
+ **Проблема:**
281
+
282
+ Если в JSON-RPC запросе к endpoint `/cmd` используется команда `help` с параметром `command`, может возникнуть ошибка:
283
+
284
+ ```
285
+ TypeError: help_command() got multiple values for argument 'command'
286
+ ```
287
+
288
+ **Причина:**
289
+
290
+ В Python, если метод `execute(self, command, **params)` получает параметр `command` и в `params` также есть ключ `command`, возникает конфликт имён.
291
+
292
+ **Решение:**
293
+
294
+ Переименуйте первый аргумент метода `execute` в классе `MockDispatcher` (и аналогичных) с `command` на `command_name`:
295
+
296
+ ```python
297
+ def execute(self, command_name, **params):
298
+ if command_name not in self.commands:
299
+ raise KeyError(f"Unknown command: {command_name}")
300
+ return self.commands[command_name](**params)
301
+ ```
302
+
303
+ Это устранит конфликт и позволит корректно вызывать команду help с параметром `command` через JSON-RPC.
304
+
305
+ ## 🚀 Deployment & Packaging FAQ
306
+
307
+ ### Как собрать, проверить и опубликовать пакет (wheel/sdist) с примерами и документацией
308
+
309
+ 1. **Перенесите каталоги `examples` и `docs` внутрь основного пакета** (например, `mcp_proxy_adapter/examples`, `mcp_proxy_adapter/docs`).
310
+ 2. **Обновите `setup.py`:**
311
+ - Укажите `include_package_data=True`.
312
+ - В `package_data` добавьте:
313
+ ```python
314
+ package_data={
315
+ 'mcp_proxy_adapter': ['examples/*.py', 'examples/*.json', 'docs/*.md', '../README.md'],
316
+ },
317
+ ```
318
+ 3. **Обновите `MANIFEST.in`:**
319
+ - Убедитесь, что включены нужные файлы:
320
+ ```
321
+ include README.md
322
+ include LICENSE
323
+ include requirements.txt
324
+ include pyproject.toml
325
+ include code_index.yaml
326
+ recursive-include mcp_proxy_adapter/examples *.py *.json
327
+ recursive-include mcp_proxy_adapter/docs *.md
328
+ ```
329
+ 4. **Соберите пакет:**
330
+ ```bash
331
+ rm -rf dist build mcp_proxy_adapter.egg-info
332
+ python3 -m build
333
+ ```
334
+ 5. **Создайте новое виртуальное окружение и установите пакет:**
335
+ ```bash
336
+ python3 -m venv ../mcp_proxy_adapter_test_env
337
+ source ../mcp_proxy_adapter_test_env/bin/activate
338
+ pip install --upgrade pip
339
+ pip install dist/mcp_proxy_adapter-*.whl
340
+ ```
341
+ 6. **Проверьте, что примеры и документация попали в пакет:**
342
+ ```bash
343
+ ls -l ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/examples
344
+ ls -l ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/docs
345
+ ```
346
+ 7. **Запустите пример сервера:**
347
+ ```bash
348
+ python ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/examples/openapi_server.py
349
+ ```
350
+ 8. **Проверьте работоспособность через curl:**
351
+ ```bash
352
+ curl http://localhost:8000/openapi.json | jq .
353
+ ```
354
+ 9. **Публикация на PyPI:**
355
+ - Проверьте, что у вас настроен `~/.pypirc` и установлен twine:
356
+ ```bash
357
+ pip install twine
358
+ twine upload dist/*
359
+ ```
360
+
361
+ ### Типовые проблемы и решения
362
+ - **Примеры или документация не попадают в пакет:**
363
+ - Убедитесь, что они находятся внутри основного пакета и правильно указаны в `package_data` и `MANIFEST.in`.
364
+ - **Каталог docs не виден в wheel:**
365
+ - Проверьте расширения файлов и шаблоны в `package_data`/`MANIFEST.in`.
366
+ - **Проверяйте установку только через wheel, а не через sdist!**
367
+
368
+ **Best practice:**
369
+ - Для публикации документации используйте GitHub и PyPI project page (README.md).
370
+ - Для примеров — всегда размещайте их внутри пакета, если хотите распространять с wheel.
@@ -90,7 +90,8 @@ class MockDispatcher:
90
90
  "update_item": self.update_item,
91
91
  "delete_item": self.delete_item,
92
92
  "search_items": self.search_items,
93
- "execute": self.execute_command
93
+ "execute": self.execute_command,
94
+ "help": self.help_command
94
95
  }
95
96
  self.commands_info = {
96
97
  "get_items": {
@@ -166,14 +167,24 @@ class MockDispatcher:
166
167
  "required": False
167
168
  }
168
169
  }
170
+ },
171
+ "help": {
172
+ "description": "Show information about available commands or a specific command.",
173
+ "params": {
174
+ "command": {
175
+ "type": "string",
176
+ "description": "Command name for detailed info",
177
+ "required": False
178
+ }
179
+ }
169
180
  }
170
181
  }
171
182
 
172
- def execute(self, command, **params):
183
+ def execute(self, command_name, **params):
173
184
  """Executes command with specified parameters."""
174
- if command not in self.commands:
175
- raise KeyError(f"Unknown command: {command}")
176
- return self.commands[command](**params)
185
+ if command_name not in self.commands:
186
+ raise KeyError(f"Unknown command: {command_name}")
187
+ return self.commands[command_name](**params)
177
188
 
178
189
  def execute_command(self, **params):
179
190
  """Universal method for executing commands."""
@@ -209,9 +220,9 @@ class MockDispatcher:
209
220
  """Returns list of available commands."""
210
221
  return list(self.commands.keys())
211
222
 
212
- def get_command_info(self, command):
223
+ def get_command_info(self, command_name):
213
224
  """Returns information about command."""
214
- return self.commands_info.get(command)
225
+ return self.commands_info.get(command_name)
215
226
 
216
227
  def get_commands_info(self):
217
228
  """Returns information about all commands."""
@@ -265,6 +276,23 @@ class MockDispatcher:
265
276
  (item["description"] and keyword in item["description"].lower())
266
277
  ]
267
278
 
279
+ def help_command(self, **params):
280
+ """Return info about all commands or a specific command."""
281
+ # Если в будущем появится пользовательская команда help, можно реализовать её здесь
282
+ command = params.get("command")
283
+ if command:
284
+ info = self.commands_info.get(command)
285
+ if info:
286
+ return {"command": command, "info": info}
287
+ else:
288
+ return {"error": f"Command '{command}' not found", "available_commands": list(self.commands_info.keys())}
289
+ # Если параметр command не указан, возвращаем краткую информацию обо всех
290
+ return {
291
+ "commands": {cmd: {"description": info["description"], "params": info["params"]} for cmd, info in self.commands_info.items()},
292
+ "total": len(self.commands_info),
293
+ "note": "Use the 'command' parameter to get detailed information about a specific command"
294
+ }
295
+
268
296
  class CustomMockRegistry(MockRegistry):
269
297
  """Custom command registry for example."""
270
298
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 2.1.3
3
+ Version: 2.1.4
4
4
  Summary: Adapter for exposing Command Registry commands as tools for AI models via MCP Proxy.
5
5
  Home-page: https://github.com/vasilyvz/mcp-proxy-adapter
6
6
  Author: Vasiliy VZ
@@ -303,4 +303,100 @@ See [docs/](docs/) for detailed guides, architecture, and examples.
303
303
  7. **Add usage example** to examples/
304
304
  8. **Check help integration** (with/without param)
305
305
  9. **Check schema/OpenAPI generation**
306
- 10. **Document in README.md** (EN/RU)
306
+ 10. **Document in README.md** (EN/RU)
307
+
308
+ ## ❓ FAQ
309
+
310
+ ### Ошибка: got multiple values for argument 'command' при вызове команды help
311
+
312
+ **Проблема:**
313
+
314
+ Если в JSON-RPC запросе к endpoint `/cmd` используется команда `help` с параметром `command`, может возникнуть ошибка:
315
+
316
+ ```
317
+ TypeError: help_command() got multiple values for argument 'command'
318
+ ```
319
+
320
+ **Причина:**
321
+
322
+ В Python, если метод `execute(self, command, **params)` получает параметр `command` и в `params` также есть ключ `command`, возникает конфликт имён.
323
+
324
+ **Решение:**
325
+
326
+ Переименуйте первый аргумент метода `execute` в классе `MockDispatcher` (и аналогичных) с `command` на `command_name`:
327
+
328
+ ```python
329
+ def execute(self, command_name, **params):
330
+ if command_name not in self.commands:
331
+ raise KeyError(f"Unknown command: {command_name}")
332
+ return self.commands[command_name](**params)
333
+ ```
334
+
335
+ Это устранит конфликт и позволит корректно вызывать команду help с параметром `command` через JSON-RPC.
336
+
337
+ ## 🚀 Deployment & Packaging FAQ
338
+
339
+ ### Как собрать, проверить и опубликовать пакет (wheel/sdist) с примерами и документацией
340
+
341
+ 1. **Перенесите каталоги `examples` и `docs` внутрь основного пакета** (например, `mcp_proxy_adapter/examples`, `mcp_proxy_adapter/docs`).
342
+ 2. **Обновите `setup.py`:**
343
+ - Укажите `include_package_data=True`.
344
+ - В `package_data` добавьте:
345
+ ```python
346
+ package_data={
347
+ 'mcp_proxy_adapter': ['examples/*.py', 'examples/*.json', 'docs/*.md', '../README.md'],
348
+ },
349
+ ```
350
+ 3. **Обновите `MANIFEST.in`:**
351
+ - Убедитесь, что включены нужные файлы:
352
+ ```
353
+ include README.md
354
+ include LICENSE
355
+ include requirements.txt
356
+ include pyproject.toml
357
+ include code_index.yaml
358
+ recursive-include mcp_proxy_adapter/examples *.py *.json
359
+ recursive-include mcp_proxy_adapter/docs *.md
360
+ ```
361
+ 4. **Соберите пакет:**
362
+ ```bash
363
+ rm -rf dist build mcp_proxy_adapter.egg-info
364
+ python3 -m build
365
+ ```
366
+ 5. **Создайте новое виртуальное окружение и установите пакет:**
367
+ ```bash
368
+ python3 -m venv ../mcp_proxy_adapter_test_env
369
+ source ../mcp_proxy_adapter_test_env/bin/activate
370
+ pip install --upgrade pip
371
+ pip install dist/mcp_proxy_adapter-*.whl
372
+ ```
373
+ 6. **Проверьте, что примеры и документация попали в пакет:**
374
+ ```bash
375
+ ls -l ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/examples
376
+ ls -l ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/docs
377
+ ```
378
+ 7. **Запустите пример сервера:**
379
+ ```bash
380
+ python ../mcp_proxy_adapter_test_env/lib/python*/site-packages/mcp_proxy_adapter/examples/openapi_server.py
381
+ ```
382
+ 8. **Проверьте работоспособность через curl:**
383
+ ```bash
384
+ curl http://localhost:8000/openapi.json | jq .
385
+ ```
386
+ 9. **Публикация на PyPI:**
387
+ - Проверьте, что у вас настроен `~/.pypirc` и установлен twine:
388
+ ```bash
389
+ pip install twine
390
+ twine upload dist/*
391
+ ```
392
+
393
+ ### Типовые проблемы и решения
394
+ - **Примеры или документация не попадают в пакет:**
395
+ - Убедитесь, что они находятся внутри основного пакета и правильно указаны в `package_data` и `MANIFEST.in`.
396
+ - **Каталог docs не виден в wheel:**
397
+ - Проверьте расширения файлов и шаблоны в `package_data`/`MANIFEST.in`.
398
+ - **Проверяйте установку только через wheel, а не через sdist!**
399
+
400
+ **Best practice:**
401
+ - Для публикации документации используйте GitHub и PyPI project page (README.md).
402
+ - Для примеров — всегда размещайте их внутри пакета, если хотите распространять с wheel.
@@ -5,34 +5,6 @@ code_index.yaml
5
5
  pyproject.toml
6
6
  requirements.txt
7
7
  setup.py
8
- docs/README.md
9
- docs/README_ru.md
10
- docs/architecture.md
11
- docs/architecture_ru.md
12
- docs/command_development.md
13
- docs/command_development_ru.md
14
- docs/deployment.md
15
- docs/deployment_ru.md
16
- docs/examples.md
17
- docs/examples_ru.md
18
- docs/mcp_proxy_adapter.md
19
- docs/mcp_proxy_adapter_ru.md
20
- docs/quickstart.md
21
- docs/quickstart_ru.md
22
- docs/testing.md
23
- docs/testing_ru.md
24
- docs/validation_ru.md
25
- examples/analyze_config.py
26
- examples/basic_integration.py
27
- examples/docstring_and_schema_example.py
28
- examples/extension_example.py
29
- examples/help_best_practices.py
30
- examples/help_usage.py
31
- examples/mcp_proxy_client.py
32
- examples/mcp_proxy_config.json
33
- examples/openapi_server.py
34
- examples/project_structure_example.py
35
- examples/testing_example.py
36
8
  mcp_proxy_adapter/__init__.py
37
9
  mcp_proxy_adapter/adapter.py
38
10
  mcp_proxy_adapter/models.py
@@ -49,11 +21,18 @@ mcp_proxy_adapter/analyzers/type_analyzer.py
49
21
  mcp_proxy_adapter/dispatchers/__init__.py
50
22
  mcp_proxy_adapter/dispatchers/base_dispatcher.py
51
23
  mcp_proxy_adapter/dispatchers/json_rpc_dispatcher.py
24
+ mcp_proxy_adapter/examples/analyze_config.py
25
+ mcp_proxy_adapter/examples/basic_integration.py
26
+ mcp_proxy_adapter/examples/docstring_and_schema_example.py
27
+ mcp_proxy_adapter/examples/extension_example.py
28
+ mcp_proxy_adapter/examples/help_best_practices.py
29
+ mcp_proxy_adapter/examples/help_usage.py
30
+ mcp_proxy_adapter/examples/mcp_proxy_client.py
31
+ mcp_proxy_adapter/examples/openapi_server.py
32
+ mcp_proxy_adapter/examples/project_structure_example.py
33
+ mcp_proxy_adapter/examples/testing_example.py
52
34
  mcp_proxy_adapter/validators/docstring_validator.py
53
35
  mcp_proxy_adapter/validators/metadata_validator.py
54
- scripts/publish.py
55
- scripts/code_analyzer/code_analyzer.py
56
- scripts/code_analyzer/register_commands.py
57
36
  tests/conftest.py
58
37
  tests/test_adapter.py
59
38
  tests/test_adapter_coverage.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mcp-proxy-adapter"
7
- version = "2.1.3"
7
+ version = "2.1.4"
8
8
  description = "Adapter for exposing Command Registry commands as tools for AI models via MCP Proxy."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -14,7 +14,7 @@ with open(os.path.join(here, 'requirements.txt'), encoding='utf-8') as f:
14
14
 
15
15
  setup(
16
16
  name="mcp-proxy-adapter",
17
- version="2.1.3",
17
+ version="2.1.4",
18
18
  description="Adapter for exposing Command Registry commands as tools for AI models via MCP Proxy.",
19
19
  long_description=long_description,
20
20
  long_description_content_type="text/markdown",
@@ -42,6 +42,6 @@ setup(
42
42
  },
43
43
  include_package_data=True,
44
44
  package_data={
45
- "examples": ["*.py", "*.json"],
45
+ 'mcp_proxy_adapter': ['examples/*.py', 'examples/*.json', 'docs/*.md', '../README.md'],
46
46
  },
47
47
  )
@@ -1,172 +0,0 @@
1
- # Command Registry
2
-
3
- ## Overview
4
-
5
- Command Registry is a high-level system for centralized command management in applications. It provides a unified mechanism for defining, registering, executing, and documenting commands through various interfaces.
6
-
7
- ## Key Features
8
-
9
- - **Single access point** for application commands
10
- - **Automatic metadata extraction** from Python docstrings and type hints
11
- - **Integration with various protocols** (REST, JSON-RPC, WebSockets)
12
- - **API documentation generation** based on command metadata
13
- - **Input parameters and output values validation**
14
- - **Metadata compliance verification** with actual function signatures
15
- - **Extensibility** through interfaces for dispatchers, adapters, and schema generators
16
- - **AI model integration** via MCP Proxy Adapter
17
-
18
- ## Getting Started
19
-
20
- ### Installation
21
-
22
- ```bash
23
- pip install command-registry
24
- ```
25
-
26
- For MCP Proxy integration, also install:
27
-
28
- ```bash
29
- pip install mcp-proxy-adapter
30
- ```
31
-
32
- ### Simple Example
33
-
34
- ```python
35
- from command_registry import CommandRegistry
36
-
37
- # Create a command registry instance
38
- registry = CommandRegistry()
39
-
40
- # Define a command
41
- def add_numbers(a: int, b: int) -> int:
42
- """Adds two numbers.
43
-
44
- Args:
45
- a: First number
46
- b: Second number
47
-
48
- Returns:
49
- Sum of numbers a and b
50
- """
51
- return a + b
52
-
53
- # Register the command
54
- registry.register_command("add", add_numbers)
55
-
56
- # Execute the command
57
- result = registry.execute("add", {"a": 5, "b": 3}) # Returns 8
58
- ```
59
-
60
- ### FastAPI Export
61
-
62
- ```python
63
- from fastapi import FastAPI
64
- from command_registry.adapters import RESTAdapter
65
-
66
- app = FastAPI()
67
- adapter = RESTAdapter(registry)
68
- adapter.register_endpoints(app)
69
- ```
70
-
71
- ### MCP Proxy Integration for AI Models
72
-
73
- ```python
74
- from fastapi import FastAPI
75
- from mcp_proxy_adapter.adapter import MCPProxyAdapter
76
-
77
- app = FastAPI()
78
- adapter = MCPProxyAdapter(registry)
79
- adapter.register_endpoints(app)
80
-
81
- # Create configuration for MCP Proxy
82
- adapter.save_config_to_file("mcp_proxy_config.json")
83
- ```
84
-
85
- ### Automatic Command Registration from Module
86
-
87
- ```python
88
- # Scan module and register all found commands
89
- registry.scan_module("myapp.commands")
90
- ```
91
-
92
- ## Documentation
93
-
94
- - [Architecture](architecture.md) - detailed component description
95
- - [Command Development Guide](command_development.md) - best practices
96
- - [Examples](examples.md) - usage examples for various scenarios
97
- - [Validation](validation.md) - command validation mechanisms
98
- - [MCP Proxy Adapter](mcp_proxy_adapter.md) - AI model integration via MCP Proxy
99
-
100
- ## Project Structure
101
-
102
- ```
103
- command_registry/
104
- ├── __init__.py # Main public API
105
- ├── core.py # Core CommandRegistry logic
106
- ├── dispatchers/ # Command dispatchers
107
- │ ├── __init__.py
108
- │ ├── base_dispatcher.py # Abstract base class
109
- │ └── command_dispatcher.py # Main implementation
110
- ├── metadata/ # Metadata extraction
111
- │ ├── __init__.py
112
- │ ├── docstring_parser.py # Docstring parser
113
- │ └── type_analyzer.py # Type analyzer
114
- ├── validators/ # Validators
115
- │ ├── __init__.py
116
- │ └── parameter_validator.py # Parameter validation
117
- ├── adapters/ # Protocol adapters
118
- │ ├── __init__.py
119
- │ ├── rest_adapter.py # REST API
120
- │ └── json_rpc_adapter.py # JSON-RPC
121
- └── schema/ # Schema generators
122
- ├── __init__.py
123
- ├── openapi_generator.py # OpenAPI
124
- └── json_schema_generator.py # JSON Schema
125
- ```
126
-
127
- ## Integration with Existing Systems
128
-
129
- Command Registry is designed for easy integration with existing systems and frameworks:
130
-
131
- - **FastAPI** - via RESTAdapter
132
- - **Flask** - via RESTAdapter with modifications
133
- - **aiohttp** - via WebSockets adapter
134
- - **Click** - via CLI adapter
135
- - **GraphQL** - via GraphQL adapter
136
- - **MCP Proxy** - via MCPProxyAdapter for AI model integration
137
-
138
- ## Usage Examples
139
-
140
- ### REST API
141
-
142
- ```python
143
- from fastapi import FastAPI
144
- from command_registry import CommandRegistry
145
- from command_registry.adapters import RESTAdapter
146
-
147
- app = FastAPI()
148
- registry = CommandRegistry()
149
- registry.scan_module("myapp.commands")
150
-
151
- adapter = RESTAdapter(registry)
152
- adapter.register_endpoints(app)
153
- ```
154
-
155
- ### JSON-RPC via MCP Proxy Adapter
156
-
157
- ```python
158
- from fastapi import FastAPI
159
- from command_registry import CommandRegistry
160
- from mcp_proxy_adapter.adapter import MCPProxyAdapter
161
-
162
- app = FastAPI()
163
- registry = CommandRegistry()
164
- registry.scan_module("myapp.commands")
165
-
166
- adapter = MCPProxyAdapter(registry)
167
- adapter.register_endpoints(app)
168
- ```
169
-
170
- ## License
171
-
172
- MIT