使用说明
Dev AI Hub--后台插件
一个集中的人工智能资产中心——指令、代理、技能和工作流——可供 GitHub Copilot, 克劳德代码, 谷歌双子座, 光标以及其他AI编码工具。
该插件将一个或多个Git存储库同步为事实来源,将资产存储在Backstage数据库中,通过UI公开它们,并通过嵌入式 MCP(模型上下文协议)服务器 因此,人工智能工具可以自动发现和安装资产。
NFS-主页
NFS-MCP目录
后台传统前端-主页
https://github.com/user-attachments/assets/5728807d-2587-408b-88f2-4c2853606285
安装
1.添加包
在您的Backstage monorepo中:
yarn workspace backend add @julianpedro/plugin-dev-ai-hub-backend
yarn workspace app add @julianpedro/plugin-dev-ai-hub
2.注册后端插件
在 packages/backend/src/index.ts:
backend.add(import('@julianpedro/plugin-dev-ai-hub-backend'));
3.注册前端插件
新前端系统(NFS)
在 packages/app/src/App.tsx:
import { devAiHubPlugin } from '@julianpedro/plugin-dev-ai-hub';
const app = createApp({
features: [
// ...existing features
devAiHubPlugin,
],
});
侧边栏项目是自动注册的,不需要额外的配置。
传统前端系统
在 packages/app/src/App.tsx,在内部添加路线 <FlatRoutes>:
import { DevAiHubPage } from '@julianpedro/plugin-dev-ai-hub';
// inside <FlatRoutes>:
<Route path="/dev-ai-hub" element={<DevAiHubPage />} />
在 packages/app/src/components/Root/Root.tsx,添加侧边栏项:
import HubIcon from '@mui/icons-material/Hub';
// inside <SidebarGroup>:
<SidebarItem icon={HubIcon} to="dev-ai-hub" text="AI Hub" />
4.配置 app-config.yaml
devAiHub:
providers:
- id: "main-ai-assets"
type: "github" # github | gitlab | bitbucket | azure-devops | git
target: "https://github.com/your-org/ai-assets.git"
branch: "main"
schedule:
frequency:
minutes: 30
timeout:
minutes: 5
# Required: Git integration for reading repositories
integrations:
github:
- host: github.com
token: ${GITHUB_TOKEN}
看 app-config.example.yaml 更多提供者示例(GitLab、Bitbucket、过滤器)。
资产格式
每个AI资产都是存储库中具有相同基本名称的两个文件:
agents/
product-manager.yaml ← metadata envelope
product-manager.md ← pure markdown content (never modified by the plugin)
instructions/
security-guidelines.yaml
security-guidelines.md
skills/
code-review/
code-review.yaml
SKILL.md
workflows/
pr-review.yaml
pr-review.md
YAML信封(<name>.yaml)
name: product-manager-agent
label: Product Manager Agent
description: AI agent specialized in product management tasks
type: agent # instruction | agent | skill | workflow
tools:
- github-copilot
tags:
- product
- planning
author: Your Name
version: 1.0.0
# Optional: override install path per tool
# installPath: ".claude/agents/product-manager.md"
# installPaths:
# claude-code: ".claude/agents/product-manager.md"
# github-copilot: ".github/agents/product-manager.agent.md"
如果 content 如果省略,解析器将查找 <same-name>.md 在同一个目录中。对于技能,默认为 SKILL.md.
使用 tools: [all] 对于每个工具都应该出现的工具无关资产。
有关YAML信封字段的更多信息,请参见 YAML信封引用.
您可以使用示例文件夹中的资产来了解如何在项目中使用资产,或将其作为您自己资产的基础。
默认安装路径(按工具自动解析)
| 类型 | 工具 | 默认路径 |
|---|---|---|
instruction |
claude-code |
.claude/rules/<name>.md |
instruction |
github-copilot |
.github/instructions/<name>.instructions.md |
instruction |
google-gemini |
GEMINI.md |
instruction |
cursor |
.cursor/rules/<name>.mdc |
agent |
claude-code |
.claude/agents/<name>.md |
agent |
github-copilot |
.github/agents/<name>.agent.md |
skill |
claude-code |
.claude/skills/<name>/SKILL.md |
skill |
cursor |
.cursor/skills/<name>/SKILL.md |
workflow |
claude-code |
.claude/workflows/<name>.md |
workflow |
github-copilot |
.github/workflows/<name>.workflow.md |
MCP服务器
MCP服务器运行 嵌入 在Backstage后端——不需要单独的进程。它使用StreamableHTTP传输。
网址: http://<backstage-host>:7007/api/dev-ai-hub/mcp
这 ?tool= 查询参数过滤AI工具接收的资产。忽略它以接收所有资产。
这 ?provider= 查询参数过滤AI工具接收的资产。忽略它以接收所有资产。
这 ?proactive=true 查询参数启用主动模式。此模式用于在需要时自动向AI工具提供资产。
克劳德代码
在 .mcp.json 或 ~/.claude/mcp.json:
{
"mcpServers": {
"dev-ai-hub": {
"type": "http",
"url": "http://<backstage-host>:7007/api/dev-ai-hub/mcp?tool=claude-code"
}
}
}
GitHub副本(VS代码)
在 .vscode/settings.json 或VS Code用户设置:
{
"github.copilot.chat.mcp.servers": {
"dev-ai-hub": {
"type": "http",
"url": "http://<backstage-host>:7007/api/dev-ai-hub/mcp?tool=github-copilot"
}
}
}
谷歌Gemini CLI
在 ~/.gemini/settings.json:
{
"mcpServers": {
"dev-ai-hub": {
"type": "http",
"url": "http://<backstage-host>:7007/api/dev-ai-hub/mcp?tool=google-gemini"
}
}
}
光标
在 .cursor/mcp.json:
{
"mcpServers": {
"dev-ai-hub": {
"type": "http",
"url": "http://<backstage-host>:7007/api/dev-ai-hub/mcp?tool=cursor"
}
}
}
可用的MCP工具
| 工具 | 说明 |
|---|---|
list_assets |
列出资产,可选择按类型筛选。支持分页 |
search_assets |
在名称、描述和内容之间进行全文搜索。支持类型和标签过滤器 |
get_asset |
通过精确的ID或部分名称匹配获取完整的元数据和降价内容 |
install_asset |
返回活动工具的内容+推荐安装路径;模型写入文件。递增安装计数器 |
get_popular |
返回安装最多的资产,可选择按类型筛选 |
list_providers |
列出所有已配置的存储库及其同步状态、资产计数和上次同步时间 |
suggest_assets ⚡ |
根据项目背景描述主动建议资产。仅在何时可用?主动=真 |
可用的MCP提示
| 提示 | 描述 |
|---|---|
check_for_assets ⚡ |
指示模型使用当前任务上下文调用suggest_assets,并在开始工作之前提供安装相关资产。仅在以下情况下可用?主动=真 |
⚡ 仅主动-仅在MCP URL包含时注册?主动=真。
聊天中的使用示例:
“列出Dev AI Hub中可用的代理” “在中心搜索代码审查资产” “在此项目中安装Product Manager代理”
MCP目录
这 MCP目录 允许您通过Dev AI Hub UI公开第三方MCP服务器的精选列表,并使用VSCode和Cursor的一键安装按钮。目录在 mcp-catalog.yaml 文件在 提供者存储库的根目录 --持有你的人工智能资产的同一个回购。由资产调度程序自动同步;更新它不需要后台部署。
mcp-catalog.yaml 格式
servers:
# HTTP servers — support one-click install in VSCode and Cursor
- id: jira
name: "Jira MCP"
description: "Search issues, manage sprints, and query Jira projects."
icon: "https://example.com/jira-icon.png"
type: http
url: "https://mcp.atlassian.com/jira"
- id: figma
name: "Figma MCP"
description: "Access Figma designs and components from your AI tool."
type: http
url: "https://www.figma.com/api/mcp"
- id: github
name: "GitHub MCP"
description: "Interact with GitHub repositories, issues, and pull requests."
type: http
url: "https://api.githubcopilot.com/mcp/"
# stdio servers — displayed in the catalog with manual config snippet only
- id: filesystem
name: "Filesystem MCP"
description: "Read and write files on the local filesystem."
type: stdio
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
不
app-config.yaml需要更改。 目录是由repo驱动的--commitmcp-catalog.yaml到您的资产存储库,它将在下次同步时出现在中心。
REST API
GET /api/dev-ai-hub/assets List assets (filters: type, tool, tags, search, provider, page, pageSize)
GET /api/dev-ai-hub/assets/:id Asset detail
GET /api/dev-ai-hub/assets/:id/raw Pure markdown content
GET /api/dev-ai-hub/assets/:id/download Download as .md or .zip (skills)
POST /api/dev-ai-hub/assets/:id/track-install Increment install counter
GET /api/dev-ai-hub/providers List configured providers with sync status
POST /api/dev-ai-hub/providers/:id/sync Trigger manual sync
GET /api/dev-ai-hub/stats Totals by type, tool, and provider
POST /api/dev-ai-hub/mcp Initialize MCP session or handle existing
GET /api/dev-ai-hub/mcp SSE stream for server-to-client notifications
DELETE /api/dev-ai-hub/mcp Terminate MCP session
封装结构
| 包 | 角色 | 描述 |
|---|---|---|
@julianpedro/plugin-dev-ai-hub |
frontend-plugin |
React UI——页面、卡片、过滤器、安装对话框 |
@julianpedro/plugin-dev-ai-hub-backend |
backend-plugin |
同步服务、REST API、嵌入式MCP服务器 |
@julianpedro/plugin-dev-ai-hub-common |
common-library |
共享TypeScript类型、Zod模式、安装路径约定 |
@julianpedro/plugin-dev-ai-hub-node |
node-library |
外部提供程序模块的扩展点 |
许可证
阿帕奇-2.0