diff --git a/assemblymcp/config.py b/assemblymcp/config.py index c6aca68..f6e2dee 100644 --- a/assemblymcp/config.py +++ b/assemblymcp/config.py @@ -4,7 +4,7 @@ class Settings(BaseSettings): # Core Settings - assembly_api_key: str | None = Field(None, description="National Assembly API Key") + api_key: str | None = Field(None, description="National Assembly API Key") default_assembly_age: str = Field("22", description="Default Assembly Age (e.g. 22)") # Logging Settings diff --git a/assemblymcp/server.py b/assemblymcp/server.py index 31b27e1..8e77b02 100644 --- a/assemblymcp/server.py +++ b/assemblymcp/server.py @@ -40,7 +40,7 @@ # Initialize API Client globally to load specs once try: - client = AssemblyAPIClient(api_key=settings.assembly_api_key) + client = AssemblyAPIClient(api_key=settings.api_key) except Exception as e: logger.error(f"Failed to initialize client: {e}") client = None @@ -106,7 +106,7 @@ async def get_assembly_info() -> str: return "Error: API Client not initialized. Please check API key configuration." try: - api_key_status = "configured" if settings.assembly_api_key else "not configured" + api_key_status = "configured" if settings.api_key else "not configured" service_count = len(client.service_map) return ( "AssemblyMCP – 대한민국 국회 OpenAPI (Korean National Assembly Open API)\n" @@ -704,7 +704,7 @@ def main(): """Run the MCP server""" sys.stdout.reconfigure(line_buffering=True) # Validate settings on startup (but don't fail if API key is missing yet) - if not settings.assembly_api_key: + if not settings.api_key: logger.warning("ASSEMBLY_API_KEY is not configured. The server will run but tools will fail.") # Check for transport configuration diff --git a/assemblymcp/services.py b/assemblymcp/services.py index e78bd90..238d8b2 100644 --- a/assemblymcp/services.py +++ b/assemblymcp/services.py @@ -68,6 +68,10 @@ def _collect_rows(raw_data: Any) -> list[dict[str, Any]]: rows: list[dict[str, Any]] = [] def _walk(node: Any) -> None: + # Pydantic model → convert to dict and treat as a row + if hasattr(node, "model_dump"): + rows.append(node.model_dump()) + return if isinstance(node, dict): if "row" in node and isinstance(node["row"], list): for entry in node["row"]: