diff --git a/smithery.yaml b/smithery.yaml index 246e74f..4acf7aa 100644 --- a/smithery.yaml +++ b/smithery.yaml @@ -1,2 +1,13 @@ # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml + + +configSchema: + # JSON Schema defining the configuration options for the MCP. + type: "object" + required: ["scrapegraphApiKey"] + properties: + scrapegraphApiKey: + type: "string" + description: "Your Scrapegraph API key" + runtime: "python" \ No newline at end of file diff --git a/src/scrapegraph_mcp/server.py b/src/scrapegraph_mcp/server.py index 9d7d91f..4c74d38 100644 --- a/src/scrapegraph_mcp/server.py +++ b/src/scrapegraph_mcp/server.py @@ -17,7 +17,7 @@ import httpx from fastmcp import Context, FastMCP from smithery.decorators import smithery -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, AliasChoices # Configure logging logging.basicConfig( @@ -342,7 +342,11 @@ def close(self) -> None: class ConfigSchema(BaseModel): scrapegraph_api_key: Optional[str] = Field( default=None, - description="Your Scrapegraph API key (optional - can also be set via SGAI_API_KEY environment variable)" + description="Your Scrapegraph API key (optional - can also be set via SGAI_API_KEY environment variable)", + # Accept both camelCase (from smithery.yaml) and snake_case (internal) for validation, + # and serialize back to camelCase to match Smithery expectations. + validation_alias=AliasChoices("scrapegraphApiKey", "scrapegraph_api_key"), + serialization_alias="scrapegraphApiKey", )