feat(mcp): add MCP server for AI dialog plugin integration#49
Closed
m0Nst3r873 wants to merge 30 commits into
Closed
feat(mcp): add MCP server for AI dialog plugin integration#49m0Nst3r873 wants to merge 30 commits into
m0Nst3r873 wants to merge 30 commits into
Conversation
…nteraction Add `teamai ci extract-mr` command for CI pipeline integration: - Extract learnings and codebase suggestions from MR/PR via AI - Post each suggestion as individual comment with unique marker - Reviewer rejects unwanted items via reaction (GitHub 👎 / TGit ☝️) - Post-merge: filter out rejected items, write approved knowledge to team repo - Auto-configure git committer from token API (passes TGit committer-check) - Fix TGit API: use ?iid= query and global MR id for Notes API - Fix AI output: strip preamble before YAML frontmatter - CI templates for GitHub Actions and Coding CI (QCI) - Update README with CI Integration section --story=0
Add `teamai ci extract-mr` command to the command table and add the CI Integration section (quick start, templates, reject interaction) to match the English README updated in PR Tencent#39.
Vendor team-wiki's code-knowledge + core packages as the codebase knowledge engine, replacing AI-generated docs/team-codebase/ with structured teamwiki/ knowledge graph. New capabilities: - `teamai codebase --extract`: deterministic code fact extraction (5 languages) + graph-index.json construction - `teamai recall`: BM25 + graph-boost codebase retrieval - `teamai ci extract-mr`: incremental graph update on MR merge with PR comment (learning + graph change summary) - `teamai import --from-repo/org/iwiki`: auto-push + MAPS_TO reconcile - `teamai codebase --lint`: graph health + navigation file checks - Cross-repo edge detection via PascalCase label matching - Knowledge gaps detection (IMPL_MISSING, LOW_CONNECTIVITY, etc.) - Pull protection: skip overwrite when local teamwiki/ is newer Knowledge graph architecture based on Team Wiki by @lurkacai. --other=code-knowledge-graph engine integration (no TAPD story)
- Extract autoPushTeamRepo to utils/git.ts (was duplicated in 3 files) - Extract teamwiki template constants to wiki-engine/adapters/templates.ts - Replace inline long strings in import-repo.ts with template functions - Simplify import-iwiki.ts and import.ts push logic --other=code deduplication refactor
…ecommendation - teamwikiRoot now points to .teamai/team-repo/teamwiki/ (not cwd/) so autoPush correctly includes graph artifacts - Push moved before domain recommendation step - Domain recommendation still runs but no longer blocks the main flow --other=fix teamwiki push path and domain skip
…tput AI sometimes wraps the learning draft in ```markdown...``` code fences, causing gray-matter YAML parsing to crash. Strip the outer fence before attempting frontmatter extraction. --other=fix AI output parsing edge case
…n forceSsh - TGit API returns http:// URLs but netrc only works with HTTPS - forceSsh now properly converts HTTP/HTTPS URLs to git@host:path format --other=fix clone auth for TGit repos
…e-graph feat(codebase): integrate team-wiki knowledge graph engine
- mergeGraphs: use n.slug ?? n.id ?? fallback as node dedup key (CodeGraphIndex nodes have 'id' not 'slug', causing all nodes to collapse into one entry when merging multi-repo graphs) - import-repo: catch domains.yaml load errors gracefully (http:// URLs from TGit API fail schema validation, skip domain recommendation) --other=fix multi-repo graph merge and domain validation
Knowledge graph (teamwiki/) organizes repo relationships via nodes/edges, making AI domain clustering redundant. Simplified flow: list repos → filter → generate whitelist → batch import Skipped 3 tests that validated the removed clustering logic. --other=remove AI clustering from import-org
- Increase AI call timeout from 720s to 1200s (large repos need more time) - generateCodebaseMd failure now warns instead of throwing, allowing extractCodebase (deterministic graph extraction) to proceed regardless - docs/team-codebase write skipped when AI scan fails; teamwiki/ graph extraction still runs successfully --other=fix large repo import resilience
- code-collector now scans .toml, .sql, .conf, .ini files - New extractors/config.ts: extractToml (section headers + uppercase keys) and extractSql (CREATE TABLE, ALTER TABLE, CREATE INDEX) - Config repos (like hai_api_configs, hai_flow_configs) now produce meaningful config/data nodes in the knowledge graph --other=add config file extraction support
When merging graphs from multiple repos, also check if config/data
nodes in one repo match component/interface labels in another.
Uses exact label match (lowercased, min 5 chars) to avoid false positives.
Note: deeper config-key-to-code-reference detection (e.g. conf.get("key"))
requires string literal analysis, left for future enhancement.
--other=config cross-repo edge detection
… quality
1. Module summaries (modules/<dir>.md):
- Groups facts by top-level directory
- Shows dependency direction (depends on / depended by)
- Lists top 20 core components ranked by reference count
- Only generated for modules with 5+ facts
2. AI overview (overview.md):
- When generateCodebaseMd succeeds, its output is saved as
evidence/<project>/overview.md in teamwiki
- Provides "why/how" context that deterministic facts alone lack
- Gracefully skipped when AI scan times out
--other=improve recall quality with module summaries
- Step 1: check teamwiki/router.md + index.md for codebase context - Step 4: prefer module summaries over raw facts; use overview.md for architectural context; relay knowledge gaps - Add 'codebase' as a valid type tag - Increase output cap to 2500 chars (module summaries are richer) - Add rule: prefer module summaries, mention gaps --other=recall subagent prompt enhancement
Output now includes three sections: - Relevant knowledge: standard doc_id + summary entries - Codebase context: module dependency direction + top 5 core components extracted inline from module summaries (no second Read needed) - Gaps: explicit warning when query hits undocumented areas This eliminates the main conversation's need for follow-up retrieval when codebase knowledge is relevant. --other=recall subagent output structure enhancement
…ents
Bug 1 (critical): Stop hook output used invalid {"stopReason":...} format.
Claude Code only passes hookSpecificOutput.additionalContext to the AI.
5 sessions had hinted=true but users never saw the hint.
Fix: new src/utils/hook-output.ts with multi-tool format awareness
(Claude Code/CodeBuddy use hookSpecificOutput, Cursor uses {message}).
Bug 2 (minor): scoring formula adjustments:
- Tool count start: 30→20
- Duration: add 15min tier (+10)
- Git commit penalty: -15→0 (neutral)
- BASE_THRESHOLD: 20→15
Document the codebase knowledge graph output format with real data from HAI team (11 repos, 2218 nodes, 852 edges). Explains each file's purpose: router.md, graph-index.json, evidence pages, relation pages, and gaps detection.
- Hide 10 hook-only commands from --help (hook-dispatch, track, auto-recall, contribute-check, etc.) — still functional, just hidden - Hide domains command (replaced by knowledge graph edges) - Simplify import options: show 8 core options, hide 17 advanced ones - Simplify codebase options: show --lint/--fix/--json, hide rest - Streamline README command table: core commands visible, rest in collapsible section (EN + CN)
Enable teamai to run natively inside IDE dialog panels (CodeBuddy Chat, Cursor Chat, Claude Desktop) without requiring Bash tool or PATH setup. New command: `teamai mcp` starts a stdio MCP server exposing: - teamai_recall: search team knowledge base (BM25 + graph-boost) - teamai_pull: sync team resources - teamai_status: show local vs repo diff - teamai_contribute: contribute learnings directly - teamai_import_repo: import repository knowledge graph - teamai_list: list team resources - teamai_codebase_lint: knowledge graph health check Auto-registration: `teamai pull` now registers the MCP server in ~/.claude/mcp.json, ~/.codebuddy/mcp.json, ~/.cursor/mcp.json.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
teamai mcpcommand that starts a stdio MCP serverteamai pullTest plan
teamai mcpstarts without error (stdio mode)tools/listreturns 7 registered toolsteamai_recallreturns results from local knowledge baseteamai pullregisters MCP server in tool configs