feat: add MCP server with resources, tools, auth, and Traefik routing
- Add backend/app/mcp_server.py with FastMCP server (hms-cms) - Resources: design-rules, page-structure, sync-status - Tools: trigger_sync, get_sync_log, set_rentman_token, read_file, write_file, create_page, deploy, git_commit, git_status - Bearer token auth via MCP_AUTH_TOKEN env var - Mount MCP at /mcp with streamable HTTP transport - Integrate session manager in FastAPI lifespan - Add Traefik labels for external /mcp route on hms.media-on.de - Add git, docker.io, curl to backend Dockerfile - Mount repo root + docker socket in backend container - Add mcp>=1.0.0 to requirements.txt
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import type { Plugin } from "nuxt/app";
|
||||
|
||||
/**
|
||||
* Client-side Pinia persistence plugin.
|
||||
* Syncs the cart store to localStorage on every mutation and hydrates on load.
|
||||
*/const STORAGE_KEY = "hms-cart";
|
||||
|
||||
export default defineNuxtPlugin(({ pinia }) => {
|
||||
// Hydrate from localStorage on plugin load
|
||||
if (import.meta.client) {
|
||||
try {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
if (stored) {
|
||||
const parsed = JSON.parse(stored);
|
||||
if (parsed && Array.isArray(parsed.items)) {
|
||||
const cartStore = pinia._s.get("cart");
|
||||
if (cartStore) {
|
||||
cartStore.$patch({ items: parsed.items });
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to hydrate cart from localStorage:", e);
|
||||
}
|
||||
|
||||
// Subscribe to cart store changes and persist
|
||||
const cartStore = pinia._s.get("cart");
|
||||
if (cartStore) {
|
||||
cartStore.$subscribe((_mutation, state) => {
|
||||
try {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEY,
|
||||
JSON.stringify({ items: state.items }),
|
||||
);
|
||||
} catch (e) {
|
||||
console.warn("Failed to persist cart to localStorage:", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}) as Plugin;
|
||||
Reference in New Issue
Block a user