feat(types): add icon, options, and options_from to Python models
Add icon field to McpManifestServer. Add options and options_from fields to McpManifestConfig. Add McpManifestOptionsFrom dataclass with file and path fields for JSONPath-based dynamic options. Update from_dict parsing to handle new fields
This commit is contained in:
@@ -8,6 +8,15 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class McpManifestOptionsFrom:
|
||||||
|
"""Dynamically resolve available config values from a local file."""
|
||||||
|
file: str = ""
|
||||||
|
"""Path to a local JSON file. ~ is expanded to the user's home directory."""
|
||||||
|
path: str = ""
|
||||||
|
"""JSONPath expression to extract values from the file."""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class McpManifestConfig:
|
class McpManifestConfig:
|
||||||
"""A configuration parameter the server accepts."""
|
"""A configuration parameter the server accepts."""
|
||||||
@@ -20,6 +29,8 @@ class McpManifestConfig:
|
|||||||
env_var: str | None = None
|
env_var: str | None = None
|
||||||
arg: str | None = None
|
arg: str | None = None
|
||||||
prompt: str | None = None
|
prompt: str | None = None
|
||||||
|
options: list[str] = field(default_factory=list)
|
||||||
|
options_from: McpManifestOptionsFrom | None = None
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -46,6 +57,7 @@ class McpManifestServer:
|
|||||||
repository: str | None = None
|
repository: str | None = None
|
||||||
license: str | None = None
|
license: str | None = None
|
||||||
keywords: list[str] = field(default_factory=list)
|
keywords: list[str] = field(default_factory=list)
|
||||||
|
icon: str | None = None
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -98,6 +110,7 @@ class McpManifest:
|
|||||||
repository=server_data.get("repository"),
|
repository=server_data.get("repository"),
|
||||||
license=server_data.get("license"),
|
license=server_data.get("license"),
|
||||||
keywords=server_data.get("keywords", []),
|
keywords=server_data.get("keywords", []),
|
||||||
|
icon=server_data.get("icon"),
|
||||||
)
|
)
|
||||||
|
|
||||||
install = [
|
install = [
|
||||||
@@ -121,6 +134,11 @@ class McpManifest:
|
|||||||
env_var=c.get("env_var"),
|
env_var=c.get("env_var"),
|
||||||
arg=c.get("arg"),
|
arg=c.get("arg"),
|
||||||
prompt=c.get("prompt"),
|
prompt=c.get("prompt"),
|
||||||
|
options=c.get("options", []),
|
||||||
|
options_from=McpManifestOptionsFrom(
|
||||||
|
file=c["options_from"]["file"],
|
||||||
|
path=c["options_from"]["path"],
|
||||||
|
) if c.get("options_from") else None,
|
||||||
)
|
)
|
||||||
for c in data.get("config", [])
|
for c in data.get("config", [])
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user