awslabs.openapi-mcp-server 0.2.10__py3-none-any.whl → 0.2.11__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.
- awslabs/openapi_mcp_server/__init__.py +1 -1
- awslabs/openapi_mcp_server/server.py +42 -22
- {awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/METADATA +1 -1
- {awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/RECORD +8 -8
- {awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/WHEEL +0 -0
- {awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/entry_points.txt +0 -0
- {awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/licenses/LICENSE +0 -0
- {awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/licenses/NOTICE +0 -0
|
@@ -33,7 +33,7 @@ from fastmcp.server.openapi import FastMCPOpenAPI, MCPType, RouteMap
|
|
|
33
33
|
from typing import Any, Dict
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def
|
|
36
|
+
async def create_mcp_server_async(config: Config) -> FastMCP:
|
|
37
37
|
"""Create and configure the FastMCP server.
|
|
38
38
|
|
|
39
39
|
Args:
|
|
@@ -221,7 +221,7 @@ def create_mcp_server(config: Config) -> FastMCP:
|
|
|
221
221
|
prompt_manager = MCPPromptManager()
|
|
222
222
|
|
|
223
223
|
# Generate prompts
|
|
224
|
-
|
|
224
|
+
await prompt_manager.generate_prompts(server, config.api_name, openapi_spec)
|
|
225
225
|
|
|
226
226
|
# Register resource handler
|
|
227
227
|
prompt_manager.register_api_resource_handler(server, config.api_name, client)
|
|
@@ -292,7 +292,7 @@ def create_mcp_server(config: Config) -> FastMCP:
|
|
|
292
292
|
if hasattr(server, 'list_tools'):
|
|
293
293
|
try:
|
|
294
294
|
# Use asyncio to run the async method in a synchronous context
|
|
295
|
-
tools =
|
|
295
|
+
tools = await server.list_tools() # type: ignore
|
|
296
296
|
tool_count = len(tools)
|
|
297
297
|
tool_names = [tool.get('name') for tool in tools]
|
|
298
298
|
|
|
@@ -344,6 +344,45 @@ def create_mcp_server(config: Config) -> FastMCP:
|
|
|
344
344
|
return server
|
|
345
345
|
|
|
346
346
|
|
|
347
|
+
def create_mcp_server(config: Config) -> FastMCP:
|
|
348
|
+
"""Create and configure the FastMCP server (synchronous wrapper).
|
|
349
|
+
|
|
350
|
+
This is a synchronous convenience wrapper that calls
|
|
351
|
+
:func:`create_mcp_server_async` using ``asyncio.run``.
|
|
352
|
+
For asynchronous contexts, use :func:`create_mcp_server_async`
|
|
353
|
+
directly instead of this function.
|
|
354
|
+
|
|
355
|
+
Args:
|
|
356
|
+
config: Server configuration.
|
|
357
|
+
|
|
358
|
+
Returns:
|
|
359
|
+
FastMCP: The configured FastMCP server.
|
|
360
|
+
|
|
361
|
+
"""
|
|
362
|
+
return asyncio.run(create_mcp_server_async(config))
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
async def get_all_counts(server: FastMCP) -> tuple[int, int, int, int]:
|
|
366
|
+
"""Get counts of prompts, tools, resources, and resource templates."""
|
|
367
|
+
prompts = await server.get_prompts()
|
|
368
|
+
tools = await server.get_tools()
|
|
369
|
+
resources = await server.get_resources()
|
|
370
|
+
|
|
371
|
+
# Get resource templates if available
|
|
372
|
+
resource_templates = []
|
|
373
|
+
if hasattr(server, 'get_resource_templates'):
|
|
374
|
+
try:
|
|
375
|
+
resource_templates = await server.get_resource_templates()
|
|
376
|
+
except AttributeError as e:
|
|
377
|
+
# This is expected if the method exists but is not implemented
|
|
378
|
+
logger.debug(f'get_resource_templates exists but not implemented: {e}')
|
|
379
|
+
except Exception as e:
|
|
380
|
+
# Log other unexpected errors
|
|
381
|
+
logger.warning(f'Error retrieving resource templates: {e}')
|
|
382
|
+
|
|
383
|
+
return len(prompts), len(tools), len(resources), len(resource_templates)
|
|
384
|
+
|
|
385
|
+
|
|
347
386
|
def setup_signal_handlers():
|
|
348
387
|
"""Set up signal handlers for graceful shutdown."""
|
|
349
388
|
# Store original SIGINT handler
|
|
@@ -466,25 +505,6 @@ def main():
|
|
|
466
505
|
|
|
467
506
|
try:
|
|
468
507
|
# Get counts of prompts, tools, resources, and resource templates
|
|
469
|
-
async def get_all_counts(server):
|
|
470
|
-
prompts = await server.get_prompts()
|
|
471
|
-
tools = await server.get_tools()
|
|
472
|
-
resources = await server.get_resources()
|
|
473
|
-
|
|
474
|
-
# Get resource templates if available
|
|
475
|
-
resource_templates = []
|
|
476
|
-
if hasattr(server, 'get_resource_templates'):
|
|
477
|
-
try:
|
|
478
|
-
resource_templates = await server.get_resource_templates()
|
|
479
|
-
except AttributeError as e:
|
|
480
|
-
# This is expected if the method exists but is not implemented
|
|
481
|
-
logger.debug(f'get_resource_templates exists but not implemented: {e}')
|
|
482
|
-
except Exception as e:
|
|
483
|
-
# Log other unexpected errors
|
|
484
|
-
logger.warning(f'Error retrieving resource templates: {e}')
|
|
485
|
-
|
|
486
|
-
return len(prompts), len(tools), len(resources), len(resource_templates)
|
|
487
|
-
|
|
488
508
|
prompt_count, tool_count, resource_count, resource_template_count = asyncio.run(
|
|
489
509
|
get_all_counts(mcp_server)
|
|
490
510
|
)
|
{awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: awslabs.openapi-mcp-server
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.11
|
|
4
4
|
Summary: An AWS Labs Model Context Protocol (MCP) server for OpenAPI
|
|
5
5
|
Project-URL: Homepage, https://awslabs.github.io/mcp/
|
|
6
6
|
Project-URL: Documentation, https://awslabs.github.io/mcp/servers/openapi-mcp-server/
|
{awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
awslabs/__init__.py,sha256=S-EDeDHGZzllMFhAeuJx_47fv85t2OUMOcsOisD5d_8,796
|
|
2
|
-
awslabs/openapi_mcp_server/__init__.py,sha256=
|
|
3
|
-
awslabs/openapi_mcp_server/server.py,sha256=
|
|
2
|
+
awslabs/openapi_mcp_server/__init__.py,sha256=sVEVqopruJ91m9g362Q3EGRkRwxmdzXOm_gvdz-BLqI,2061
|
|
3
|
+
awslabs/openapi_mcp_server/server.py,sha256=IFZJ0oZMZXJZ7GRrKpMbh3IFO5b44vuj9xBV61udVWw,22138
|
|
4
4
|
awslabs/openapi_mcp_server/api/__init__.py,sha256=KWcmd1bH1vact1QJBfR0zFX7knWhFrBgaMEe9Tu9qi0,774
|
|
5
5
|
awslabs/openapi_mcp_server/api/config.py,sha256=WT9ELzBOtZkd_DrzrkL_uuVoDibw2k94tU28CvHL32Q,9503
|
|
6
6
|
awslabs/openapi_mcp_server/auth/__init__.py,sha256=wDFPpe2PmaDVvlYSdzR4saSKthgQmVPr9lwaKe3Z2RE,1109
|
|
@@ -30,9 +30,9 @@ awslabs/openapi_mcp_server/utils/http_client.py,sha256=a2wu7lfyuq1O_6ilaFQ9geFJy
|
|
|
30
30
|
awslabs/openapi_mcp_server/utils/metrics_provider.py,sha256=1R__ZUxUrrB5KoKx4q6WYWHhaDTpFnr0UWTgZO28HVI,17731
|
|
31
31
|
awslabs/openapi_mcp_server/utils/openapi.py,sha256=eRQUC5AidkyR1ALQNsR0kLXlr0Mq8ZXCduLVWUXXhuA,8802
|
|
32
32
|
awslabs/openapi_mcp_server/utils/openapi_validator.py,sha256=MVJj84a8vw0BUn21pfkav6oJagDF1dSotcLK9otXzE4,9614
|
|
33
|
-
awslabs_openapi_mcp_server-0.2.
|
|
34
|
-
awslabs_openapi_mcp_server-0.2.
|
|
35
|
-
awslabs_openapi_mcp_server-0.2.
|
|
36
|
-
awslabs_openapi_mcp_server-0.2.
|
|
37
|
-
awslabs_openapi_mcp_server-0.2.
|
|
38
|
-
awslabs_openapi_mcp_server-0.2.
|
|
33
|
+
awslabs_openapi_mcp_server-0.2.11.dist-info/METADATA,sha256=tnqP9_s3a-QNyq3wVV1MtYs86qmuKeA1Ec9kcGEjwnc,19955
|
|
34
|
+
awslabs_openapi_mcp_server-0.2.11.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
35
|
+
awslabs_openapi_mcp_server-0.2.11.dist-info/entry_points.txt,sha256=0BwvRNOdGm62ExFDks-9tSTWgtOdI3qmg-aemCMXQkM,86
|
|
36
|
+
awslabs_openapi_mcp_server-0.2.11.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
|
37
|
+
awslabs_openapi_mcp_server-0.2.11.dist-info/licenses/NOTICE,sha256=fG29aqEG3L4KHNXheKdyD5TdsgFh7eaaFlXu-okbf5o,94
|
|
38
|
+
awslabs_openapi_mcp_server-0.2.11.dist-info/RECORD,,
|
{awslabs_openapi_mcp_server-0.2.10.dist-info → awslabs_openapi_mcp_server-0.2.11.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|