forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(mcp): experimental - Add MCP blueprint to superset /api/v1/mcp #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
aminghadersohi
wants to merge
11
commits into
feat/mcp_service_pr1_scaffold
Choose a base branch
from
feat/mcp_service_pr2_integration
base: feat/mcp_service_pr1_scaffold
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat(mcp): experimental - Add MCP blueprint to superset /api/v1/mcp #6
aminghadersohi
wants to merge
11
commits into
feat/mcp_service_pr1_scaffold
from
feat/mcp_service_pr2_integration
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 tasks
42af216
to
2221f8b
Compare
cd668b9
to
d6b0c9a
Compare
…perset This commit introduces the basic scaffold for the MCP service that enables AI agents to interact with Apache Superset programmatically. ## Key Components ### Core Structure - **CLI Interface**: `superset mcp run` and `superset mcp setup` commands - **FastMCP Server**: HTTP-based MCP server using FastMCP protocol - **Flask Integration**: Singleton pattern for Superset app integration - **Configuration Setup**: Automated setup script for MCP service config ### Files Added - `superset/cli/mcp.py`: CLI commands for running and setting up MCP service - `superset/mcp_service/`: Core MCP service package with server, app, and config - `superset/mcp_service/scripts/setup.py`: Configuration setup utilities - `superset/config_mcp.py`: MCP-specific configuration template - Development container configurations for MCP-enabled development ### Features - Basic HTTP transport for MCP communication - Configuration management for Superset integration - Development environment setup with Docker support - Node.js proxy support for alternative connection methods This scaffold provides the foundation for subsequent PRs that will add: - Authentication and authorization - Tool implementations (dashboards, charts, datasets) - Advanced middleware and permissions - Production-ready features The implementation follows Superset's architectural patterns and can be extended incrementally without breaking changes.
2221f8b
to
ed73757
Compare
- Add mcp_config.py with centralized MCP configuration - Refactor setup.py to use import-based config instead of hardcoded strings - Update README with manual setup instructions following standard Superset patterns - Replace hidden MCP_DEBUG env var with proper app.config setting - Remove opinionated warnings filter to let logger.ini handle warnings - Make configuration more maintainable and discoverable
Add Flask-style application factory for FastMCP instances with support for: - Custom authentication providers via auth parameter - Middleware and lifespan handlers - Tag-based tool filtering (include_tags/exclude_tags) - Additional configuration options - Backward compatibility with existing mcp instance Examples provided in superset/mcp_service/examples/ showing usage patterns for secure, filtered, and custom configurations.
Fix invalid import from non-existent superset.mcp_service.config module to use get_mcp_config() from superset.mcp_service.mcp_config instead.
Add health_check tool in system/tool/ that returns: - Service status and timestamp - System information (Python version, platform) - Basic uptime information Tool is automatically registered via import in __init__.py for easy connectivity testing of the MCP service.
- Replace complex threading singleton with simple module-level pattern - Clean up server.py imports and formatting - Update README.md with better configuration examples
Remove mcp_service/scripts/ directory and superset mcp setup command to simplify the MCP service implementation.
- Only configure basic logging if no handlers exist (respects logging.ini) - Only override SQLAlchemy logger levels if they're at default levels - Prevents interference with production logging configuration
Remove time.sleep(0.1) from signal handler in simple_proxy.py as it's not a maintainable solution for cleanup. FastMCP proxy should handle its own cleanup when process exits.
- Add MCP HTTP proxy for server communication - Add MCP client proxy for stdio-based servers - Include FastMCP dependency for Python MCP support - Add proxy scripts and test utilities - Register MCP blueprints with feature flag MCP_SERVICE
d6b0c9a
to
4fcf371
Compare
be6d3b1
to
6bb4feb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This PR adds an endpoint/blueprint to Apache Superset
/api/v1/mcp-client|proxy
, enabling integration with AI tools and external services through a superset hosted endpoint that should hopefully mean it also takes care of multi tennancy.PR #1: apache#35163
The implementation includes:
/api/v1/mcp-proxy/
reverse proxies to mcp service via http (localhost 5008)/api/v1/mcp-client/
reverse proxies to mcp service by using the FastMCP provided Client class - used in tests.MCP_SERVICE
feature flagThis enhancement enables multi-tenancy to be achieved automatically via superset (Theoretically)
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - Backend service addition
TESTING INSTRUCTIONS
Enable the MCP_SERVICE feature flag in your config:
Install the FastMCP dependency:
pip install fastmcp>=2.8.1
Test the MCP HTTP proxy:
Test the MCP client proxy:
Run all MCP tests:
Verify endpoints are registered:
/mcp/sse
/mcp-client/<server_name>/<method>
ADDITIONAL INFORMATION
MCP_SERVICE
Technical Details:
Security Considerations:
Performance Impact: