GitHub user manimovassagh added a comment to the discussion: Starting mcp
server in 6.1.0rc1 in docker
The Dosu answer above is partially outdated. In 6.1.0rc1, the MCP server setup
changed. Here's what actually works:
The error `No application found. Either work inside a view function or push an
application context` means the Flask app context isn't being initialized before
the MCP server tries to access SQLAlchemy/database resources.
You need to make sure the app context is pushed before the MCP service starts.
Try this approach:
**Option 1: Use the CLI command with proper environment**
```yaml
superset_mcp:
env_file:
- path: docker/.env
required: true
- path: docker/.env-local
required: false
image: *superset-image
container_name: superset_mcp_app
command: ["python", "-c", "from superset.app import create_app; app =
create_app(); app.app_context().push(); from superset.mcp.server import
run_mcp; run_mcp(port=5008)"]
user: "root"
restart: unless-stopped
ports:
- 5008:5008
depends_on:
superset-init:
condition: service_completed_successfully
volumes:
- ./docker:/app/docker
- ./superset-core:/app/superset-core
- superset_home:/app/superset_home
```
**Option 2: Create a small wrapper script**
Create `docker/docker-mcp.sh`:
```bash
#!/bin/bash
set -e
# Source the common environment
. /app/docker/docker-bootstrap.sh app
# Run MCP server with Flask app context
python -c "
from superset.app import create_app
app = create_app()
with app.app_context():
from superset.mcp.server import run_mcp
run_mcp(host='0.0.0.0', port=5008)
"
```
Then set `command: ["/bin/bash", "/app/docker/docker-mcp.sh"]`
The key insight is that unlike the main Superset app (where gunicorn/Flask
handles the context lifecycle), the MCP server runs as a standalone process and
needs explicit context setup. Make sure `ENABLE_MCP_SERVICE = True` is set in
your `superset_config.py` as well.
Also double-check that your `.env` file includes all the database connection
variables (`SUPERSET_SECRET_KEY`, `SQLALCHEMY_DATABASE_URI`, etc.) -- the MCP
container needs the same config as the main app.
GitHub link:
https://github.com/apache/superset/discussions/38703#discussioncomment-16233635
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]