mistercrunch commented on code in PR #33976: URL: https://github.com/apache/superset/pull/33976#discussion_r2175632006
########## superset/mcp_service/fastmcp_server.py: ########## @@ -0,0 +1,513 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +""" +FastMCP Server for Superset MCP Service + +This module provides a FastMCP server that acts as a bridge between +Claude Desktop and the Superset MCP Service API. +""" + +import json +import logging +import os +import sys +from typing import Any, Dict, List, Optional + +import requests +from fastmcp import FastMCP + +# Configure logging +logger = logging.getLogger(__name__) +logger.setLevel(logging.DEBUG) + +mcp = FastMCP("Superset MCP Server") + +# Configuration +API_BASE_URL = "http://localhost:5008/api/mcp/v1" +API_KEY = os.getenv("MCP_API_KEY", "your-secret-api-key-here") + +# Headers for API authentication +API_HEADERS = { + "Authorization": f"Bearer {API_KEY}", + "Content-Type": "application/json" +} + +logger.info(f"MCP Server initialized with API_BASE_URL: {API_BASE_URL}") + + +def get_shared_app(): + """Get the shared Flask app from server.py""" + try: + from superset.mcp_service.server import get_shared_app + return get_shared_app() + except ImportError: + logger.warning("Could not import get_shared_app from server.py") + return None + + [email protected]() +def list_dashboards( + filters: Optional[List[Dict[str, Any]]] = None, Review Comment: oh here it is :) -- 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]
