8000 docs(examples): mcp generated notebooks by jamesbhobbs · Pull Request #256 · deepnote/deepnote · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@jamesbhobbs
Copy link
Contributor
@jamesbhobbs jamesbhobbs commented Jan 28, 2026

Summary by CodeRabbit

  • Documentation

    • Added a comprehensive README for MCP example notebooks with setup, usage commands, workflows, and "Learn More" references.
  • New Features

    • Added example notebooks demonstrating A/B testing, API analytics, churn prediction, ETL pipelines, financial analytics, and a SaaS metrics dashboard.
    • Improved example notebooks with explicit initial values for interactive input widgets (pre-filled defaults and presets).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor
coderabbitai bot commented Jan 28, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request adds a README for MCP example notebooks and six Deepnote notebook templates (A/B test evaluator, API analytics client, churn prediction, ETL pipeline, financial analytics, SaaS metrics dashboard). Each notebook contains structured sections, placeholder code, visualizations, and interactive inputs. Additionally, input widgets in the MCP tooling were augmented with explicit `deepnote_variable_value` defaults across scaffold/template/enhance constructs.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title directly reflects the main change: adding MCP-generated example notebooks to the documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.37%. Comparing base (ee7c4f5) to head (466bdfa).
⚠️ Report is 1 commits behind head on mcp-skills.

Additional details and impacted files
@@             Coverage Diff             @@
##           mcp-skills     #256   +/-   ##
===========================================
  Coverage       72.37%   72.37%           
===========================================
  Files              93       93           
  Lines            6393     6393           
  Branches         1838     1783   -55     
===========================================
  Hits             4627     4627           
  Misses           1766     1766           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jamesbhobbs jamesbhobbs marked this pull request as ready for review January 28, 2026 15:54
@jamesbhobbs jamesbhobbs requested a review from a team as a code owner January 28, 2026 15:54
@jamesbhobbs jamesbhobbs merged commit f3e024e into mcp-skills Jan 28, 2026
@jamesbhobbs jamesbhobbs deleted the mcp-gen-examples branch January 28, 2026 15:55
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Fix all issues with AI agents
In `@examples/mcp-demos/ab_test_evaluator.deepnote`:
- Around line 54-59: The cell assumes the DataFrame variable df exists; add a
guard that checks whether df is defined and not None before accessing its
attributes (e.g., using "if 'df' in locals() or 'df' in globals()" or a
try/except NameError) and, if not present, print a short message like "DataFrame
df not loaded — please run the data loading cell" so the cell doesn't raise a
NameError; update the block containing the print(df.shape), print(df.dtypes),
and print(df.isnull().sum()) to perform this presence check first.
- Around line 15-19: The markdown description (id:
7f0d0401-2bcd-4207-b0e2-db32e29a557b, type: markdown) is missing a verb; update
the sentence "This notebook A/B test statistical analysis tool that takes
experiment data..." to a grammatically correct form such as "This notebook is an
A/B test statistical analysis tool that takes experiment data..." (or "This
notebook provides an A/B test statistical analysis tool..."), ensuring the rest
of the description remains unchanged.

In `@examples/mcp-demos/api_analytics_client.deepnote`:
- Around line 42-51: The notebook currently stores the API key in an input-text
block (deepnote_variable_name: api_key / deepnote_input_label: API Key) which is
not masked; remove this input block and instead configure the API key as an
encrypted Environment Variable via Integrations → Environment variables, then
update any code that references the variable to read it from the environment
(e.g., use os.environ["MY_API_KEY"] or the equivalent in your runtime) and
ensure all references to "api_key" are replaced with the environment lookup.

In `@examples/mcp-demos/churn_prediction.deepnote`:
- Around line 21-22: The markdown sentence describing the notebook is missing a
verb and reads awkwardly; update the content string (the markdown block with
"This notebook Customer churn prediction model...") to include a verb and
improve clarity — e.g., "This notebook implements a customer churn prediction
model that loads customer data, performs feature engineering on usage metrics,
subscription history, and engagement data, trains a classification model with
hyperparameter tuning, evaluates model performance with a confusion matrix and
ROC curve, and outputs churn probability scores." Replace the existing content
text accordingly.
- Around line 124-136: The snippet uses the symbol plt when plotting but never
imports matplotlib; add an import for matplotlib.pyplot (e.g., import
matplotlib.pyplot as plt) before any use of plt (place it alongside the other
imports at the top of the cell/script where y_pred = model.predict(...) and
confusion_matrix are used) so that plt is defined when calling plt.figure and
subsequent plotting calls.

In `@examples/mcp-demos/etl_data_pipeline.deepnote`:
- Around line 192-199: The current validate_output block only logs validation
issues returned by validate_data(df_transformed) but does not prevent the
subsequent Load step from writing invalid data; change the flow so that when
validate_output is True and validate_data(...) returns any issues you either
raise a ValidationError (or RuntimeError) with the issue details or set/return a
flag to abort the Load step, ensuring the code that performs the load (the
downstream write/load routine) checks this flag or catches the exception and
stops writing; update validate_data usage and callers so failures short-circuit
the pipeline (e.g., replace the print-only branch with a raise or return False
that the load function respects).

