diff --git a/en/develop/agent-context.mdx b/en/develop/agent-context.mdx index 3798ae419..4da86e89e 100644 --- a/en/develop/agent-context.mdx +++ b/en/develop/agent-context.mdx @@ -153,6 +153,27 @@ uv run python -m langbot.pkg.persistence.alembic_runner autogenerate "describe y - `scope`: the affected package/module/file/class. - `subject`: a concise description of the change. +## Agent-Facing Surfaces (MCP + Skills) + +LangBot is built to be **agent-friendly**, with three agent-facing surfaces that +are kept in lockstep with the HTTP API: + +1. **MCP server** — `src/langbot/pkg/api/mcp/` exposes a curated subset of the API + as MCP tools at `/mcp` (API-key authenticated, including `api.global_api_key` + from config.yaml). `server.py` defines the tools (calling the service layer + directly); `mount.py` is the ASGI dispatcher. +2. **In-repo skills** — the `skills/` directory is the **single source of truth** + for all LangBot agent skills (plugin dev, core dev, deployment, e2e, MCP + operations). Docs and the landing page link here rather than copying content. +3. **API-key auth** — `api.global_api_key` (config.yaml) authenticates the API and + MCP without a login session; see `docs/API_KEY_AUTH.md`. + +> **Maintenance rule (important).** When you add, remove, or change an HTTP API +> endpoint that should be agent-accessible, you MUST update **both** the matching +> MCP tool in `src/langbot/pkg/api/mcp/server.py` **and** the relevant skill under +> `skills/` (especially `skills/skills/langbot-mcp-ops`). API, MCP tools, and +> skills are one system — drift between them is a bug. + ## Some Principles - Keep it simple, stupid. diff --git a/ja/develop/agent-context.mdx b/ja/develop/agent-context.mdx index ccc780e53..df53fa21c 100644 --- a/ja/develop/agent-context.mdx +++ b/ja/develop/agent-context.mdx @@ -153,6 +153,28 @@ uv run python -m langbot.pkg.persistence.alembic_runner autogenerate "変更内 - `scope`:影響を受けるパッケージ/モジュール/ファイル/クラス。 - `subject`:変更内容の簡潔な説明。 +## Agent 向けの機能(MCP + スキル) + +LangBot は設計上**AI エージェントに優しく**、HTTP API と厳密に整合した 3 つの +Agent 向けサーフェスを提供します: + +1. **MCP サーバー**: `src/langbot/pkg/api/mcp/` が `/mcp` で API の厳選サブセットを + MCP ツールとして公開します(API キー認証、config.yaml の `api.global_api_key` + を含む)。`server.py` がツールを定義し(service 層を直接呼び出す)、`mount.py` + が ASGI ディスパッチャです。 +2. **リポジトリ内スキル**: `skills/` ディレクトリは LangBot の全 Agent スキル + (プラグイン開発、コア開発、デプロイ、e2e、MCP 操作など)の**唯一の信頼できる + 情報源**です。ドキュメントとランディングページは内容を複製せず、ここへリンク + します。 +3. **API キー認証**: `api.global_api_key`(config.yaml)はログインセッションなしで + API と MCP を認証します。`docs/API_KEY_AUTH.md` を参照してください。 + +> **メンテナンスルール(重要)**: Agent からアクセス可能であるべき HTTP API +> エンドポイントを追加・削除・変更する際は、`src/langbot/pkg/api/mcp/server.py` +> の対応する MCP ツール**と** `skills/` 配下の関連スキル(特に +> `skills/skills/langbot-mcp-ops`)の**両方**を必ず更新してください。API・MCP +> ツール群・スキルは一つのシステムであり、ずれはバグです。 + ## いくつかの原則 - Keep it simple, stupid. diff --git a/zh/develop/agent-context.mdx b/zh/develop/agent-context.mdx index 51d7af422..4a154e803 100644 --- a/zh/develop/agent-context.mdx +++ b/zh/develop/agent-context.mdx @@ -152,6 +152,16 @@ uv run python -m langbot.pkg.persistence.alembic_runner autogenerate "描述你 - `scope`:受影响的包/模块/文件/类。 - `subject`:简洁的变更描述。 +## 面向 Agent 的能力(MCP + 技能) + +LangBot 从设计上就**对 AI Agent 友好**,提供三类面向 Agent 的能力,并与 HTTP API 严格对齐: + +1. **MCP 服务**:`src/langbot/pkg/api/mcp/` 在 `/mcp` 上以 MCP 工具形式开放了 API 的精选子集(使用 API Key 鉴权,含 config.yaml 中的 `api.global_api_key`)。`server.py` 定义工具(直接调用 service 层),`mount.py` 是 ASGI 分发器。 +2. **仓库内技能**:`skills/` 目录是 LangBot 全部 Agent 技能(插件开发、核心开发、部署、e2e、MCP 操作等)的**唯一事实来源**。文档与落地页都链接到此处,而非各自复制。 +3. **API Key 鉴权**:`api.global_api_key`(config.yaml)可在无登录态下鉴权 API 与 MCP,详见 `docs/API_KEY_AUTH.md`。 + +> **维护规则(重要)**:当你新增、删除或修改某个应对 Agent 开放的 HTTP API 端点时,必须**同时**更新 `src/langbot/pkg/api/mcp/server.py` 中对应的 MCP 工具**以及** `skills/` 下相关技能(尤其是 `skills/skills/langbot-mcp-ops`)。API、MCP 工具集与技能是同一套系统,三者漂移即为 bug。 + ## 一些原则 - Keep it simple, stupid.