CrewAI + Ollama + local MCP server + Streamlit. Built to spec: 3 agents,
15 local function tools, a 10-tool analytics_mcp_server, and a chat UI with
an activity timeline.
# 1. Ollama (local LLM)
ollama pull llama3.1 # default model - change in app_config.py if needed
ollama serve
# 2. Python deps
pip install -r requirements.txt
# 3. Run
streamlit run streamlit_app.pyOpen the printed local URL, pick a dataset from data/sample_datasets/, and
ask something like:
Analyze the sales_transactions.csv file. Profile the dataset, find data quality issues, suggest KPIs and a dashboard, recommend ML use cases, and suggest feature engineering ideas.
| Path | What |
|---|---|
streamlit_app.py |
Chat UI, activity timeline, sidebar (spec section 11) |
crew_orchestrator.py |
Builds the crew, connects the MCP adapter, runs tasks |
app_config.py |
Ollama model / context window / safety config (edit here) |
config/agents.yaml, config/tasks.yaml |
Agent & task definitions |
agents/ |
Supervisor, Data Analyst, Data Scientist agent builders |
function_tools/ |
15 local tools, 5 per agent |
mcp_server/ |
analytics_mcp_server — 10 MCP tools over stdio (FastMCP) |
core/data_profiling_core.py |
Shared profiling/data-quality logic (used by both tool layers) |
data/sample_datasets/ |
3 generated sample datasets with intentional data-quality issues |
tests/ |
pytest suite for core logic, function tools, MCP tools, agent construction |
docs/ |
architecture diagram, MCP tool catalog, demo script |
- Supervisor Agent — classifies requests, delegates, validates the final response structure, tracks context usage.
- Data Analyst Agent — profiles data, suggests KPIs/dashboards, validates SQL, explains trends.
- Data Scientist Agent — recommends ML problem types/use cases, feature engineering, evaluation metrics, and pipeline plans.
- Supervisor (5):
classify_user_request,create_agent_work_plan,summarize_chat_history,validate_final_response_structure,estimate_context_usage - Data Analyst (5):
profile_dataframe,suggest_kpi_metrics,generate_dashboard_layout,validate_sql_safety,explain_query_result - Data Scientist (5):
recommend_ml_problem_type,suggest_feature_engineering,detect_ml_data_risks,recommend_evaluation_metrics,create_ml_pipeline_plan
See docs/mcp_tool_catalog.md for the full table. Names:
mcp_profile_csv, mcp_run_duckdb_query, mcp_validate_sql,
mcp_detect_data_quality_issues, mcp_generate_kpi_catalog,
mcp_recommend_ml_use_cases, mcp_feature_engineering_suggestions,
mcp_anomaly_detection_summary, mcp_create_data_dictionary,
mcp_generate_report_markdown.
Run the MCP server on its own:
python run_mcp_server.py- SQL tools allow only
SELECT; blockDELETE/UPDATE/DROP/ALTER/INSERT/ MERGE/TRUNCATE/CREATE. - All file access is restricted to
data/sample_datasets/(path traversal blocked, file-size limited, extension allow-list enforced). - No shell commands are ever executed from user input.
- Raw stack traces are shown only inside an expandable "Debug details" section in the UI, never directly to the user.
pytestCovers: core profiling/data-quality logic, all 15 function tools, all 10 MCP tools (called directly, bypassing the protocol layer), and agent construction (tools attach correctly without needing a live LLM call).
Edit app_config.py:
OLLAMA_MODEL = "llama3.1" # change to any model you've pulledor set the OLLAMA_MODEL environment variable before launching.