This commit is contained in:
John Lancaster
2026-07-26 14:09:08 -05:00
parent 007d823c0a
commit 5e20f69cfe
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -1,5 +1,7 @@
from functools import cache
from importlib.resources import files
from pathlib import Path
from typing import Literal
from pydantic import BaseModel
from pydantic import DirectoryPath
@@ -11,9 +13,17 @@ DEFAULT_ENV_FILE = Path(".env").resolve()
_REPO_ROOT = Path(__file__).resolve().parents[2]
@cache
def _package_docs_dir() -> Path:
docs_dir = files("personal_mcp").joinpath("docs")
if not isinstance(docs_dir, Path):
raise TypeError("personal_mcp docs must be installed as a filesystem directory")
return docs_dir
class Mounts(BaseModel):
docs: str = "/docs"
docs_dir: DirectoryPath = Field(default=_REPO_ROOT / "docs")
docs_dir: DirectoryPath = Field(default_factory=_package_docs_dir)
mcp: str = "/mcp"
@@ -29,6 +39,7 @@ class Settings(BaseSettings):
debug: bool = False
log_level: str = "info"
mounts: Mounts = Field(default_factory=Mounts)
mcp_transport: Literal["http", "sse"] = "http"
site_dir: DirectoryPath = Field(default=_REPO_ROOT / "site")
+1 -1
View File
@@ -13,7 +13,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
path=runtime_settings.mounts.mcp,
json_response=True,
stateless_http=True,
transport="http",
transport=runtime_settings.mcp_transport,
)
app = FastAPI(
debug=runtime_settings.debug,