In `@examples/mcp-demos/README.md`:
- Line 11: The CI spellcheck flags the brand name "Slido" in the table row for
"SaaS Metrics Dashboard"; fix by adding a cspell ignore or dictionary entry for
"Slido" (e.g., add "Slido" to the repo-level cspell.json words array or add a
.cspell-ignore file entry) so the token is treated as valid by the spellchecker
and the README.md table row no longer fails CI.

Comment on lines 15 to 19
- id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b
blockGroup: 44a6df36-00e2-4eac-9d06-0d86f7c31b51
sortingKey: "000001"
type: markdown
content: This notebook A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix the description grammar.
The sentence is missing a verb.

✏️ Proposed fix
-          content: This notebook A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.
+          content: This notebook is an A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b
blockGroup: 44a6df36-00e2-4eac-9d06-0d86f7c31b51
sortingKey: "000001"
type: markdown
content: This notebook A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.
- id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b
blockGroup: 44a6df36-00e2-4eac-9d06-0d86f7c31b51
sortingKey: "000001"
type: markdown
content: This notebook is an A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.
🤖 Prompt for AI Agents
In `@examples/mcp-demos/ab_test_evaluator.deepnote` around lines 15 - 19, The
markdown description (id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b, type: markdown)
is missing a verb; update the sentence "This notebook A/B test statistical
analysis tool that takes experiment data..." to a grammatically correct form
such as "This notebook is an A/B test statistical analysis tool that takes
experiment data..." (or "This notebook provides an A/B test statistical analysis
tool..."), ensuring the rest of the description remains unchanged.

Comment on lines +54 to +59
# Basic info about the dataset
print("Shape:", df.shape)
print("\nColumn types:")
print(df.dtypes)
print("\nMissing values:")
print(df.isnull().sum())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Add a guard for df to avoid a NameError in the example.
This cell will fail if users run it before loading data.

🛡️ Suggested tweak
             # Basic info about the dataset
