Skip to content

feat(mcp): Add MCP server for Corrigo SDK via FastMCP 3.0#1

Closed
ssbean wants to merge 2 commits intomainfrom
feat/mcp-server
Closed

feat(mcp): Add MCP server for Corrigo SDK via FastMCP 3.0#1
ssbean wants to merge 2 commits intomainfrom
feat/mcp-server

Conversation

@ssbean
Copy link
Contributor

@ssbean ssbean commented Feb 21, 2026

Summary

  • Adds a full MCP (Model Context Protocol) server wrapping the Corrigo Python SDK using FastMCP 3.0
  • Exposes 22 tools (WO lifecycle, entity CRUD, queries), 8 resource templates, and 6 prompt templates
  • Designed for AI agent integration: voice agents, dispatch tools, customer-facing bots
  • Ships as pip install corrigo[mcp] optional dependency with corrigo-mcp CLI entry point

Architecture

Server foundation (src/corrigo/mcp/server.py):

  • @lifespan manages CorrigoClient lifecycle (env vars → auth → close on shutdown)
  • Pre-caches AttributeDescriptor entities to avoid N+1 HTTP calls
  • handle_sdk_error() maps all SDK exceptions to ToolError with customer-safe messages
  • mask_error_details=True prevents internal stack traces leaking to MCP clients

Tools (22 total):

  • Work order lifecycle: create, assign, pickup, start, complete, cancel, hold, pause, reopen, update
  • Work order listings: by status, customer, assignee, brand, or filtered query
  • Entity CRUD: customer, contact, employee, location
  • query_entities: generic query with Django-like filter syntax (__like, __gt, etc.)
  • search_locations: name search with suggestion on empty results

Resources (8 URI templates):

  • corrigo://work-orders/{id}, corrigo://work-orders/number/{number}
  • corrigo://customers/{id}, corrigo://customers/{id}/assets
  • corrigo://locations/{id}, corrigo://locations/{id}/attributes
  • corrigo://employees/{id}, corrigo://invoices/{id}

Prompts (6 workflow templates):

  • Internal: triage_work_order, diagnose_work_order, customer_overview
  • Customer-facing: work_order_status (field-filtered), report_issue, troubleshoot_equipment
  • Tiered graceful degradation when sub-fetches fail

Tag-based audience separation: internal vs customer-facing tags on all primitives.

Test plan

  • 63 tests pass using FastMCP in-memory Client(mcp) pattern
  • Error mapping: 12 tests covering all SDK exception types
  • WO tools: 18 tests (create, update with ConcurrencyId, lifecycle, listings, brand)
  • Entity tools: 11 tests (CRUD, query filters, search)
  • Resources: 10 tests (get by ID, not found, by number, attributes)
  • Prompts: 10 tests (structured messages, partial failure, field filtering)
  • uv run ruff check passes clean
  • uv run ruff format --check passes clean

Post-Deploy Monitoring & Validation

No additional operational monitoring required: this is a new optional module (corrigo[mcp]) that does not affect existing SDK functionality. The MCP server is only activated when explicitly installed and run.


Compound Engineered 🤖 Generated with Claude Code

ssbean and others added 2 commits February 21, 2026 00:27
Implements a full MCP server exposing the Corrigo Python SDK as MCP
primitives for AI agent integration (voice agents, dispatch tools).

Server foundation:
- FastMCP 3.0 with lifespan-managed CorrigoClient
- SDK exception → ToolError/ResourceError mapping with mask_error_details
- Attribute descriptor pre-caching to avoid N+1 HTTP calls
- Tag-based audience separation (internal vs customer-facing)

22 tools:
- Work order lifecycle (create, assign, pickup, start, complete, cancel,
  hold, pause, reopen, update) + 5 listing tools
- Entity CRUD (customer, contact, employee, location)
- Generic query_entities with Django-like filter syntax
- search_locations with suggestion on empty results

8 resource templates:
- corrigo://work-orders/{id}, corrigo://work-orders/number/{number}
- corrigo://customers/{id}, corrigo://customers/{id}/assets
- corrigo://locations/{id}, corrigo://locations/{id}/attributes
- corrigo://employees/{id}, corrigo://invoices/{id}

6 prompt templates:
- triage_work_order, diagnose_work_order (internal ops)
- customer_overview (account management)
- work_order_status (customer-facing, field-filtered)
- report_issue, troubleshoot_equipment (voice agent)

Packaging:
- pip install corrigo[mcp] optional dependency
- corrigo-mcp CLI entry point
- python -m corrigo.mcp support
- Requires Python >=3.10 (FastMCP requirement)

63 tests with full in-memory MCP client testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mark all implemented phases (1-6) as complete in the plan
checkboxes. Quality gates verified: 63 tests pass, ruff
clean, mypy clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ssbean
Copy link
Contributor Author

ssbean commented Feb 21, 2026

Closing — MCP server moved to its own repository.

@ssbean ssbean closed this Feb 21, 2026
@ssbean ssbean deleted the feat/mcp-server branch February 21, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant