MCP Server Overview
Connect AI assistants to ProBeya via the Model Context Protocol (MCP) — tools, resources, and prompts for your transformation boards.
What is MCP?
The Model Context Protocol (MCP) is an open standard that lets AI assistants interact with external systems through a structured interface of tools, resources, and prompts. ProBeya ships a first-class MCP server so that Claude Desktop, Claude Code, VS Code extensions, and any MCP-compatible client can read and write your transformation data directly.
When to Use MCP vs REST
| Use Case | MCP | REST |
|---|---|---|
| AI assistant querying board status during a conversation | Yes | No |
| Nightly cron job syncing OEE from MES | No | Yes |
| Claude analyzing KPI trends and recommending actions | Yes | No |
| LIMS webhook creating CAPAs on deviation events | No | Yes |
| Developer asking Claude Code to update an item | Yes | No |
| Zapier/Make.com integration | No | Yes |
| Pharma-specific prompts (CAPA analysis, standup) | Yes | No |
| Bulk data ingestion (1000+ measurements) | No | Yes |
Rule of thumb: Use MCP when an AI model is in the loop. Use REST for system-to-system integrations.
Real Claude Conversation Example
Here is an actual conversation between a pharma quality manager and Claude Desktop connected to ProBeya via MCP:
User: What are the KPI alerts on our Brussels filling line board?
Claude: Let me check the KPI alerts for your Brussels board.
[Calling tool: get_kpi_alerts with boardId: "clx9bd001"]
There are 2 KPI alerts on the Brussels Filling Line board:
1. **OEE** — 82.5% (AMBER)
Threshold: Green ≥85%, Amber ≥75%, Red <75%
Target: 90% by end of year
→ Below target but above amber. Line 2 downtime (seal replacement)
is the primary driver.
2. **Right First Time** — 96.2% (AMBER)
Threshold: Green ≥98%, Amber ≥95%, Red <90%
→ Labeling errors on secondary packaging. Not a product quality issue
but affecting the metric.
Would you like me to create actions for these, or run a full
SQCDP review using the kpi_review prompt?
User: Create a critical action for the OEE issue and assign it to
Dr. Chen. Due next Friday.
Claude: [Calling tool: create_action with boardId: "clx9bd001",
title: "Investigate Line 2 seal failures causing OEE drop to 82.5%",
priority: "critical", category: "D", responsibleId: "clx9us003",
dueDate: "2026-04-18"]
Done. Action created and assigned to Dr. Marie Chen:
- **Title:** Investigate Line 2 seal failures causing OEE drop to 82.5%
- **Priority:** Critical
- **Due:** April 18, 2026
- **Tier:** 1 (Team)
Dr. Chen has been notified. The action will appear on the Brussels
board's action list.
Transport Modes
The ProBeya MCP server supports two transport modes:
stdio (Local)
The server runs as a local child process. Used by Claude Desktop, Claude Code, and VS Code. The AI client spawns the process and communicates over stdin/stdout.
Best for: local development, personal productivity, secure environments where data never leaves your machine.
HTTP (Remote)
The server runs at mcp.probeya.com and accepts authenticated HTTP connections.
Best for: shared team access, CI/CD integrations, cloud-hosted AI agents.
Authentication
All MCP connections authenticate via the PRPROBEYA_API_KEY environment variable.
# API key format
PRPROBEYA_API_KEY="probeya_sk_live_7f3a..."
The key is verified using the same authentication pipeline as the REST API: bcrypt verification, prefix lookup, expiry/revocation checks, and scope validation.
The API key is read from the environment, not from command-line arguments, to prevent
leakage in process listing output (ps aux). Never pass it as a CLI argument.
Generate an API key from Settings > API Keys in the ProBeya web app. Each key is scoped to a specific organization and user.
Scope Enforcement
API keys can be scoped to limit what the AI assistant can do. Scopes follow a action:resource pattern:
| Scope | Grants access to |
|---|---|
read:items | list_workspaces, list_projects, get_board, list_members |
write:items | create_item, update_item, delete_item, move_item, set_item_values, add_comment |
read:search | search |
read:kpis | list_kpis, get_kpi_alerts |
write:kpis | set_kpi_value |
read:actions | list_actions |
write:actions | create_action, update_action, escalate_action |
read:dashboard | get_dashboard_stats |
projects:read | list_tech_transfers, get_tech_transfer, list_hoshin_matrices, get_hoshin_matrix, list_simulations, list_ppm_programs |
projects:write | run_monte_carlo |
compliance:read | list_compliance_requirements, get_compliance_dashboard, list_inspection_checklists, list_inspection_sessions |
assets:read | list_assets |
assets:write | log_asset_maintenance |
routines:read | list_routine_templates |
routines:write | start_routine_execution |
knowledge:read | list_knowledge_articles |
knowledge:write | create_knowledge_article |
training:read | list_qualifications |
tickets:read | list_tickets |
tickets:write | create_ticket |
boards:read | list_shift_handovers, list_problem_sheets |
If an API key has no scopes (empty array), it has full access to all tools.
When a tool is called without the required scope, the server returns:
{
"content": [{
"type": "text",
"text": "Error: Insufficient scope. Tool requires \"write:items\". Your API key has: [read:items]."
}],
"isError": true
}
MCP Key Restrictions
Beyond standard API key scopes, MCP-specific keys support additional restrictions:
| Restriction | Description |
|---|---|
| Allowed tools | Limit the key to a specific set of tools (e.g., read-only KPI monitoring) |
| Allowed resources | Restrict which resource URIs the AI can read (supports glob patterns) |
| Token budget | Monthly token usage cap per key |
These are configured when creating an MCP API key and enforced server-side before any tool execution.
Architecture
The MCP server is a thin adapter layer over the existing tRPC API. All business logic, input validation, audit trails, and multi-tenant isolation are handled by the tRPC layer.
AI Client (Claude Desktop / Code / VS Code)
|
| MCP Protocol (stdio or HTTP)
|
ProBeya MCP Server v2.0.0 (apps/mcp/)
|
| appRouter.createCaller(ctx)
|
tRPC Procedures (@probeya/api)
|
| Drizzle ORM + tenant isolation
|
PostgreSQL (organizationId on every query)
Enforcement order for every tool call:
- Check API key scope (
read:items,write:kpis, etc.) - Check MCP key tool permission (
allowedTools) - Check MCP key token budget (
maxTokensPerMonth) - Execute handler via tRPC caller
- Log to audit trail
- Increment token counter
Server Capabilities
The ProBeya MCP server (v2.0.0) uses these MCP SDK features:
| Feature | Usage |
|---|---|
| Zod-native schemas | All input/output schemas defined with Zod, validated by the SDK |
| Tool annotations | readOnlyHint, destructiveHint, idempotentHint on every tool |
| Output schemas | Typed JSON responses via structuredContent for key tools |
| Content annotations | audience (user/assistant) and priority routing on responses |
| Resource templates | Parameterized URIs (probeya://board/{boardId}) with list + complete callbacks |
| Resource links | Cross-references from tool responses to related resources |
| Structured logging | Leveled, client-visible logs via sendLoggingMessage |
| LLM Sampling | analyze_board uses the client AI for intelligent analysis |
| Elicitation | delete_item asks for user confirmation before destructive deletion |
| Prompts | 5 pre-built prompt templates for pharma-specific workflows |
Quick Setup
Add to your claude_desktop_config.json:
{
"mcpServers": {
"probeya": {
"command": "node",
"args": ["/path/to/probeya/apps/mcp/dist/index.js"],
"env": {
"PRPROBEYA_API_KEY": "probeya_sk_live_7f3a...",
"DATABASE_URL": "postgresql://user:pass@host:5432/probeya"
}
}
}
}
What’s Next
Was this page helpful?