mcp-proxy-adapter 2.1.0__py3-none-any.whl → 2.1.2__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.
- docs/README.md +172 -0
- docs/README_ru.md +172 -0
- docs/architecture.md +251 -0
- docs/architecture_ru.md +343 -0
- docs/command_development.md +250 -0
- docs/command_development_ru.md +593 -0
- docs/deployment.md +251 -0
- docs/deployment_ru.md +1298 -0
- docs/examples.md +254 -0
- docs/examples_ru.md +401 -0
- docs/mcp_proxy_adapter.md +251 -0
- docs/mcp_proxy_adapter_ru.md +405 -0
- docs/quickstart.md +251 -0
- docs/quickstart_ru.md +397 -0
- docs/testing.md +255 -0
- docs/testing_ru.md +469 -0
- docs/validation_ru.md +287 -0
- examples/analyze_config.py +141 -0
- examples/basic_integration.py +161 -0
- examples/docstring_and_schema_example.py +60 -0
- examples/extension_example.py +60 -0
- examples/help_best_practices.py +67 -0
- examples/help_usage.py +64 -0
- examples/mcp_proxy_client.py +131 -0
- examples/mcp_proxy_config.json +175 -0
- examples/openapi_server.py +369 -0
- examples/project_structure_example.py +47 -0
- examples/testing_example.py +53 -0
- mcp_proxy_adapter/__init__.py +17 -0
- mcp_proxy_adapter/adapter.py +697 -0
- mcp_proxy_adapter/models.py +47 -0
- mcp_proxy_adapter/registry.py +439 -0
- mcp_proxy_adapter/schema.py +257 -0
- {mcp_proxy_adapter-2.1.0.dist-info → mcp_proxy_adapter-2.1.2.dist-info}/METADATA +2 -2
- mcp_proxy_adapter-2.1.2.dist-info/RECORD +61 -0
- mcp_proxy_adapter-2.1.2.dist-info/top_level.txt +5 -0
- scripts/code_analyzer/code_analyzer.py +328 -0
- scripts/code_analyzer/register_commands.py +446 -0
- scripts/publish.py +85 -0
- tests/conftest.py +12 -0
- tests/test_adapter.py +529 -0
- tests/test_adapter_coverage.py +274 -0
- tests/test_basic_dispatcher.py +169 -0
- tests/test_command_registry.py +328 -0
- tests/test_examples.py +32 -0
- tests/test_mcp_proxy_adapter.py +568 -0
- tests/test_mcp_proxy_adapter_basic.py +262 -0
- tests/test_part1.py +348 -0
- tests/test_part2.py +524 -0
- tests/test_schema.py +358 -0
- tests/test_simple_adapter.py +251 -0
- adapters/__init__.py +0 -16
- cli/__init__.py +0 -12
- cli/__main__.py +0 -79
- cli/command_runner.py +0 -233
- generators/__init__.py +0 -14
- generators/endpoint_generator.py +0 -172
- generators/openapi_generator.py +0 -254
- generators/rest_api_generator.py +0 -207
- mcp_proxy_adapter-2.1.0.dist-info/RECORD +0 -28
- mcp_proxy_adapter-2.1.0.dist-info/top_level.txt +0 -7
- openapi_schema/__init__.py +0 -38
- openapi_schema/command_registry.py +0 -312
- openapi_schema/rest_schema.py +0 -510
- openapi_schema/rpc_generator.py +0 -307
- openapi_schema/rpc_schema.py +0 -416
- validators/__init__.py +0 -14
- validators/base_validator.py +0 -23
- {analyzers → mcp_proxy_adapter/analyzers}/__init__.py +0 -0
- {analyzers → mcp_proxy_adapter/analyzers}/docstring_analyzer.py +0 -0
- {analyzers → mcp_proxy_adapter/analyzers}/type_analyzer.py +0 -0
- {dispatchers → mcp_proxy_adapter/dispatchers}/__init__.py +0 -0
- {dispatchers → mcp_proxy_adapter/dispatchers}/base_dispatcher.py +0 -0
- {dispatchers → mcp_proxy_adapter/dispatchers}/json_rpc_dispatcher.py +0 -0
- {validators → mcp_proxy_adapter/validators}/docstring_validator.py +0 -0
- {validators → mcp_proxy_adapter/validators}/metadata_validator.py +0 -0
- {mcp_proxy_adapter-2.1.0.dist-info → mcp_proxy_adapter-2.1.2.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-2.1.0.dist-info → mcp_proxy_adapter-2.1.2.dist-info}/licenses/LICENSE +0 -0
openapi_schema/rest_schema.py
DELETED
@@ -1,510 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
REST OpenAPI схема для API сервера.
|
3
|
-
Содержит все определения REST эндпоинтов, параметров и ответов.
|
4
|
-
"""
|
5
|
-
from typing import Dict, Any
|
6
|
-
|
7
|
-
__all__ = ["get_rest_schema"]
|
8
|
-
|
9
|
-
|
10
|
-
def get_rest_schema() -> Dict[str, Any]:
|
11
|
-
"""
|
12
|
-
Создает и возвращает OpenAPI схему для REST API.
|
13
|
-
|
14
|
-
Returns:
|
15
|
-
Dict[str, Any]: Схема OpenAPI для REST API
|
16
|
-
"""
|
17
|
-
return {
|
18
|
-
"openapi": "3.0.2",
|
19
|
-
"info": {
|
20
|
-
"title": "Vector Store API",
|
21
|
-
"description": "API для работы с векторным хранилищем",
|
22
|
-
"version": "1.0.0"
|
23
|
-
},
|
24
|
-
"paths": {
|
25
|
-
"/health": {
|
26
|
-
"get": {
|
27
|
-
"summary": "Проверка состояния сервера",
|
28
|
-
"operationId": "check_health",
|
29
|
-
"description": "Проверяет доступность и состояние сервера",
|
30
|
-
"parameters": [
|
31
|
-
{
|
32
|
-
"name": "check_type",
|
33
|
-
"in": "query",
|
34
|
-
"required": False,
|
35
|
-
"schema": {
|
36
|
-
"type": "string",
|
37
|
-
"enum": ["basic", "detailed"],
|
38
|
-
"default": "basic"
|
39
|
-
},
|
40
|
-
"description": "Тип проверки: базовая или расширенная"
|
41
|
-
}
|
42
|
-
],
|
43
|
-
"responses": {
|
44
|
-
"200": {
|
45
|
-
"description": "Успешный ответ",
|
46
|
-
"content": {
|
47
|
-
"application/json": {
|
48
|
-
"schema": {
|
49
|
-
"$ref": "#/components/schemas/HealthResponse"
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
},
|
57
|
-
"/network/check": {
|
58
|
-
"post": {
|
59
|
-
"summary": "Проверка сетевого соединения",
|
60
|
-
"operationId": "network_check",
|
61
|
-
"description": "Проверяет доступность указанного хоста и порта",
|
62
|
-
"requestBody": {
|
63
|
-
"required": True,
|
64
|
-
"content": {
|
65
|
-
"application/json": {
|
66
|
-
"schema": {
|
67
|
-
"$ref": "#/components/schemas/NetworkCheckRequest"
|
68
|
-
}
|
69
|
-
}
|
70
|
-
}
|
71
|
-
},
|
72
|
-
"responses": {
|
73
|
-
"200": {
|
74
|
-
"description": "Успешный ответ",
|
75
|
-
"content": {
|
76
|
-
"application/json": {
|
77
|
-
"schema": {
|
78
|
-
"$ref": "#/components/schemas/NetworkCheckResponse"
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
},
|
86
|
-
"/config/reload": {
|
87
|
-
"post": {
|
88
|
-
"summary": "Перезагрузка конфигурации",
|
89
|
-
"operationId": "reload_config",
|
90
|
-
"description": "Перезагружает конфигурацию сервера",
|
91
|
-
"requestBody": {
|
92
|
-
"required": False,
|
93
|
-
"content": {
|
94
|
-
"application/json": {
|
95
|
-
"schema": {
|
96
|
-
"$ref": "#/components/schemas/ReloadConfigRequest"
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
},
|
101
|
-
"responses": {
|
102
|
-
"200": {
|
103
|
-
"description": "Успешный ответ",
|
104
|
-
"content": {
|
105
|
-
"application/json": {
|
106
|
-
"schema": {
|
107
|
-
"$ref": "#/components/schemas/BaseResponse"
|
108
|
-
}
|
109
|
-
}
|
110
|
-
}
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
},
|
115
|
-
"/index": {
|
116
|
-
"post": {
|
117
|
-
"summary": "Добавление векторов",
|
118
|
-
"operationId": "add_vectors",
|
119
|
-
"description": "Добавляет векторы в хранилище",
|
120
|
-
"requestBody": {
|
121
|
-
"required": True,
|
122
|
-
"content": {
|
123
|
-
"application/json": {
|
124
|
-
"schema": {
|
125
|
-
"$ref": "#/components/schemas/IndexRequest"
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
},
|
130
|
-
"responses": {
|
131
|
-
"200": {
|
132
|
-
"description": "Успешный ответ",
|
133
|
-
"content": {
|
134
|
-
"application/json": {
|
135
|
-
"schema": {
|
136
|
-
"$ref": "#/components/schemas/IndexResponse"
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
},
|
144
|
-
"/search": {
|
145
|
-
"post": {
|
146
|
-
"summary": "Поиск по векторам",
|
147
|
-
"operationId": "search",
|
148
|
-
"description": "Выполняет поиск по векторам в хранилище",
|
149
|
-
"requestBody": {
|
150
|
-
"required": True,
|
151
|
-
"content": {
|
152
|
-
"application/json": {
|
153
|
-
"schema": {
|
154
|
-
"$ref": "#/components/schemas/SearchRequest"
|
155
|
-
}
|
156
|
-
}
|
157
|
-
}
|
158
|
-
},
|
159
|
-
"responses": {
|
160
|
-
"200": {
|
161
|
-
"description": "Успешный ответ",
|
162
|
-
"content": {
|
163
|
-
"application/json": {
|
164
|
-
"schema": {
|
165
|
-
"$ref": "#/components/schemas/SearchResponse"
|
166
|
-
}
|
167
|
-
}
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}
|
171
|
-
}
|
172
|
-
},
|
173
|
-
"/help": {
|
174
|
-
"get": {
|
175
|
-
"summary": "Получение справочной информации",
|
176
|
-
"operationId": "get_help",
|
177
|
-
"description": "Возвращает справочную информацию обо всех доступных командах или конкретной команде",
|
178
|
-
"parameters": [
|
179
|
-
{
|
180
|
-
"name": "command",
|
181
|
-
"in": "query",
|
182
|
-
"required": False,
|
183
|
-
"schema": {
|
184
|
-
"type": "string"
|
185
|
-
},
|
186
|
-
"description": "Название команды для получения справки. Если не указано, возвращается список всех доступных команд."
|
187
|
-
}
|
188
|
-
],
|
189
|
-
"responses": {
|
190
|
-
"200": {
|
191
|
-
"description": "Успешный ответ",
|
192
|
-
"content": {
|
193
|
-
"application/json": {
|
194
|
-
"schema": {
|
195
|
-
"$ref": "#/components/schemas/HelpResponse"
|
196
|
-
}
|
197
|
-
}
|
198
|
-
}
|
199
|
-
}
|
200
|
-
}
|
201
|
-
}
|
202
|
-
}
|
203
|
-
},
|
204
|
-
"components": {
|
205
|
-
"schemas": {
|
206
|
-
"BaseResponse": {
|
207
|
-
"type": "object",
|
208
|
-
"properties": {
|
209
|
-
"status": {
|
210
|
-
"type": "string",
|
211
|
-
"description": "Статус выполнения операции"
|
212
|
-
},
|
213
|
-
"message": {
|
214
|
-
"type": "string",
|
215
|
-
"description": "Сообщение о результате операции"
|
216
|
-
}
|
217
|
-
},
|
218
|
-
"required": ["status"]
|
219
|
-
},
|
220
|
-
"HealthResponse": {
|
221
|
-
"type": "object",
|
222
|
-
"properties": {
|
223
|
-
"status": {
|
224
|
-
"type": "string",
|
225
|
-
"description": "Статус сервера"
|
226
|
-
},
|
227
|
-
"version": {
|
228
|
-
"type": "string",
|
229
|
-
"description": "Версия сервера"
|
230
|
-
},
|
231
|
-
"timestamp": {
|
232
|
-
"type": "string",
|
233
|
-
"format": "date-time",
|
234
|
-
"description": "Время ответа"
|
235
|
-
},
|
236
|
-
"details": {
|
237
|
-
"type": "object",
|
238
|
-
"additionalProperties": True,
|
239
|
-
"description": "Дополнительная информация при детальной проверке"
|
240
|
-
}
|
241
|
-
},
|
242
|
-
"required": ["status", "timestamp"]
|
243
|
-
},
|
244
|
-
"NetworkCheckRequest": {
|
245
|
-
"type": "object",
|
246
|
-
"properties": {
|
247
|
-
"host": {
|
248
|
-
"type": "string",
|
249
|
-
"description": "Хост для проверки"
|
250
|
-
},
|
251
|
-
"port": {
|
252
|
-
"type": "integer",
|
253
|
-
"description": "Порт для проверки"
|
254
|
-
},
|
255
|
-
"timeout": {
|
256
|
-
"type": "number",
|
257
|
-
"description": "Таймаут в секундах",
|
258
|
-
"default": 5
|
259
|
-
}
|
260
|
-
},
|
261
|
-
"required": ["host", "port"]
|
262
|
-
},
|
263
|
-
"NetworkCheckResponse": {
|
264
|
-
"type": "object",
|
265
|
-
"properties": {
|
266
|
-
"status": {
|
267
|
-
"type": "string",
|
268
|
-
"description": "Статус проверки"
|
269
|
-
},
|
270
|
-
"host": {
|
271
|
-
"type": "string",
|
272
|
-
"description": "Проверенный хост"
|
273
|
-
},
|
274
|
-
"port": {
|
275
|
-
"type": "integer",
|
276
|
-
"description": "Проверенный порт"
|
277
|
-
},
|
278
|
-
"accessible": {
|
279
|
-
"type": "boolean",
|
280
|
-
"description": "Доступность хоста и порта"
|
281
|
-
},
|
282
|
-
"latency": {
|
283
|
-
"type": "number",
|
284
|
-
"description": "Время отклика в миллисекундах"
|
285
|
-
}
|
286
|
-
},
|
287
|
-
"required": ["status", "host", "port", "accessible"]
|
288
|
-
},
|
289
|
-
"ReloadConfigRequest": {
|
290
|
-
"type": "object",
|
291
|
-
"properties": {
|
292
|
-
"config_path": {
|
293
|
-
"type": "string",
|
294
|
-
"description": "Путь к файлу конфигурации (опционально)"
|
295
|
-
}
|
296
|
-
}
|
297
|
-
},
|
298
|
-
"Vector": {
|
299
|
-
"type": "array",
|
300
|
-
"items": {
|
301
|
-
"type": "number",
|
302
|
-
"format": "float"
|
303
|
-
},
|
304
|
-
"description": "Вектор в представлении массива чисел с плавающей точкой",
|
305
|
-
"minItems": 384,
|
306
|
-
"maxItems": 384
|
307
|
-
},
|
308
|
-
"Metadata": {
|
309
|
-
"type": "object",
|
310
|
-
"additionalProperties": True,
|
311
|
-
"description": "Метаданные, связанные с вектором"
|
312
|
-
},
|
313
|
-
"IndexRequest": {
|
314
|
-
"type": "object",
|
315
|
-
"properties": {
|
316
|
-
"vectors": {
|
317
|
-
"type": "array",
|
318
|
-
"items": {
|
319
|
-
"type": "object",
|
320
|
-
"properties": {
|
321
|
-
"vector": {
|
322
|
-
"$ref": "#/components/schemas/Vector"
|
323
|
-
},
|
324
|
-
"metadata": {
|
325
|
-
"$ref": "#/components/schemas/Metadata"
|
326
|
-
}
|
327
|
-
},
|
328
|
-
"required": ["vector"]
|
329
|
-
},
|
330
|
-
"description": "Массив векторов для добавления"
|
331
|
-
}
|
332
|
-
},
|
333
|
-
"required": ["vectors"]
|
334
|
-
},
|
335
|
-
"IndexResponse": {
|
336
|
-
"type": "object",
|
337
|
-
"properties": {
|
338
|
-
"status": {
|
339
|
-
"type": "string",
|
340
|
-
"description": "Статус операции"
|
341
|
-
},
|
342
|
-
"ids": {
|
343
|
-
"type": "array",
|
344
|
-
"items": {
|
345
|
-
"type": "string",
|
346
|
-
"format": "uuid"
|
347
|
-
},
|
348
|
-
"description": "Идентификаторы добавленных векторов"
|
349
|
-
},
|
350
|
-
"count": {
|
351
|
-
"type": "integer",
|
352
|
-
"description": "Количество добавленных векторов"
|
353
|
-
}
|
354
|
-
},
|
355
|
-
"required": ["status", "ids", "count"]
|
356
|
-
},
|
357
|
-
"SearchRequest": {
|
358
|
-
"type": "object",
|
359
|
-
"properties": {
|
360
|
-
"vector": {
|
361
|
-
"$ref": "#/components/schemas/Vector"
|
362
|
-
},
|
363
|
-
"top_k": {
|
364
|
-
"type": "integer",
|
365
|
-
"description": "Количество результатов для возврата",
|
366
|
-
"default": 10,
|
367
|
-
"minimum": 1
|
368
|
-
},
|
369
|
-
"filter": {
|
370
|
-
"type": "object",
|
371
|
-
"additionalProperties": True,
|
372
|
-
"description": "Фильтр для метаданных"
|
373
|
-
}
|
374
|
-
},
|
375
|
-
"required": ["vector"]
|
376
|
-
},
|
377
|
-
"SearchResponse": {
|
378
|
-
"type": "object",
|
379
|
-
"properties": {
|
380
|
-
"status": {
|
381
|
-
"type": "string",
|
382
|
-
"description": "Статус операции"
|
383
|
-
},
|
384
|
-
"results": {
|
385
|
-
"type": "array",
|
386
|
-
"items": {
|
387
|
-
"type": "object",
|
388
|
-
"properties": {
|
389
|
-
"id": {
|
390
|
-
"type": "string",
|
391
|
-
"format": "uuid",
|
392
|
-
"description": "Идентификатор найденного вектора"
|
393
|
-
},
|
394
|
-
"score": {
|
395
|
-
"type": "number",
|
396
|
-
"format": "float",
|
397
|
-
"description": "Оценка сходства"
|
398
|
-
},
|
399
|
-
"metadata": {
|
400
|
-
"$ref": "#/components/schemas/Metadata"
|
401
|
-
}
|
402
|
-
},
|
403
|
-
"required": ["id", "score"]
|
404
|
-
},
|
405
|
-
"description": "Результаты поиска"
|
406
|
-
},
|
407
|
-
"total": {
|
408
|
-
"type": "integer",
|
409
|
-
"description": "Общее количество результатов"
|
410
|
-
}
|
411
|
-
},
|
412
|
-
"required": ["status", "results", "total"]
|
413
|
-
},
|
414
|
-
"HelpParams": {
|
415
|
-
"type": "object",
|
416
|
-
"properties": {
|
417
|
-
"command": {
|
418
|
-
"type": "string",
|
419
|
-
"description": "Название команды для получения справки. Если не указано, возвращается список всех доступных команд."
|
420
|
-
}
|
421
|
-
},
|
422
|
-
"title": "HelpParams",
|
423
|
-
"description": "Параметры для команды help (получение справки по командам)"
|
424
|
-
},
|
425
|
-
"HelpResponse": {
|
426
|
-
"type": "object",
|
427
|
-
"properties": {
|
428
|
-
"status": {
|
429
|
-
"type": "string",
|
430
|
-
"description": "Статус операции"
|
431
|
-
},
|
432
|
-
"commands": {
|
433
|
-
"type": "array",
|
434
|
-
"items": {
|
435
|
-
"type": "object",
|
436
|
-
"properties": {
|
437
|
-
"name": {
|
438
|
-
"type": "string",
|
439
|
-
"description": "Название команды"
|
440
|
-
},
|
441
|
-
"summary": {
|
442
|
-
"type": "string",
|
443
|
-
"description": "Краткое описание команды"
|
444
|
-
},
|
445
|
-
"description": {
|
446
|
-
"type": "string",
|
447
|
-
"description": "Полное описание команды"
|
448
|
-
},
|
449
|
-
"parameters": {
|
450
|
-
"type": "array",
|
451
|
-
"items": {
|
452
|
-
"type": "object",
|
453
|
-
"properties": {
|
454
|
-
"name": {
|
455
|
-
"type": "string",
|
456
|
-
"description": "Название параметра"
|
457
|
-
},
|
458
|
-
"type": {
|
459
|
-
"type": "string",
|
460
|
-
"description": "Тип параметра"
|
461
|
-
},
|
462
|
-
"description": {
|
463
|
-
"type": "string",
|
464
|
-
"description": "Описание параметра"
|
465
|
-
},
|
466
|
-
"required": {
|
467
|
-
"type": "boolean",
|
468
|
-
"description": "Является ли параметр обязательным"
|
469
|
-
},
|
470
|
-
"default": {
|
471
|
-
"description": "Значение по умолчанию (если есть)"
|
472
|
-
}
|
473
|
-
},
|
474
|
-
"required": ["name", "type", "description"]
|
475
|
-
},
|
476
|
-
"description": "Параметры команды"
|
477
|
-
},
|
478
|
-
"examples": {
|
479
|
-
"type": "array",
|
480
|
-
"items": {
|
481
|
-
"type": "object",
|
482
|
-
"properties": {
|
483
|
-
"description": {
|
484
|
-
"type": "string",
|
485
|
-
"description": "Описание примера"
|
486
|
-
},
|
487
|
-
"request": {
|
488
|
-
"type": "object",
|
489
|
-
"description": "Пример запроса"
|
490
|
-
},
|
491
|
-
"response": {
|
492
|
-
"type": "object",
|
493
|
-
"description": "Пример ответа"
|
494
|
-
}
|
495
|
-
},
|
496
|
-
"required": ["description", "request"]
|
497
|
-
},
|
498
|
-
"description": "Примеры использования команды"
|
499
|
-
}
|
500
|
-
},
|
501
|
-
"required": ["name", "summary", "description"]
|
502
|
-
},
|
503
|
-
"description": "Список доступных команд или детальная информация о конкретной команде"
|
504
|
-
}
|
505
|
-
},
|
506
|
-
"required": ["status", "commands"]
|
507
|
-
}
|
508
|
-
}
|
509
|
-
}
|
510
|
-
}
|