Phase 1 (Foundation): - Project restructure (presenton-main → backend/ + frontend/) - Database schema (8 new models, Alembic config, seed script) - Auth (Azure AD SSO + dev bypass, JWT sessions, AuthMiddleware) - RBAC (access_service, rbac_middleware, admin routers) - Audit logging (fire-and-forget, AuditMiddleware, admin router) - i18n (react-i18next with 5 namespace files) Phase 2 (Admin Panel & Client Management): - Admin panel shell (sidebar layout, role guard, 12 pages) - Redux admin slice with 18 async thunks - User management (role changes, deactivation) - Client management (CRUD, brand config, team management) - Brand config editor (colors, fonts, logos, voice rules) - Master deck upload & parser (PPTX → HTML → React pipeline) - Audit log viewer with filters and CSV/JSON export Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
68 lines
2 KiB
Python
68 lines
2 KiB
Python
import sys
|
|
import argparse
|
|
import asyncio
|
|
import traceback
|
|
|
|
import httpx
|
|
from fastmcp import FastMCP
|
|
import json
|
|
|
|
with open("openai_spec.json", "r") as f:
|
|
openapi_spec = json.load(f)
|
|
|
|
|
|
async def main():
|
|
try:
|
|
print("DEBUG: MCP (OpenAPI) Server startup initiated")
|
|
parser = argparse.ArgumentParser(
|
|
description="Run the MCP server (from OpenAPI)"
|
|
)
|
|
parser.add_argument(
|
|
"--port", type=int, default=8001, help="Port for the MCP HTTP server"
|
|
)
|
|
|
|
parser.add_argument(
|
|
"--name",
|
|
type=str,
|
|
default="Presenton API (OpenAPI)",
|
|
help="Display name for the generated MCP server",
|
|
)
|
|
args = parser.parse_args()
|
|
print(f"DEBUG: Parsed args - port={args.port}")
|
|
|
|
# Create an HTTP client that the MCP server will use to call the API
|
|
api_client = httpx.AsyncClient(base_url="http://127.0.0.1:8000", timeout=60.0)
|
|
|
|
# Build MCP server from OpenAPI
|
|
print("DEBUG: Creating FastMCP server from OpenAPI spec...")
|
|
mcp = FastMCP.from_openapi(
|
|
openapi_spec=openapi_spec,
|
|
client=api_client,
|
|
name=args.name,
|
|
)
|
|
print("DEBUG: MCP server created from OpenAPI successfully")
|
|
|
|
# Start the MCP server
|
|
uvicorn_config = {"reload": True}
|
|
print(f"DEBUG: Starting MCP server on host=127.0.0.1, port={args.port}")
|
|
await mcp.run_async(
|
|
transport="http",
|
|
host="127.0.0.1",
|
|
port=args.port,
|
|
uvicorn_config=uvicorn_config,
|
|
)
|
|
print("DEBUG: MCP server run_async completed")
|
|
except Exception as e:
|
|
print(f"ERROR: MCP server startup failed: {e}")
|
|
print(f"ERROR: Traceback: {traceback.format_exc()}")
|
|
raise
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("DEBUG: Starting MCP (OpenAPI) main function")
|
|
try:
|
|
asyncio.run(main())
|
|
except Exception as e:
|
|
print(f"FATAL ERROR: {e}")
|
|
print(f"FATAL TRACEBACK: {traceback.format_exc()}")
|
|
sys.exit(1)
|