-
Notifications
You must be signed in to change notification settings - Fork 0
Implement coaiapy-mcp: MCP wrapper for coaiapy observability toolkit (Phase 1) #43
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
Conversation
Co-authored-by: jgwill <23141173+jgwill@users.noreply.github.com>
Co-authored-by: jgwill <23141173+jgwill@users.noreply.github.com>
miadisabelle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jgwill I did a first review with some little adjustments and thinking for our AI friends
| python -m coaiapy_mcp.server | ||
| ``` | ||
|
|
||
| ## MCP Client Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elliadi ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could even be tool or a resource (getting usage examples so the user and its LLM companion can learn together)
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### "coaia command not found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall the 'coaiapy-mcp' automatically install 'coaiapy' as dependency??
**Fixes for PR #43:** - Fix pyproject.toml license configuration (MIT inline text) - Fix list_templates to handle JSON array response from CLI - Fix prompts_list to handle JSON array response from CLI - All tests now passing: 16/16 ✅ **Testing Infrastructure Added:** - .env.template: Environment variable template - mcp-config.json: MCP client configuration - resume-mcp-test.sh: Automated testing/launch script - PR_REVIEW.md: Comprehensive PR validation review **Test Results:** - Before: 14/16 passing (87.5%) - After: 16/16 passing (100%) **Related**: #43 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @Copilot's task —— View job Comprehensive Code Review Completed ✅I've completed a thorough analysis of this PR implementing the coaiapy-mcp package. Here's my detailed review: Review Checklist:
✅ StrengthsExcellent Architecture & Design
High Code Quality
Comprehensive Implementation
Robust Documentation
|
- Remove incorrect --json flag from trace create command - Add Upstash Redis support to .env and .env.template - Add REDIS_URL for SSL/TLS connections - Maintain compatibility with local Redis setup Related: #43
|
Claude finished @Copilot's task —— View job Comprehensive PR Review for coaiapy-mcp Implementation ✅Review Checklist:
✅ StrengthsExcellent Architecture & Design
High Code Quality
Comprehensive Implementation
Robust Documentation
|
|
we used another branch and are dropping this |
Overview
This PR implements coaiapy-mcp, a complete MCP (Model Context Protocol) server that exposes coaiapy's observability capabilities to LLMs through a standardized protocol interface. This enables any MCP-compatible LLM (Claude, GPT-4, etc.) to leverage Langfuse observability, Redis stashing, and pipeline automation features.
What Was Built
Complete MCP Server Implementation
A production-ready MCP server with:
coaia://templates/URIsPackage Structure (19 files)
Key Features
🔧 MCP Tools (12 total)
All tools execute coaia CLI commands via subprocess, maintaining complete independence:
Redis Operations:
coaia_tash- Stash key-value pairs to Rediscoaia_fetch- Fetch values from RedisLangfuse Traces:
coaia_fuse_trace_create- Create traces with metadatacoaia_fuse_add_observation- Add observations to tracescoaia_fuse_add_observations_batch- Batch add observationscoaia_fuse_trace_view- View trace trees (JSON)Langfuse Prompts, Datasets, Score Configs:
📚 MCP Resources
coaia://templates/- Access to 5 built-in pipeline templatescoaia://templates/{name}- Get specific template details with variables🎨 MCP Prompts
Mia & Miette Duo Embodiment - A unique narrative-driven prompt featuring:
Plus two additional prompts for observability pipeline creation and audio workflows.
Technical Design
Separation of Concerns
Implementation Approach
coaiacommands, no direct coaiapy imports{"success": bool, ...}structureDocumentation
Comprehensive documentation provided:
Testing
Unit tests implemented and verified:
Integration tests (requiring Redis and Langfuse) are optional and can be run by users with proper credentials.
Usage Example
Configure Claude Desktop (or any MCP client):
{ "mcpServers": { "coaiapy": { "command": "coaiapy-mcp", "args": [] } } }Then in your LLM conversation:
The LLM will use the MCP tools to create a complete Langfuse trace with hierarchical observations.
Impact
Strategic Benefits
Closes #[issue-number]
Status: ✅ Phase 1 COMPLETE - Ready for testing with MCP-compatible LLMs
Original prompt
This section details on the original issue you should resolve
<issue_title>coaiapy-mcp/IMPLEMENTATION_PLAN.md</issue_title>
<issue_description># coaiapy-mcp Implementation Plan
Package: coaiapy-mcp - MCP wrapper for coaiapy observability toolkit
Status: Design Phase
Created: 2025-10-16
MCP SDK: https://github.com/modelcontextprotocol/python-sdk
🎯 Project Vision
Create an MCP (Model Context Protocol) server that exposes coaiapy's audio processing, Redis stashing, and Langfuse observability capabilities to LLMs through a standardized protocol interface.
Strategic Benefits
📦 Package Architecture
Dual Package Strategy
Dependency Specifications
coaiapy-mcp pyproject.toml:
🔧 Phase 1: Core Langfuse Observability (ITERATION 1)
Priority Tools (Subprocess CLI Wrappers)
1. Redis Operations
coaia_tashcoaia tash <key> <value>{key: str, value: str}{success: bool, message: str}coaia_fetchcoaia fetch <key>{key: str}{success: bool, value: str}Implementation:
2. Langfuse Traces (Full Lifecycle)
Discovered Subcommands:
coaia fuse traces create- Create new tracecoaia fuse traces add-observation- Add single observationcoaia fuse traces add-observations(add-obs-batch) - Batch add observationscoaia fuse traces session-view(sv) - View session by IDcoaia fuse traces trace-view(tv) - View trace tree--jsonflag available ✅coaia_fuse_trace_createcoaia fuse traces create <id> -u <user> -s <session>{trace_id: str, user_id?: str, session_id?: str, name?: str, metadata?: dict}{success: bool, trace_id: str, details: dict}coaia_fuse_add_observationcoaia fuse traces add-observation <obs_id> <trace_id> -n <name>{observation_id: str, trace_id: str, name: str, type?: str, parent_id?: str, metadata?: dict}{success: bool, observation_id: str}coaia_fuse_add_observations_batchcoaia fuse traces add-observations <trace_id> -f <file>{trace_id: str, observations: list[dict]}{success: bool, count: int, errors?: list}coaia_fuse_trace_viewcoaia fuse traces trace-view <trace_id> --json{trace_id: str}{trace: dict, observations: list}Implementation: