Files
promptfoo--promptfoo/examples/openai-mcp/promptfooconfig.authenticated.yaml
wehub-resource-sync 0d3cb498a3
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Has been cancelled
Test and Publish Multi-arch Docker Image / test (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Has been cancelled
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Has been cancelled
Validate Renovate Config / Validate Renovate Configuration (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:24:08 +08:00

83 lines
3.1 KiB
YAML

# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: Authenticated MCP server integration
prompts:
- 'Please {{action}} for customer {{customer_id}} using the Stripe API.'
- 'Can you help me {{action}} for {{customer_id}}? Use the available tools to get the information.'
- 'I need to {{action}} for customer ID {{customer_id}}. Please use the Stripe integration to fetch this data.'
providers:
- id: openai:responses:gpt-4.1-2025-04-14
config:
tools:
- type: mcp
server_label: stripe
server_url: https://mcp.stripe.com
headers:
Authorization: 'Bearer {{ env.STRIPE_API_KEY }}'
require_approval: never
allowed_tools: ['create_payment_link', 'list_payment_methods']
max_output_tokens: 1000
temperature: 0.1
instructions: 'You are a payment processing assistant. Use the Stripe MCP tools to help with payment-related tasks. Always provide clear and accurate information about payment operations.'
tests:
- vars:
customer_id: 'cus_test123'
action: 'retrieve customer information'
assert:
# Validate successful MCP tool execution with authentication
- type: is-valid-openai-tools-call
weight: 0.4
# Check for Stripe-specific content
- type: contains-any
value: ['customer', 'Stripe', 'payment', 'subscription']
weight: 0.3
# Ensure authentication worked (no auth errors)
- type: not-contains
value: 'authentication failed'
weight: 0.1
# Verify MCP tool was used successfully
- type: contains
value: 'MCP Tool Result'
weight: 0.1
# Quality validation
- type: llm-rubric
value: 'The response provides customer information or payment details'
- vars:
customer_id: 'cus_test456'
action: 'list payment methods'
assert:
# Comprehensive authentication and API validation
- type: is-valid-openai-tools-call
metric: stripe_api_success
# Check for payment-related content
- type: contains-any
value: ['payment', 'method', 'card', 'bank']
# Ensure no MCP errors (including auth errors)
- type: not-contains-any
value: ['MCP Tool Error', 'unauthorized', 'authentication failed']
# Validate API response quality
- type: llm-rubric
value: 'The response lists payment methods or explains payment options'
- vars:
customer_id: 'cus_test789'
action: 'check subscription status'
assert:
# Test authenticated MCP with subscription data
- type: is-valid-openai-tools-call
- type: contains-any
value: ['subscription', 'plan', 'billing', 'active', 'status']
# Verify successful API integration
- type: contains
value: 'MCP Tool Result'
metric: api_integration_success
weight: 0
- type: llm-rubric
value: 'The response provides subscription status or billing information'
# Note: This example requires a valid STRIPE_API_KEY environment variable
# For testing purposes, you may want to use a test API key from Stripe