+            if "df" not in globals():
+                raise ValueError("Load data into `df` before running this cell.")
             print("Shape:", df.shape)
             print("\nColumn types:")
             print(df.dtypes)
             print("\nMissing values:")
             print(df.isnull().sum())
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Basic info about the dataset
print("Shape:", df.shape)
print("\nColumn types:")
print(df.dtypes)
print("\nMissing values:")
print(df.isnull().sum())
# Basic info about the dataset
if "df" not in globals():
raise ValueError("Load data into `df` before running this cell.")
print("Shape:", df.shape)
print("\nColumn types:")
print(df.dtypes)
print("\nMissing values:")
print(df.isnull().sum())
🤖 Prompt for AI Agents
In `@examples/mcp-demos/ab_test_evaluator.deepnote` around lines 54 - 59, The cell
assumes the DataFrame variable df exists; add a guard that checks whether df is
defined and not None before accessing its attributes (e.g., using "if 'df' in
locals() or 'df' in globals()" or a try/except NameError) and, if not present,
print a short message like "DataFrame df not loaded — please run the data
loading cell" so the cell doesn't raise a NameError; update the block containing
the print(df.shape), print(df.dtypes), and print(df.isnull().sum()) to perform
this presence check first.

Comment on lines 42 to 51
blockGroup: a3392ca2-fd4a-4f2b-b451-cac1820517f8
sortingKey: "000004"
type: input-text
content: ""
metadata:
deepnote_variable_name: api_key
deepnote_input_label: API Key
deepnote_input_default: ""
executionCount: null
outputs: []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Deepnote input block types masked password secret API key

💡 Result:

Deepnote Input blocks don’t include a “masked password / secret / API key” type. The built-in input types are things like Text, Select (single/multi), Date / Date range, File, Checkbox, Slider, plus a Button block—so anything entered in a text-style input is not meant to be treated as a hidden secret. (deepnote.com)

For passwords / secrets / API keys, the recommended approach in Deepnote is to store them as encrypted Environment Variables via Integrations → Environment variables, then read them in code (e.g., os.environ["MY_API_KEY"]). (deepnote.com)

Citations:


Use encrypted Environment Variables for API keys instead of input blocks.

Deepnote doesn't support masked/secret input types. Store the API key as an encrypted Environment Variable via Integrations → Environment variables, then access it in code (e.g., os.environ["MY_API_KEY"]). This avoids exposing secrets in shared notebooks.

🤖 Prompt for AI Agents
In `@examples/mcp-demos/api_analytics_client.deepnote` around lines 42 - 51, The
notebook currently stores the API key in an input-text block
(deepnote_variable_name: api_key / deepnote_input_label: API Key) which is not
masked; remove this input block and instead configure the API key as an
encrypted Environment Variable via Integrations → Environment variables, then
update any code that references the variable to read it from the environment
(e.g., use os.environ["MY_API_KEY"] or the equivalent in your runtime) and
ensure all references to "api_key" are replaced with the environment lookup.

Comment on lines +21 to +22
type: markdown
content: This notebook Customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix description sentence.

Line 22 is missing a verb and reads awkwardly.

🛠️ Suggested fix
-          content: This notebook Customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.
+          content: This notebook is a customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: markdown
content: This notebook Customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.
type: markdown
content: This notebook is a customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.
🤖 Prompt for AI Agents
In `@examples/mcp-demos/churn_prediction.deepnote` around lines 21 - 22, The
markdown sentence describing the notebook is missing a verb and reads awkwardly;
update the content string (the markdown block with "This notebook Customer churn
prediction model...") to include a verb and improve clarity — e.g., "This
notebook implements a customer churn prediction model that loads customer data,
performs feature engineering on usage metrics, subscription history, and
engagement data, trains a classification model with hyperparameter tuning,
evaluates model performance with a confusion matrix and ROC curve, and outputs
churn probability scores." Replace the existing content text accordingly.

Comment on lines +124 to +136
content: |-
from sklearn.metrics import classification_report, confusion_matrix
E880 import seaborn as sns

# Predictions
y_pred = model.predict(X_test)

# Classification report
print(classification_report(y_test, y_pred))

# Confusion matrix
plt.figure(figsize=(8, 6))
cm = confusion_matrix(y_test, y_pred)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "churn_prediction.deepnote" -type f

Repository: deepnote/deepnote

Length of output: 107


🏁 Script executed:

cat -n ./examples/mcp-demos/churn_prediction.deepnote | head -150

Repository: deepnote/deepnote

Length of output: 6858


🏁 Script executed:

cat -n ./examples/mcp-demos/churn_prediction.deepnote | sed -n '1,130p' | grep -i "matplotlib\|import plt"

Repository: deepnote/deepnote

Length of output: 43


Add matplotlib import before using plt.

Lines 136+ use plt without importing it, which will raise a NameError.

🛠️ Suggested fix
 from sklearn.metrics import classification_report, confusion_matrix
 import seaborn as sns
+import matplotlib.pyplot as plt
🤖 Prompt for AI Agents
In `@examples/mcp-demos/churn_prediction.deepnote` around lines 124 - 136, The
snippet uses the symbol plt when plotting but never imports matplotlib; add an
import for matplotlib.pyplot (e.g., import matplotlib.pyplot as plt) before any
use of plt (place it alongside the other imports at the top of the cell/script
where y_pred = model.predict(...) and confusion_matrix are used) so that plt is
defined when calling plt.figure and subsequent plotting calls.

Comment on lines +192 to +199
if validate_output:
issues = validate_data(df_transformed)
if issues:
print("✗ Validation issues found:")
for issue in issues:
print(f" - {issue}")
else:
print("✓ Validation passed")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Validation doesn’t stop loading invalid data.

Lines 192-199 only log issues; the Load step still writes output. Consider raising or gating with a flag to prevent bad data from landing.

🛠️ Suggested fix
 if validate_output:
     issues = validate_data(df_transformed)
     if issues:
         print("✗ Validation issues found:")
         for issue in issues:
             print(f"  - {issue}")
+        raise ValueError("Validation failed; aborting load.")
     else:
         print("✓ Validation passed")
🤖 Prompt for AI Agents
In `@examples/mcp-demos/etl_data_pipeline.deepnote` around lines 192 - 199, The
current validate_output block only logs validation issues returned by
validate_data(df_transformed) but does not prevent the subsequent Load step from
writing invalid data; change the flow so that when validate_output is True and
validate_data(...) returns any issues you either raise a ValidationError (or
RuntimeError) with the issue details or set/return a flag to abort the Load
step, ensuring the code that performs the load (the downstream write/load
routine) checks this flag or catches the exception and stops writing; update
validate_data usage and callers so failures short-circuit the pipeline (e.g.,
replace the print-only branch with a raise or return False that the load
function respects).


| Example | Use Case | Industry | MCP Tools Used |
| ---------------------------------------------------------- | ----------------------------- | ------------------------------ | ---------------------------- |
| [SaaS Metrics Dashboard](saas_metrics_dashboard.deepnote) | KPI tracking, cohort analysis | SaaS (Slido, Statsig) | `template` + `enhance` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

CSpell failure for “Slido”.

Line 11 trips CI spellcheck. Add a cspell ignore or dictionary entry for the brand name.

🛠️ Suggested fix
+<!-- cspell:ignore Slido -->
🧰 Tools
🪛 GitHub Actions: CI

[error] 11-11: CSpell: Unknown word 'Slido'.

🤖 Prompt for AI Agents
In `@examples/mcp-demos/README.md` at line 11, The CI spellcheck flags the brand
name "Slido" in the table row for "SaaS Metrics Dashboard"; fix by adding a
cspell ignore or dictionary entry for "Slido" (e.g., add "Slido" to the
repo-level cspell.json words array or add a .cspell-ignore file entry) so the
token is treated as valid by the spellchecker and the README.md table row no
longer fails CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0