Skip to content

Commit d7db52b

Browse files
authored
Merge pull request #9 from ScrapeGraphAI/fix/config
make api key requried
2 parents 37b2177 + 4579347 commit d7db52b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

smithery.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
2+
3+
4+
configSchema:
5+
# JSON Schema defining the configuration options for the MCP.
6+
type: "object"
7+
required: ["scrapegraphApiKey"]
8+
properties:
9+
scrapegraphApiKey:
10+
type: "string"
11+
description: "Your Scrapegraph API key"
12+
213
runtime: "python"

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)