-
Notifications
You must be signed in to change notification settings - Fork 4
MCP Hooks and AgentTarget
Language: English · 简体中文
LWC connects to Agent hosts through one read-only MCP server, bounded lifecycle Hooks, owned Instructions and Skills, and 12 handwritten AgentTarget adapters. Every target is a strong adapter: it installs every stable official file-based surface available for that host and scope, then reports official gaps instead of inventing private formats.
MCP standardizes runtime messages. It does not standardize configuration paths, Skills, Hooks, Instructions, plugins, or permissions, so host compatibility must remain explicit.
Agent host
|-- MCP config / extension bridge --> lwc serve --mcp --> lwc_explore
|-- lifecycle event ---------------> lwc agent hook --> bounded readiness
|-- Skill --------------------------> when and how to use LWC
`-- Instructions -------------------> durable host guidance
|
v
AgentTarget adapter + receipt
MCP stays identical across native hosts: one server named lwc, one read-only tool, and no hidden mutation. Host-specific work is confined to adapters that know official locations and formats.
Every adapter implements the same lifecycle and capability contract:
trait AgentTarget {
fn id(&self) -> &'static str;
fn adaptation(&self) -> &'static str;
fn mcp_mode(&self, location: AgentLocation) -> &'static str;
fn permissions_mode(&self, location: AgentLocation) -> &'static str;
fn instructions_mode(&self, location: AgentLocation) -> &'static str;
fn skills_mode(&self, location: AgentLocation) -> &'static str;
fn lifecycle_mode(&self, location: AgentLocation) -> &'static str;
fn supports_location(&self, location: AgentLocation) -> bool;
fn detect(&self, environment: &TargetEnvironment) -> DetectionResult;
fn install(&self, environment: &TargetEnvironment, options: InstallOptions) -> Result<WriteResult>;
fn uninstall(&self, environment: &TargetEnvironment) -> Result<WriteResult>;
fn print_config(&self, location: AgentLocation) -> String;
fn describe_paths(&self, environment: &TargetEnvironment) -> Vec<PathBuf>;
}The registry holds one handwritten implementation per host. Shared orchestration handles selection, status, receipts, refresh, and partial failure; adapters handle only official host differences.
Install snapshots the original content and records the post-install hash for every owned path. Marker-bounded prose lets LWC replace only its own Instructions. Structured MCP and Hook fragments are removed only when they still match LWC ownership.
refresh reuses the same adapter and receipt rather than layering duplicate entries. uninstall restores original content or removes exact owned fragments, and refuses ambiguous foreign conflicts. --print-config renders without creating a receipt or writing a host file.
claude Claude Code
cursor Cursor
codex Codex
opencode OpenCode
hermes Hermes Agent
gemini Gemini CLI
antigravity Antigravity
kiro Kiro
copilot-vscode VS Code with GitHub Copilot Chat
copilot-cli GitHub Copilot CLI
copilot-jetbrains JetBrains IDEs with GitHub Copilot
pi Pi Agent
| Mode | Meaning |
|---|---|
installed |
LWC wrote the official stable surface and tracks ownership |
extension_bridge |
The host lacks built-in MCP configuration; an official extension mechanism bridges LWC |
configured_preview |
LWC wrote a documented preview or version-gated surface; host activation still requires verification |
user_managed |
The host owns the setting through UI or has no stable file path |
unsupported |
The selected host location has no official surface |
not_applicable |
The capability does not exist for that host model |
adaptation=strong does not mean every cell is installed. It means the adapter encodes the host's actual official capability and refuses to fake missing support.
Each cell is global / local.
| Target | MCP | Skill | Instructions | Hook | Permissions |
|---|---|---|---|---|---|
| Claude Code | installed / installed | installed / installed | installed / installed | installed / installed | installed / installed |
| Cursor | installed / installed | installed / installed | user_managed / installed | installed / installed | not_applicable / not_applicable |
| Codex | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| OpenCode | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| Hermes Agent | installed / unsupported | installed / unsupported | installed / installed | installed / unsupported | not_applicable / not_applicable |
| Gemini CLI | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| Antigravity | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| Kiro | installed / installed | installed / installed | installed / installed | configured_preview / configured_preview | user_managed / user_managed |
| Copilot VS Code | installed / installed | installed / installed | user_managed / installed | unsupported / configured_preview | user_managed / user_managed |
| Copilot CLI | installed / installed | installed / installed | installed / installed | installed / installed | user_managed / user_managed |
| Copilot JetBrains | installed / user_managed | configured_preview / configured_preview | user_managed / configured_preview | unsupported / unsupported | user_managed / user_managed |
| Pi Agent | extension_bridge / extension_bridge | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
configured_preview cells require a host release that exposes the documented preview surface. LWC status reports the configured state; it does not claim the host loaded it without an actual host-level check.
Every native MCP adapter registers one server named lwc:
lwc serve --mcp
CodeGraph is fused behind lwc_explore; it is not registered as a second codegraph MCP server. The runtime exposes one read-only tool with memory, code, and combined modes.
Pi has no built-in MCP configuration and therefore uses its official extension bridge. That difference is reported, not hidden.
- Global configures the current user's Agent installation.
- Local configures the current project through that host's repository surfaces.
These locations do not select LWC Wiki scope and do not enable project graph capabilities. A globally installed Agent integration can still operate on the current project's Wiki through normal project discovery.
Some hosts intentionally have partial local support. Hermes has no separate local root for MCP, Skill, or Shell Hook, while JetBrains keeps local MCP UI-managed. Their supported local Instructions or preview Skills remain installable.
Permissions are host-private and have no cross-Agent standard.
Claude Code supports an official allow-list for LWC's read-only MCP tool. LWC installs only the narrow owned entries. Other hosts may expose trust prompts or UI-owned permissions; adapters report user_managed and never grant broad tool or shell access on the user's behalf.
lwc agent status --target auto --location global
lwc agent install --print-config codex --location globalDetection means the host appears installed. It is not consent to mutate its files. Interactive install preselects detected targets; --yes accepts detected defaults, not all targets.
--print-config performs no write and is the correct path for managed environments or review before installation.
For each intended target:
- run install at the chosen location;
- require
adaptation=strongand inspect every capability mode; - verify the host loads the Skill and marker-bounded Instructions;
- invoke one real lifecycle Hook envelope and inspect bounded readiness;
- initialize MCP, list exactly one
lwc_exploretool, and make a read-only call; - run refresh and confirm no-drift byte idempotence;
- test uninstall in an isolated host profile and confirm foreign content survives.
Do not mark the target broken because an official cell is user_managed or unsupported. Mark it broken when the adapter misreports that boundary, writes an unofficial surface, or fails an officially supported one.
Agent hosts change faster than LWC's core Store. Compatibility changes require:
- current official host documentation for every written path or format;
- a source-linked capability matrix update;
- global and local install/status/refresh/uninstall tests;
- real host-level acceptance for lifecycle and MCP behavior where available;
- no maintainer-local tools, paths, or files in the adapter.
Community examples can reveal a gap, but they do not authorize a new integration format without official evidence.
All users need only:
- a compatible global
lwconPATH; - the Agent's official directories and configuration support;
- the project directory for local installation.
AMC, a maintainer's HOME layout, absolute private binary variables, and copied local plugin caches are not dependencies.
For paths, lifecycle commands, ownership receipts, refresh, and uninstall behavior, continue with AgentTarget installation and integration.
LWC Wiki
- Home · 首页
- Project overview · 项目简介
- Basic concepts · 基本概念
- Use cases · 应用场景
- Installation and upgrades · 安装与升级
- Quick start · 快速开始
- Persistent memory · 持久记忆体系
- Agent workflow and memory policy · Agent 工作流与主动记忆策略
- Sources and ingestion · 来源与知识整合
- Wiki pages and provenance · Wiki 页面与来源证明
- Search and context · 搜索与上下文载入
- Document knowledge graph · 文档知识图(记忆图网)
- Code graph · 代码图
- Word graph · 词图
- Tags and strong context · 标签与强上下文
- Document conversion · 文档转换
-
MCP server and
lwc_explore· MCP 服务与lwc_explore - Skills, Hooks, and Instructions · Skills、Hooks 与 Instructions
- AgentTarget installation · AgentTarget 安装与集成
- Changesets · Changeset 原子变更
- Work system · Work 任务系统
- Checkpoints and rollback · Checkpoint、恢复与回滚
- Read-only Viewer · 只读可视化界面
- Architecture overview · 总体架构
- Storage and data model · 存储与数据模型
- Retrieval and indexing · 检索与索引设计
- Graph projection and performance · 图投影与性能设计
- MCP, Hooks, and AgentTarget design · MCP、Hook 与 AgentTarget 设计
- Safety and trust boundaries · 安全模型与信任边界
- Maintenance and diagnostics · 维护与诊断
- Troubleshooting and FAQ · 故障排查与常见问题
- Migration and compatibility · 迁移与版本兼容
- Support and issue reporting · 获取帮助与问题反馈
- CLI and configuration reference · CLI 与配置参考
- JSON output and error contract · JSON 输出与错误契约
- Limits and glossary · 系统限制与术语表
- Contributing and development · 贡献与开发指南
- Testing and release process · 测试与发布流程
- Wiki style guide · Wiki 编写规范