Antonio-RiveroMartnez commented on code in PR #37216:
URL: https://github.com/apache/superset/pull/37216#discussion_r2707676451


##########
superset/mcp_service/server.py:
##########
@@ -55,21 +65,79 @@ def configure_logging(debug: bool = False) -> None:
         logging.info("🔍 SQL Debug logging enabled")
 
 
+def create_event_store(config: dict[str, Any] | None = None) -> Any | None:
+    """
+    Create an EventStore for MCP session management.
+
+    For multi-pod deployments, uses Redis-backed storage to share session state
+    across pods. For single-pod deployments, returns None (uses in-memory).
+
+    Args:
+        config: Optional config dict. If None, reads from MCP_STORE_CONFIG.
+
+    Returns:
+        EventStore instance if Redis URL is configured, None otherwise.
+    """
+    if config is None:
+        config = MCP_STORE_CONFIG
+
+    redis_url = config.get("CACHE_REDIS_URL")
+    if not redis_url:
+        logging.info("EventStore: Using in-memory storage (single-pod mode)")
+        return None
+
+    try:
+        from fastmcp.server.event_store import EventStore
+
+        # Reuse _create_redis_store with wrap=False for raw RedisStore
+        redis_store = _create_redis_store(config, wrap=False)

Review Comment:
   As for encryption, since the wrapper class is given via config, I'm in favor 
of letting people implement their overrides that includes encryption and pass 
it down to the app or as you say, use platform specific configs etc.
   
   About the `wrap=false`, we should still be able to wrap values in this event 
store, because  `PrefixKeysWrapper`, yes, it's only a prefixer of keys, but you 
would still need it so you avoid key collision inside the collections, don't 
we? since `PydanticAdapter` will only create different collections as you 
mention ("type namespacing"). Also if we allow wrapping, we can pass the custom 
class when needed as mentioned before and not only prefix but also encrypt 
without relying on externals configs etc.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to