fix: correct FastMCP interface usage and resolve lint issues
- Fix FastMCP server interface to use correct mcp.run() instead of app.run(host, port) - Remove unnecessary host and port parameters, use standard STDIO transport - Fix all ruff lint issues including import sorting and blank lines - Update ruff configuration to new lint configuration format - Fix type annotation issues using Union syntax (int | None) - Ensure uvx pypi-query-mcp-server works correctly - All tests pass and lint checks pass
This commit is contained in:
parent
030b3a2607
commit
576652571c
12 changed files with 38 additions and 51 deletions
|
|
@ -4,7 +4,7 @@
|
|||
class PyPIError(Exception):
|
||||
"""Base exception for PyPI-related errors."""
|
||||
|
||||
def __init__(self, message: str, status_code: int = None):
|
||||
def __init__(self, message: str, status_code: int | None = None):
|
||||
super().__init__(message)
|
||||
self.message = message
|
||||
self.status_code = status_code
|
||||
|
|
@ -22,7 +22,7 @@ class PackageNotFoundError(PyPIError):
|
|||
class NetworkError(PyPIError):
|
||||
"""Raised when network-related errors occur."""
|
||||
|
||||
def __init__(self, message: str, original_error: Exception = None):
|
||||
def __init__(self, message: str, original_error: Exception | None = None):
|
||||
super().__init__(message)
|
||||
self.original_error = original_error
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class NetworkError(PyPIError):
|
|||
class RateLimitError(PyPIError):
|
||||
"""Raised when API rate limit is exceeded."""
|
||||
|
||||
def __init__(self, retry_after: int = None):
|
||||
def __init__(self, retry_after: int | None = None):
|
||||
message = "PyPI API rate limit exceeded"
|
||||
if retry_after:
|
||||
message += f". Retry after {retry_after} seconds"
|
||||
|
|
@ -50,7 +50,7 @@ class InvalidPackageNameError(PyPIError):
|
|||
class PyPIServerError(PyPIError):
|
||||
"""Raised when PyPI server returns a server error."""
|
||||
|
||||
def __init__(self, status_code: int, message: str = None):
|
||||
def __init__(self, status_code: int, message: str | None = None):
|
||||
if not message:
|
||||
message = f"PyPI server error (HTTP {status_code})"
|
||||
super().__init__(message, status_code=status_code)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue