feat: MCP Server, Knowledge System, and Skills for Player UI#812
feat: MCP Server, Knowledge System, and Skills for Player UI#812rafbcampos wants to merge 12 commits intomainfrom
Conversation
|
/canary |
Bundle ReportChanges will increase total bundle size by 118.53kB (2.11%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #812 +/- ##
=======================================
Coverage 85.87% 85.87%
=======================================
Files 505 505
Lines 22894 22894
Branches 2660 2660
=======================================
Hits 19661 19661
Misses 2906 2906
Partials 327 327 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@claude can you review this PR? |
|
Claude finished @spentacular's task in 2m 6s —— View job PR Review: feat: MCP Server and Knowledge System for Player UITasks:
Overall AssessmentThis is a well-crafted PR — clean architecture, thorough test coverage (100% lines covered per Codecov), good security practices, and a useful contribution. Below are findings ranging from bugs to style suggestions. Bugs / Correctness Issues1.
has(key: string): boolean {
return this.cache.has(key);
}2. Overview truncation always appends // Current — appends "..." unconditionally
const overview = overviewMatch
? overviewMatch[1].substring(0, config.overviewMaxLength).trim() + "..."
: "No overview available.";If the overview text is shorter than const fullOverview = overviewMatch[1].trim();
const overview = fullOverview.length > config.overviewMaxLength
? fullOverview.substring(0, config.overviewMaxLength) + "..."
: fullOverview;3. maxDependencyDepth: parseInt(process.env.MCP_MAX_DEPTH || "2", 10),If const rawDepth = parseInt(process.env.MCP_MAX_DEPTH || "2", 10);
maxDependencyDepth: Number.isNaN(rawDepth) ? 2 : rawDepth,Same applies to Design / Code Quality4. Redundant path traversal condition — if (
relativePath.startsWith("..") ||
resolve(baseDir, relativePath) !== resolvedPath // ← always false when first check passes
) {
Also, the second check at line 44 ( 5. Double iteration over The response is built by iterating the map twice (first for the main package, then for deps). Since for (const [pkg, knowledge] of knowledgeMap.entries()) {
if (pkg !== packageName) {
response += `---\n\n# Dependency: ${pkg}\n\n`;
}
response += knowledge + "\n\n";
}6. Accessing server.server.setRequestHandler(ListToolsRequestSchema, async () => { ... });
Test Observations7. Most test cases in this file call the mocked functions directly and verify the mocked return values — they don't exercise the switch statement in the Minor Suggestions
SummaryThe PR is in good shape and ready for merge after addressing the bugs above (items 1–3 are most impactful). The architecture is sound, error handling is comprehensive, and the test coverage is solid. Great work on the path traversal protection and the structured error hierarchy. |
spentacular
left a comment
There was a problem hiding this comment.
First pass, running through it again tomorrow.
|
/canary |
|
@claude can you review this PR? |
|
Claude finished @rafbcampos's task in 1m 34s —— View job Claude finished @rafbcampos's task — This PR adds a clean, well-structured AI toolkit for Player UI — MCP server, knowledge system, and skills CLI. Test coverage is thorough and the security model (path traversal protection, typed errors, input validation) is solid. Three bugs from the prior review are still outstanding, plus one new finding: Unresolved bugs1.
// fix: delegate to Map directly
has(key: string): boolean {
return this.cache.has(key);
}2. // current: misleads LLM that content was cut off
overviewMatch[1].substring(0, config.overviewMaxLength).trim() + "..."
// fix: only append when actually truncated
const full = overviewMatch[1].trim();
full.length > config.overviewMaxLength
? full.substring(0, config.overviewMaxLength) + "..."
: full3.
const rawDepth = parseInt(process.env.MCP_MAX_DEPTH || "2", 10);
maxDependencyDepth: Number.isNaN(rawDepth) ? 2 : rawDepth,New finding4. const version = "0.0.0-PLACEHOLDER"; // never replaced at build timeThe root declare const __VERSION__: string;
const version = __VERSION__;This matches what |
|
@claude can you do another review and check if we addressed all the issues pointed in the last one? |
|
Claude finished @rafbcampos's task in 1m 2s —— View job All four bugs from the previous reviews have been addressed. Three of the five design notes are still open but are non-blocking. Bug fixes — status
Design notes — still open (non-blocking)Double iteration in Two separate loops iterate over Redundant second condition in path traversal check — resolve(baseDir, relativePath) !== resolvedPath
Also, the
Still using The PR is in good shape — all flagged bugs are resolved. The remaining items are minor. LGTM. |
|
/canary |
Overview
This PR introduces an AI-assisted development toolkit for Player UI, consisting of three systems:
Motivation
Traditional documentation is written for humans, not LLMs. LLMs need a different approach:
This enables tools like Claude Code to assist with Player UI without exceeding context limits.
What's Changed
📚 Knowledge System (
tools/mcp-server/knowledge/)Knowledge Artifact Features:
🔧 MCP Server (
tools/mcp-server/)A Model Context Protocol server that exposes four tools:
1. player_get_package
Retrieve detailed knowledge for a package with automatic dependency resolution.
Returns: Markdown with concepts, APIs, patterns, and pitfalls.
2. player_search_api
Search for packages by concept, keyword, or API name.
Returns: Matching packages with relevance type.
3. player_detect_packages
Auto-detect Player UI packages from package.json and provide quick reference.
Returns: Detected packages with overview of each.
4. player_list_packages
List all available Player UI packages with descriptions and metadata.
Returns: List of packages grouped by category with tags, exports, dependencies, and token counts.
Internal Modules (
tools/mcp-server/src/)loader.ts— reads knowledge artifacts from disk, resolves dependencies recursivelycache.ts— LRU cache for loaded knowledge artifactsconfig.ts— environment-based configuration (MCP_MAX_DEPTH,MCP_CACHE_MAX_SIZE, etc.)validation.ts— input validation for all tool argumentserrors.ts— typed error classes (e.g.,PathTraversalError,PackageNotFoundError)logger.ts— structured logging to stderrdetect-packages.ts— utility to scanpackage.jsonfor Player UI dependencies🛠️ Skills (
tools/skills/)A Claude Code skills installer (
@player-ui/skills) that bundles curated skill files for Player UI development. Skills are self-contained markdown guides with YAML front matter that walk AI assistants through common tasks.CLI Commands:
player-ui-skills install— Interactively select and install skills to local (.claude/skills/) or global (~/.claude/skills/) scopeplayer-ui-skills list— View and manage currently installed skillsAvailable Skills (7):
create-core-plugincreate-react-plugincreate-android-plugincreate-jvm-plugincreate-swift-plugincreate-multiplatform-pluginplayer-hooks-guideTests
MCP Server: Unit tests for every module (
cache,config,errors,logger,resolver,validation,index) and each tool handler (detect-packages,get-package,list-packages,search-api), plus an e2e consumer simulation test. 12 test files total.Skills: Unit tests for CLI commands (
install,list) and library modules (installer,paths,skills). 5 test files total.🎯 Key Features
anyArchitecture
Progressive Disclosure
The system uses three-tiered knowledge delivery:
Tier 1: Auto-Detection (Zero-effort)
Tier 2: On-Demand (Low-effort)
player_get_packageautomaticallyTier 3: Search (Exploratory)
player_search_apiSkills Workflow
Skills complement the knowledge system by providing task-level guidance:
Users install skills via the CLI, and Claude Code automatically picks them up from
.claude/skills/.Dependency Resolution
When retrieving a package, the system automatically includes:
Usage
For Claude Code Users
MCP Server — Add to
.claude/config.json:{ "mcpServers": { "player-ui": { "command": "npx", "args": ["@player-ui/mcp-server"] } } }Skills — Install via CLI:
Then ask Claude questions about Player UI — the knowledge system is queried as needed and skills guide plugin creation.
Build System Integration
Both packages are integrated with the Bazel monorepo:
Dependencies Added
@modelcontextprotocol/sdk: ^1.0.0 — added to rootpackage.json; referenced in the BUILD file via//:node_modules/@modelcontextprotocol/sdkOther Changes
.bazelignoreupdated to excludetools/mcp-server/node_modulesandtools/skills/node_modulesBreaking Changes
None. This is a purely additive feature that doesn't affect existing code.