-
Notifications
You must be signed in to change notification settings - Fork 15
Single source MCP server docs #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5b3c8b2
Enhance MCP server pipeline patterns documentation
JakeSCahill 68557dd
Add MCP documentation partials for single-sourcing
JakeSCahill 6dd0b81
Update MCP pages to use single-sourced partials
JakeSCahill 0ca0c8d
Add CI/CD testing infrastructure for MCP examples
JakeSCahill d3a4f31
Add generate input example for data generators pattern
JakeSCahill 2810949
fix anchor
JakeSCahill be6626e
Use Cloud remote that includes single-sourced content DO NOT MERGE TH…
JakeSCahill fbfb7c4
Fix doc-tools not found error in GitHub Actions
JakeSCahill 0cd112c
Make MCP validation failures fail the test suite
JakeSCahill e5b650a
fix: Resolve ShellCheck warnings in test script
JakeSCahill 6a8ef6e
Add badge macro:
JakeSCahill 502a566
Add badge macro:
JakeSCahill 2a31da5
Add 'Outputs with processors' pattern for MCP servers
JakeSCahill d5b61d2
apply suggestions
JakeSCahill d425f35
Apply suggestions from code review
JakeSCahill 0ee420a
Apply suggestions from code review
JakeSCahill 717d9cd
Fix tests to use mcp-server lint
JakeSCahill 82c713e
Use verbose linting and check for output since Connect doe
JakeSCahill 046a5f6
Fix linter
JakeSCahill 24977cd
Apply suggestions from code review
JakeSCahill 685641c
Merge branch 'main' into single-source
JakeSCahill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Test MCP Examples | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'modules/ai-agents/examples/**/*.yaml' | ||
| - 'modules/ai-agents/examples/test-mcp-examples.sh' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'modules/ai-agents/examples/**/*.yaml' | ||
| - 'modules/ai-agents/examples/test-mcp-examples.sh' | ||
|
|
||
| jobs: | ||
| lint-and-test: | ||
| name: Lint and Test All Examples | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: Install yq | ||
| run: | | ||
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | ||
| sudo chmod +x /usr/local/bin/yq | ||
|
|
||
| - name: Install tools | ||
| run: | | ||
| npx doc-tools install-test-dependencies | ||
| rpk connect install | ||
|
|
||
| - name: Make test script executable | ||
| run: chmod +x modules/ai-agents/examples/test-mcp-examples.sh | ||
|
|
||
| # Test all examples | ||
| - name: Run automated test script | ||
| run: | | ||
| cd modules/ai-agents/examples | ||
| ./test-mcp-examples.sh | ||
|
|
||
| test-matrix: | ||
| name: Test Examples by Component Type | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| component: [processors, inputs, outputs, caches, o11y] | ||
| fail-fast: false | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: Install yq | ||
| run: | | ||
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | ||
| sudo chmod +x /usr/local/bin/yq | ||
|
|
||
| - name: Install tools | ||
| run: | | ||
| npx doc-tools install-test-dependencies | ||
| rpk connect install | ||
|
|
||
| - name: Make test script executable | ||
| run: chmod +x modules/ai-agents/examples/test-mcp-examples.sh | ||
|
|
||
| - name: Test ${{ matrix.component }} examples | ||
| run: | | ||
| cd modules/ai-agents/examples | ||
| ./test-mcp-examples.sh ${{ matrix.component }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ jobs: | |
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| node-version: '22' | ||
|
|
||
| - run: npm install | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
modules/ai-agents/examples/resources/inputs/generate-input.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| generate: | ||
| interval: 1s | ||
| count: 0 | ||
| mapping: | | ||
| root.id = uuid_v4() | ||
| root.timestamp = now() | ||
| root.user_id = random_int(min: 1000, max: 9999) | ||
| root.event_type = ["login", "purchase", "logout"].index(random_int(max: 2)) | ||
| root.amount = if this.event_type == "purchase" { random_int(min: 10, max: 500) } |
13 changes: 13 additions & 0 deletions
13
modules/ai-agents/examples/resources/outputs/redpanda-output-with-processors.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| redpanda: | ||
| seed_brokers: [ "${REDPANDA_BROKERS}" ] | ||
| topic: "llm-responses" | ||
|
|
||
| processors: | ||
| - openai_chat_completion: | ||
| api_key: "${OPENAI_API_KEY}" | ||
| model: "gpt-4" | ||
| prompt: ${! json("question") } | ||
| - mapping: | | ||
| root.question = this.question | ||
| root.answer = this.content | ||
| root.timestamp = now().ts_format("2006-01-02T15:04:05Z07:00") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Automated testing script for Redpanda Connect MCP examples | ||
| # | ||
| # Usage: | ||
| # ./test-mcp-examples.sh | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Colors for output | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[1;33m' | ||
| BLUE='\033[0;34m' | ||
| NC='\033[0m' | ||
|
|
||
| # Counters | ||
| TOTAL=0 | ||
| SKIPPED=0 | ||
| MCP_FAILS=0 | ||
|
|
||
| echo "🧪 Redpanda Connect MCP Examples Test Suite" | ||
| echo "============================================" | ||
| echo "" | ||
|
|
||
| # Run MCP server lint on the directory | ||
| echo "Running rpk connect mcp-server lint..." | ||
| LINT_OUTPUT=$(rpk connect mcp-server lint --skip-env-var-check --verbose 2>&1) || { | ||
| echo -e "${RED}❌ Linting failed${NC}" | ||
| echo "" | ||
| echo "$LINT_OUTPUT" | ||
| exit 1 | ||
| } | ||
| echo -e "${GREEN}✅ Linting passed${NC}" | ||
| echo "" | ||
|
|
||
| # Function to validate MCP metadata | ||
| validate_mcp_metadata() { | ||
| local file=$1 | ||
|
|
||
| echo -n " Validating MCP metadata... " | ||
|
|
||
| # Determine which YAML parser to use | ||
| local use_yq=true | ||
| if ! command -v yq &> /dev/null; then | ||
| use_yq=false | ||
| if ! command -v python3 &> /dev/null; then | ||
| echo -e "${RED}FAILED${NC} (neither yq nor python3 available)" | ||
| MCP_FAILS=$((MCP_FAILS + 1)) | ||
| return 1 | ||
| fi | ||
| fi | ||
|
|
||
| # Check if .meta.mcp exists | ||
| local mcp_exists | ||
| if $use_yq; then | ||
| mcp_exists=$(yq eval '.meta.mcp' "$file" 2>/dev/null) | ||
| else | ||
| mcp_exists=$(python3 -c " | ||
| import yaml | ||
| try: | ||
| with open('$file') as f: | ||
| doc = yaml.safe_load(f) | ||
| meta = doc.get('meta', {}) if doc else {} | ||
| mcp = meta.get('mcp') | ||
| print('null' if mcp is None else 'exists') | ||
| except: | ||
| print('null') | ||
| " 2>/dev/null) | ||
| fi | ||
|
|
||
| if [[ "$mcp_exists" == "null" || -z "$mcp_exists" ]]; then | ||
| echo -e "${YELLOW}SKIPPED${NC} (no MCP metadata)" | ||
| SKIPPED=$((SKIPPED + 1)) | ||
| return 0 | ||
| fi | ||
|
|
||
| # Read .meta.mcp.enabled | ||
| local enabled | ||
| if $use_yq; then | ||
| enabled=$(yq eval '.meta.mcp.enabled' "$file" 2>/dev/null) | ||
| else | ||
| enabled=$(python3 -c " | ||
| import yaml | ||
| try: | ||
| with open('$file') as f: | ||
| doc = yaml.safe_load(f) | ||
| enabled = doc.get('meta', {}).get('mcp', {}).get('enabled') | ||
| print('null' if enabled is None else str(enabled).lower()) | ||
| except: | ||
| print('null') | ||
| " 2>/dev/null) | ||
| fi | ||
|
|
||
| if [[ "$enabled" != "true" ]]; then | ||
| echo -e "${YELLOW}WARNING${NC} (mcp.enabled not set to true)" | ||
| return 0 | ||
| fi | ||
|
|
||
| # Read .meta.mcp.description | ||
| local description | ||
| if $use_yq; then | ||
| description=$(yq eval '.meta.mcp.description' "$file" 2>/dev/null) | ||
| else | ||
| description=$(python3 -c " | ||
| import yaml | ||
| try: | ||
| with open('$file') as f: | ||
| doc = yaml.safe_load(f) | ||
| desc = doc.get('meta', {}).get('mcp', {}).get('description') | ||
| print('null' if desc is None or desc == '' else str(desc)) | ||
| except: | ||
| print('null') | ||
| " 2>/dev/null) | ||
| fi | ||
|
|
||
| if [[ "$description" == "null" || -z "$description" ]]; then | ||
| echo -e "${RED}FAILED${NC} (missing description)" | ||
| MCP_FAILS=$((MCP_FAILS + 1)) | ||
| return 1 | ||
| fi | ||
|
|
||
| echo -e "${GREEN}PASSED${NC}" | ||
| return 0 | ||
| } | ||
|
|
||
| # Validate MCP metadata for each file | ||
| for file in resources/*/*.yaml; do | ||
| if [[ -f "$file" ]]; then | ||
| TOTAL=$((TOTAL + 1)) | ||
| echo "" | ||
| echo -e "${BLUE}📄 Validating: $file${NC}" | ||
| validate_mcp_metadata "$file" | ||
| fi | ||
| done | ||
|
|
||
| # Summary | ||
| echo "" | ||
| echo "============================================" | ||
| echo "📊 Test Summary" | ||
| echo "============================================" | ||
| echo "Total configs tested: $TOTAL" | ||
| if [[ $MCP_FAILS -gt 0 ]]; then | ||
| echo -e "MCP validation failures: ${RED}$MCP_FAILS${NC}" | ||
| fi | ||
| if [[ $SKIPPED -gt 0 ]]; then | ||
| echo -e "Skipped: ${YELLOW}$SKIPPED${NC}" | ||
| fi | ||
| echo "" | ||
|
|
||
| if [[ $MCP_FAILS -gt 0 ]]; then | ||
| echo -e "${RED}❌ Some tests failed${NC}" | ||
| exit 1 | ||
| else | ||
| echo -e "${GREEN}✅ All tests passed!${NC}" | ||
| exit 0 | ||
| fi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.