Skip to content

Commit 6a4ebdc

Browse files
authored
Merge pull request #8 from zenml-io/claude-md
Add PR test workflow for automated testing + add `CLAUDE.md` file
2 parents 308d6bd + e518e83 commit 6a4ebdc

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

.github/workflows/pr-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths-ignore: ["assets/**"]
7+
push:
8+
branches: [main]
9+
concurrency:
10+
# New commit on branch cancels running workflows of the same branch
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
21+
env:
22+
ZENML_DISABLE_RICH_LOGGING: "1"
23+
ZENML_LOGGING_COLORS_DISABLED: "true"
24+
ZENML_ANALYTICS_OPT_IN: "false"
25+
PYTHONIOENCODING: "UTF-8"
26+
PYTHONUNBUFFERED: "1"
27+
ZENML_STORE_URL: ${{ secrets.ZENML_STORE_URL }}
28+
ZENML_STORE_API_KEY: ${{ secrets.ZENML_STORE_API_KEY }}
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Python 3.12
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: "3.12"
38+
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v5
41+
with:
42+
enable-cache: true
43+
44+
- name: Run MCP smoke test
45+
run: |
46+
echo "Running MCP smoke test..."
47+
uv run scripts/test_mcp_server.py server/zenml_server.py

CLAUDE.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Commands
6+
7+
### Testing and Development
8+
- **Run smoke tests**: `uv run scripts/test_mcp_server.py server/zenml_server.py`
9+
- **Format code**: `./scripts/format.sh` (uses ruff for linting and formatting)
10+
- **Run MCP server locally**: `uv run server/zenml_server.py`
11+
12+
### Code Quality
13+
- **Format**: `bash scripts/format.sh`
14+
15+
## Architecture
16+
17+
### Core Components
18+
19+
The project is a Model Context Protocol (MCP) server that provides AI assistants with access to ZenML API functionality.
20+
21+
**Main Server File**: `server/zenml_server.py`
22+
- Uses FastMCP framework for MCP protocol implementation
23+
- Implements lazy initialization of ZenML client to avoid startup delays
24+
- Provides comprehensive exception handling with the `@handle_exceptions` decorator
25+
- Configures minimal logging to prevent JSON protocol interference
26+
27+
**Key Features**:
28+
- Reads ZenML server configuration from environment variables (`ZENML_STORE_URL`, `ZENML_STORE_API_KEY`)
29+
- Provides MCP tools for accessing ZenML entities (users, stacks, pipelines, runs, etc.)
30+
- Supports triggering new pipeline runs via run templates
31+
- Includes automated CI/CD testing with GitHub Actions
32+
33+
### Environment Setup
34+
35+
The server requires:
36+
- Python 3.12+
37+
- Dependencies managed via `uv` (preferred) or pip
38+
- ZenML server URL and API key configured as environment variables
39+
40+
### Testing Infrastructure
41+
42+
- **PR Testing**: GitHub Actions runs tests on every PR (formatting checks + smoke tests)
43+
- **Scheduled testing**: Comprehensive smoke tests run every 3 days with automated issue creation on failures
44+
- **Manual testing**: Use the test script to verify MCP protocol functionality
45+
- **CI/CD**: Uses UV with caching for fast dependency installation
46+
47+
### Project Structure
48+
49+
- `server/` - Main MCP server implementation
50+
- `scripts/` - Development and testing utilities
51+
- `assets/` - Project assets and images
52+
53+
- Root files include configuration for Desktop Extensions (DXT) support
54+
55+
### Important Implementation Details
56+
57+
- **Logging**: Configured to use stderr and suppress ZenML internal logging to prevent JSON protocol conflicts
58+
- **Error Handling**: All tool functions wrapped with exception handling decorator
59+
- **Lazy Loading**: ZenML client initialized only when needed to improve startup performance
60+
- **Environment Variables**: Server configuration via `ZENML_STORE_URL` and
61+
`ZENML_STORE_API_KEY`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This project includes automated testing to ensure the MCP server remains functio
6161
- **🔄 Automated Smoke Tests**: A comprehensive smoke test runs every 3 days via GitHub Actions
6262
- **🚨 Issue Creation**: Failed tests automatically create GitHub issues with detailed debugging information
6363
- **⚡ Fast CI**: Uses UV with caching for quick dependency installation and testing
64-
- **🧪 Manual Testing**: You can run the smoke test locally using `uv run scripts/test_mcp_server.py zenml_server.py`
64+
- **🧪 Manual Testing**: You can run the smoke test locally using `uv run scripts/test_mcp_server.py server/zenml_server.py`
6565

6666
The automated tests verify:
6767
- MCP protocol connection and handshake

0 commit comments

Comments
 (0)