awslabs.openapi-mcp-server 0.2.9__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.
@@ -15,7 +15,7 @@
15
15
  OpenAPI MCP Server - A server that dynamically creates MCP tools and resources from OpenAPI specifications.
16
16
  """
17
17
 
18
- __version__ = '0.2.9'
18
+ __version__ = '0.2.11'
19
19
 
20
20
 
21
21
  import inspect
@@ -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 create_mcp_server(config: Config) -> FastMCP:
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
- asyncio.run(prompt_manager.generate_prompts(server, config.api_name, openapi_spec))
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 = asyncio.run(server.list_tools()) # type: ignore
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
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.openapi-mcp-server
3
- Version: 0.2.9
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/
@@ -86,9 +86,9 @@ This project is a server that dynamically creates Model Context Protocol (MCP) t
86
86
 
87
87
  ## Installation
88
88
 
89
- | Cursor | VS Code |
90
- |:------:|:-------:|
91
- | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/en/install-mcp?name=awslabs.openapi-mcp-server&config=eyJjb21tYW5kIjoidXZ4IGF3c2xhYnMub3BlbmFwaS1tY3Atc2VydmVyQGxhdGVzdCIsImVudiI6eyJBUElfTkFNRSI6InlvdXItYXBpLW5hbWUiLCJBUElfQkFTRV9VUkwiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsIkFQSV9TUEVDX1VSTCI6Imh0dHBzOi8vYXBpLmV4YW1wbGUuY29tL29wZW5hcGkuanNvbiIsIkxPR19MRVZFTCI6IkVSUk9SIiwiRU5BQkxFX1BST01FVEhFVVMiOiJmYWxzZSIsIkVOQUJMRV9PUEVSQVRJT05fUFJPTVBUUyI6InRydWUiLCJVVklDT1JOX1RJTUVPVVRfR1JBQ0VGVUxfU0hVVERPV04iOiI1LjAiLCJVVklDT1JOX0dSQUNFRlVMX1NIVVRET1dOIjoidHJ1ZSJ9LCJkaXNhYmxlZCI6ZmFsc2UsImF1dG9BcHByb3ZlIjpbXX0%3D) | [![Install on VS Code](https://img.shields.io/badge/Install_on-VS_Code-FF9900?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=OpenAPI%20MCP%20Server&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22awslabs.openapi-mcp-server%40latest%22%5D%2C%22env%22%3A%7B%22API_NAME%22%3A%22your-api-name%22%2C%22API_BASE_URL%22%3A%22https%3A%2F%2Fapi.example.com%22%2C%22API_SPEC_URL%22%3A%22https%3A%2F%2Fapi.example.com%2Fopenapi.json%22%2C%22LOG_LEVEL%22%3A%22ERROR%22%2C%22ENABLE_PROMETHEUS%22%3A%22false%22%2C%22ENABLE_OPERATION_PROMPTS%22%3A%22true%22%2C%22UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN%22%3A%225.0%22%2C%22UVICORN_GRACEFUL_SHUTDOWN%22%3A%22true%22%7D%2C%22disabled%22%3Afalse%2C%22autoApprove%22%3A%5B%5D%7D) |
89
+ | Kiro | Cursor | VS Code |
90
+ |:----:|:------:|:-------:|
91
+ | [![Add to Kiro](https://kiro.dev/images/add-to-kiro.svg)](https://kiro.dev/launch/mcp/add?name=awslabs.openapi-mcp-server&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22awslabs.openapi-mcp-server%40latest%22%5D%2C%22env%22%3A%7B%22API_NAME%22%3A%22your-api-name%22%2C%22API_BASE_URL%22%3A%22https%3A//api.example.com%22%2C%22API_SPEC_URL%22%3A%22https%3A//api.example.com/openapi.json%22%2C%22LOG_LEVEL%22%3A%22ERROR%22%2C%22ENABLE_PROMETHEUS%22%3A%22false%22%2C%22ENABLE_OPERATION_PROMPTS%22%3A%22true%22%2C%22UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN%22%3A%225.0%22%2C%22UVICORN_GRACEFUL_SHUTDOWN%22%3A%22true%22%7D%7D) | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/en/install-mcp?name=awslabs.openapi-mcp-server&config=eyJjb21tYW5kIjoidXZ4IGF3c2xhYnMub3BlbmFwaS1tY3Atc2VydmVyQGxhdGVzdCIsImVudiI6eyJBUElfTkFNRSI6InlvdXItYXBpLW5hbWUiLCJBUElfQkFTRV9VUkwiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsIkFQSV9TUEVDX1VSTCI6Imh0dHBzOi8vYXBpLmV4YW1wbGUuY29tL29wZW5hcGkuanNvbiIsIkxPR19MRVZFTCI6IkVSUk9SIiwiRU5BQkxFX1BST01FVEhFVVMiOiJmYWxzZSIsIkVOQUJMRV9PUEVSQVRJT05fUFJPTVBUUyI6InRydWUiLCJVVklDT1JOX1RJTUVPVVRfR1JBQ0VGVUxfU0hVVERPV04iOiI1LjAiLCJVVklDT1JOX0dSQUNFRlVMX1NIVVRET1dOIjoidHJ1ZSJ9LCJkaXNhYmxlZCI6ZmFsc2UsImF1dG9BcHByb3ZlIjpbXX0%3D) | [![Install on VS Code](https://img.shields.io/badge/Install_on-VS_Code-FF9900?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=OpenAPI%20MCP%20Server&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22awslabs.openapi-mcp-server%40latest%22%5D%2C%22env%22%3A%7B%22API_NAME%22%3A%22your-api-name%22%2C%22API_BASE_URL%22%3A%22https%3A%2F%2Fapi.example.com%22%2C%22API_SPEC_URL%22%3A%22https%3A%2F%2Fapi.example.com%2Fopenapi.json%22%2C%22LOG_LEVEL%22%3A%22ERROR%22%2C%22ENABLE_PROMETHEUS%22%3A%22false%22%2C%22ENABLE_OPERATION_PROMPTS%22%3A%22true%22%2C%22UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN%22%3A%225.0%22%2C%22UVICORN_GRACEFUL_SHUTDOWN%22%3A%22true%22%7D%2C%22disabled%22%3Afalse%2C%22autoApprove%22%3A%5B%5D%7D) |
92
92
 
93
93
  ### From PyPI
94
94
 
@@ -124,7 +124,7 @@ pip install -e .
124
124
 
125
125
  ### Using MCP Configuration
126
126
 
127
- Here are some ways you can work with MCP across AWS (e.g. for Amazon Q Developer CLI MCP, `~/.aws/amazonq/mcp.json`):
127
+ Example configuration for Kiro (`~/.kiro/settings/mcp.json`):
128
128
 
129
129
  ```json
130
130
  {
@@ -397,17 +397,18 @@ The server includes built-in monitoring capabilities:
397
397
  - Prometheus metrics (disabled by default)
398
398
  - Detailed logging of API calls and tool usage
399
399
  - Performance tracking for API operations
400
- ## Testing with Amazon Q
401
400
 
402
- To test the OpenAPI MCP Server with Amazon Q, you need to configure Amazon Q to use your MCP server. Here's how:
401
+ ## Testing with Kiro
403
402
 
404
- 1. **Configure Amazon Q MCP Integration**
403
+ To test the OpenAPI MCP Server with Kiro, you need to configure Kiro to use your MCP server. Here's how:
404
+
405
+ 1. **Configure Kiro MCP Integration**
405
406
 
406
407
  Create or edit the MCP configuration file:
407
408
 
408
409
  ```bash
409
- mkdir -p ~/.aws/amazonq
410
- nano ~/.aws/amazonq/mcp.json
410
+ mkdir -p ~/.kiro/settings
411
+ nano ~/.kiro/settings/mcp.json
411
412
  ```
412
413
 
413
414
  Add the following configuration:
@@ -437,20 +438,20 @@ To test the OpenAPI MCP Server with Amazon Q, you need to configure Amazon Q to
437
438
  }
438
439
  ```
439
440
 
440
- 2. **Start Amazon Q CLI**
441
+ 2. **Start Kiro CLI**
441
442
 
442
- Launch the Amazon Q CLI:
443
+ Launch the Kiro CLI:
443
444
 
444
445
  ```bash
445
- q chat
446
+ kiro-cli chat
446
447
  ```
447
448
 
448
449
  3. **Test the Operation Prompts**
449
450
 
450
- Once connected, you can test the operation prompts by asking Amazon Q to help you with specific API operations:
451
+ Once connected, you can test the operation prompts by asking Kiro to help you with specific API operations:
451
452
 
452
453
  ```
453
454
  I need to find a pet by ID using the Petstore API
454
455
  ```
455
456
 
456
- Amazon Q should respond with guidance using the natural language prompt.
457
+ Kiro should respond with guidance using the natural language prompt.
@@ -1,6 +1,6 @@
1
1
  awslabs/__init__.py,sha256=S-EDeDHGZzllMFhAeuJx_47fv85t2OUMOcsOisD5d_8,796
2
- awslabs/openapi_mcp_server/__init__.py,sha256=EX5-tNKoO1hVlzqTyQtbOhX-uoK619xWZLezKf3hhHk,2060
3
- awslabs/openapi_mcp_server/server.py,sha256=NVe2uoqEsP2N30gIo6WihLaWyTMFvcgq8_LA0LFCUhY,21633
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.9.dist-info/METADATA,sha256=m0Sx6e1LehG1h44_zcpQimJKXE17xATKdXyLsqMvQUo,19390
34
- awslabs_openapi_mcp_server-0.2.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
35
- awslabs_openapi_mcp_server-0.2.9.dist-info/entry_points.txt,sha256=0BwvRNOdGm62ExFDks-9tSTWgtOdI3qmg-aemCMXQkM,86
36
- awslabs_openapi_mcp_server-0.2.9.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
37
- awslabs_openapi_mcp_server-0.2.9.dist-info/licenses/NOTICE,sha256=fG29aqEG3L4KHNXheKdyD5TdsgFh7eaaFlXu-okbf5o,94
38
- awslabs_openapi_mcp_server-0.2.9.dist-info/RECORD,,
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,,