Skip to content

Commit 222e104

Browse files
committed
remove unused imports and clean up module docstrings
1 parent e10a4a1 commit 222e104

File tree

5 files changed

+6
-34
lines changed

5 files changed

+6
-34
lines changed

fastapi_mcp/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313
__version__ = "0.0.0.dev0"
1414

1515
from .server import add_mcp_server, create_mcp_server, mount_mcp_server
16-
from .openapi.convert import convert_openapi_to_mcp_tools
17-
from .execute import execute_api_tool
1816

1917

2018
__all__ = [
2119
"add_mcp_server",
2220
"create_mcp_server",
2321
"mount_mcp_server",
24-
"convert_openapi_to_mcp_tools",
25-
"execute_api_tool",
2622
]

fastapi_mcp/execute.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
"""
2-
Direct OpenAPI to MCP Tools Conversion Module.
3-
4-
This module provides functionality for directly converting OpenAPI schema to MCP tool specifications
5-
and for executing HTTP tools.
6-
"""
7-
81
import json
92
import logging
103
from typing import Any, Dict, List, Union
@@ -14,7 +7,7 @@
147
import mcp.types as types
158

169

17-
logger = logging.getLogger("fastapi_mcp")
10+
logger = logging.getLogger(__name__)
1811

1912

2013
async def execute_api_tool(

fastapi_mcp/openapi/convert.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
"""
2-
Direct OpenAPI to MCP Tools Conversion Module.
3-
4-
This module provides functionality for directly converting OpenAPI schema to MCP tool specifications
5-
and for executing HTTP tools.
6-
"""
7-
81
import json
92
import logging
103
from typing import Any, Dict, List, Tuple
@@ -18,7 +11,7 @@
1811
get_single_param_type_from_schema,
1912
)
2013

21-
logger = logging.getLogger("fastapi_mcp")
14+
logger = logging.getLogger(__name__)
2215

2316

2417
def convert_openapi_to_mcp_tools(
@@ -50,11 +43,13 @@ def convert_openapi_to_mcp_tools(
5043
for method, operation in path_item.items():
5144
# Skip non-HTTP methods
5245
if method not in ["get", "post", "put", "delete", "patch"]:
46+
logger.warning(f"Skipping non-HTTP method: {method}")
5347
continue
5448

5549
# Get operation metadata
5650
operation_id = operation.get("operationId")
5751
if not operation_id:
52+
logger.warning(f"Skipping operation with no operationId: {operation}")
5853
continue
5954

6055
# Save operation details for later HTTP calls
@@ -78,8 +73,8 @@ def convert_openapi_to_mcp_tools(
7873
if responses:
7974
response_info = "\n\n### Responses:\n"
8075

81-
# Find the success response (usually 200 or 201)
82-
success_codes = ["200", "201", "202", 200, 201, 202]
76+
# Find the success response
77+
success_codes = range(200, 300)
8378
success_response = None
8479
for status_code in success_codes:
8580
if str(status_code) in responses:

fastapi_mcp/openapi/utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""
2-
OpenAPI utility functions for FastAPI-MCP.
3-
4-
This module provides utility functions for working with OpenAPI schemas.
5-
"""
6-
71
from typing import Any, Dict, List, Optional
82

93

fastapi_mcp/server.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""
2-
Server module for FastAPI-MCP.
3-
4-
This module provides functionality for creating and mounting MCP servers to FastAPI applications.
5-
"""
6-
71
from contextlib import asynccontextmanager
82
from typing import Dict, Optional, Any, Tuple, List, Union, AsyncIterator
93

0 commit comments

Comments
 (0)