Skip to content

Commit 4579347

Browse files
refactor: Enhance ConfigSchema to support aliasing for Scrapegraph API key
1 parent 94527c0 commit 4579347

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/scrapegraph_mcp/server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import httpx
1818
from fastmcp import Context, FastMCP
1919
from smithery.decorators import smithery
20-
from pydantic import BaseModel, Field
20+
from pydantic import BaseModel, Field, AliasChoices
2121

2222
# Configure logging
2323
logging.basicConfig(
@@ -342,7 +342,11 @@ def close(self) -> None:
342342
class ConfigSchema(BaseModel):
343343
scrapegraph_api_key: Optional[str] = Field(
344344
default=None,
345-
description="Your Scrapegraph API key (optional - can also be set via SGAI_API_KEY environment variable)"
345+
description="Your Scrapegraph API key (optional - can also be set via SGAI_API_KEY environment variable)",
346+
# Accept both camelCase (from smithery.yaml) and snake_case (internal) for validation,
347+
# and serialize back to camelCase to match Smithery expectations.
348+
validation_alias=AliasChoices("scrapegraphApiKey", "scrapegraph_api_key"),
349+
serialization_alias="scrapegraphApiKey",
346350
)
347351

348352

0 commit comments

Comments
 (0)