apache/hamilton/mcp
- community
Checking that the SKILL.md file is still in the repository.
Interactive Hamilton DAG development via MCP tools. Validate, visualize, scaffold, and execute Hamilton pipelines without leaving the conversation. Use when building or debugging Hamilton dataflows interactively.
Install
npx vskill@latest install apache/hamilton/mcpSKILL.md
Hamilton MCP Server -- Interactive DAG Development
The Hamilton MCP server exposes Hamilton's DAG compilation, validation, and execution as interactive tools. It enables a tight feedback loop: write functions, validate the DAG, visualize dependencies, fix errors, and execute -- all without leaving the conversation.
Setup
Run via uvx (recommended). Add --with for whichever libraries your code uses:
Or install and run directly:
Or use programmatically:
Workflow: The Golden Path
Always follow this sequence when building Hamilton DAGs interactively:
Step 1: Ask the User Which Libraries They Use
Before calling any tool, ask the user which data libraries they use (pandas, numpy, polars, etc.). Then pass their answer as preferred_libraries to hamilton_capabilities and hamilton_scaffold. This ensures scaffolds match the user's project, not the server's environment.
Decision rules:
- If user says pandas: use pandas-based scaffolds and DataFrame/Series types
- If user has no preference or only uses built-in types: use
basic_pure_pythonscaffold andint/float/str/dicttypes - If
graphvizis available: usehamilton_visualizeto show the DAG structure - Never generate code that imports libraries the user hasn't stated they use
Step 2: Scaffold a Starting Point
Use hamilton_scaffold with a pattern name from the capabilities response:
| Pattern | Libraries Required | Use Case | |
|---|---|---|---|
basic_pure_python | None | Simple pipelines with built-in types | |
basic | pandas | DataFrame cleaning & counting | |
parameterized | pandas | Multiple nodes from one function | |
config_based | pandas | Environment-conditional logic | |
data_pipeline | pandas | ETL: ingest, clean, transform, aggregate | |
ml_pipeline | pandas, numpy | Feature engineering & train/test split | |
data_quality | pandas, numpy | Validation with @check_output |
Step 3: Validate Before Executing
Always validate before executing. hamilton_validate_dag compiles the DAG without running it, catching:
- Syntax errors
- Missing dependencies (parameter names that don't match any function)
- Type annotation issues
- Circular references
Self-correction loop: If validation fails, read the error, fix the code, and validate again. Do not proceed to execution until validation passes.
Step 4: Visualize the DAG (if graphviz available)
hamilton_visualize returns DOT graph source. Use this to:
- Confirm dependency structure matches intent
- Identify unexpected connections
- Explain the pipeline to the user
Step 5: Explore Node Details
hamilton_list_nodes returns structured info for every node:
- Name, output type, documentation
- Whether it's an external input (must be provided at runtime)
- Required and optional dependencies
Use this to understand what inputs the DAG needs before execution.
Step 6: Execute
hamilton_execute runs the DAG with provided inputs and returns results. Key parameters:
code: The full Python sourcefinal_vars: List of node names to compute (only these and their dependencies run)inputs: Dict of external input valuestimeout_seconds: Safety limit (default 30s)
WARNING: This executes arbitrary Python code. Always validate first.
Error Handling & Self-Correction
Common Errors and Fixes
"No module named 'X'" The code imports a library that isn't installed. Call hamilton_capabilities to check availability, then rewrite without the missing library.
"Missing dependencies: ['node_name']" A function parameter doesn't match any function name or external input. Either:
- Add a function with that name, or
- Include it in
inputswhen executing
"Execution timed out after Ns" The code takes too long. Reduce data size, simplify computation, or increase timeout_seconds.
Validation passes but execution fails Validation checks structure, not runtime behavior. Common causes:
- Missing input values at execution time
- Runtime exceptions in function bodies (division by zero, key errors)
- Library-specific errors (e.g., column not found in DataFrame)
Retry Strategy
- If a tool returns an error, fix the issue in code and retry once
- If the same error recurs, explain the issue to the user and ask for guidance
- Never retry more than twice on the same error
Tool Reference
| Tool | Purpose | When to Use | |
|---|---|---|---|
hamilton_capabilities | Environment discovery | Always first | |
hamilton_scaffold | Generate starter code | Starting a new pipeline | |
hamilton_validate_dag | Compile-time validation | Before every execution | |
hamilton_list_nodes | Inspect DAG structure | Understanding dependencies | |
hamilton_visualize | DOT graph generation | Explaining structure (requires graphviz) | |
hamilton_execute | Run the DAG | After successful validation | |
hamilton_get_docs | Hamilton documentation | Learning decorators, patterns |
Environment Fallbacks
If the MCP server is not running: Fall back to CLI:
If Hamilton is not installed: Provide the user with installation instructions:
Success Criteria
A successful MCP interaction produces:
- Code that passes
hamilton_validate_dagwith zero errors - All external inputs identified via
hamilton_list_nodes - Execution results returned from
hamilton_execute - The user understands the DAG structure (via visualization or node listing)
Additional Resources
- For core Hamilton patterns: use
/hamilton-core - For scaling with async/Spark: use
/hamilton-scale - For LLM workflow patterns: use
/hamilton-llm - For observability: use
/hamilton-observability - Hamilton documentation:
hamilton_get_docs("overview")
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.claude-plugin/skills/mcp/SKILL.md
Popularity
- Repository stars
- 2,546
- Repository forks
- 198
- 7-day trend score
- 39
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/apache/hamilton/mcp)