Token导航 LogoToken导航TokenDH.com
Backstage MCP Server logo
运维云端未说明官方级别未说明来源级核验

Backstage MCP Server

MCP Server

一个生产就绪的企业级模型上下文协议(MCP)服务器,将 Backstage Catalog API 暴露为大型语言模型(LLM)的工具,具有全面的操作透明性、跨平台兼容性和自动错误恢复功能。

工具数

0

提示词数

0

GitHub Stars

2

资源数

0
TypeScript云端部署Docker

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Coderrob

提供方

Coderrob

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

后台MCP服务器

一个可用于生产的企业级模型上下文协议(MCP)服务器,它公开Backstage Catalog API作为大型语言模型(LLM)的工具。具有全面的操作透明度、跨平台兼容性和自动错误恢复功能。

这允许LLM通过具有企业级可靠性和监控的标准化协议与Backstage软件目录进行交互。

特性

  • 完整目录API覆盖范围:将所有主要Backstage Catalog API端点作为MCP工具实施
  • 动态工具加载:自动从代码库中发现和注册工具
  • 类型安全:通过Zod模式验证完全支持TypeScript
  • 生产就绪:通过适当的错误处理和日志记录实现可靠性
  • 企业级:具有运营透明度和监控的跨平台支持
  • 操作透明度:全面的审计跟踪、运行状况监控和自动错误恢复
  • 跨平台兼容性:在Windows、macOS和Linux上无缝工作
  • 高级构建系统:具有缩小和树抖动的双格式构建(ESM/CommonJS)

可用工具

实体管理

  • get_entity_by_ref -通过引用获取单个实体
  • get_entities -使用筛选器查询实体
  • get_entities_by_query -高级实体查询与订购
  • get_entities_by_refs -通过引用获取多个实体
  • get_entity_ancestors -获取实体祖先树
  • get_entity_facets -获取实体方面统计信息

位置管理

  • get_location_by_ref -通过引用获取位置
  • get_location_by_entity -获取与实体关联的位置
  • add_location -创建新位置
  • remove_location_by_id -删除位置

实体运营

  • refresh_entity -触发实体刷新
  • remove_entity_by_uid -按UID删除实体
  • validate_entity -验证实体结构

安装

先决条件

  • Node.js 18+
  • Yarn 4.4.0+(配置为packageManager)
  • 访问Backstage实例
  • 跨平台支持:Windows(含MSYS/Cygwin)、macOS或Linux

设置

  1. 克隆存储库:
   git clone https://github.com/Coderrob/backstage-mcp-server.git
   cd backstage-mcp-server
  1. 安装依赖项:
   yarn install
  1. 构建并验证项目:
   yarn build:validate

或者手动构建:

   yarn build
  1. (可选)运行依赖关系分析:
   yarn deps:analyze

配置

服务器需要Backstage API访问的环境变量:

所需的环境变量

  • BACKSTAGE_BASE_URL -Backstage实例的基本URL(例如。, https://backstage.example.com)

验证配置

选择以下身份验证方法之一:

  • BACKSTAGE_TOKEN -API访问的承载令牌
  • BACKSTAGE_CLIENT_ID, BACKSTAGE_CLIENT_SECRET, BACKSTAGE_TOKEN_URL -OAuth凭据
  • BACKSTAGE_API_KEY -API密钥验证
  • BACKSTAGE_SERVICE_ACCOUNT_KEY -服务帐户密钥

配置示例

export BACKSTAGE_BASE_URL=https://backstage.example.com
export BACKSTAGE_TOKEN=your-auth-token-here

用法

启动服务器

yarn start

服务器将启动并监听stdin/stdout上的MCP协议消息。

与MCP客户端集成

此服务器旨在与MCP兼容的客户端配合使用。配置您的MCP客户端以使用此服务器:

{
  "mcpServers": {
    "backstage": {
      "command": "node",
      "args": ["dist/index.js"],
      "env": {
        "BACKSTAGE_BASE_URL": "https://your-backstage-instance.com",
        "BACKSTAGE_TOKEN": "your-backstage-token"
      }
    }
  }
}

对于NPM发布后的全局安装:

{
  "mcpServers": {
    "backstage": {
      "command": "backstage-mcp-server",
      "env": {
        "BACKSTAGE_BASE_URL": "https://your-backstage-instance.com",
        "BACKSTAGE_TOKEN": "your-backstage-token"
      }
    }
  }
}

LLM使用示例

一旦连接,LLM就可以使用自然语言与Backstage进行交互:

User: "Show me all the services in the catalog"

LLM: Uses get_entities tool with appropriate filters

User: "What's the location for the user-service entity?"

LLM: Uses get_location_by_entity tool

api参考

刀具参数

所有工具都接受由其Zod模式定义的参数。实体参考可以提供为:

  • 字符串: "component:default/user-service"
  • 对象: { kind: "component", namespace: "default", name: "user-service" }

响应格式

所有工具都返回具有以下结构的JSON响应:

{
  "status": "success" | "error",
  "data": 
}

发展

项目结构

src/
├── api/           # Backstage API client
├── auth/          # Authentication and security
├── cache/         # Caching layer
├── decorators/    # Tool decorators
├── tools/         # MCP tool implementations
├── types/         # Type definitions and constants
├── utils/         # Utility functions
└── index.ts       # Main server entry point

scripts/
├── validate-build.sh    # Build validation with operational transparency
├── dependency-manager.sh # Dependency analysis with cross-platform support
├── deps-crossplatform.sh         # Cross-platform dependency operations
├── monitor.sh                    # System monitoring and health checks
└── deps.sh                       # Legacy dependency scripts

docs/
├── OPERATIONAL_TRANSPARENCY.md   # Operational transparency documentation
├── DEPENDENCY_GUIDE.md          # Dependency management guide
├── EDGE_CASES_SUMMARY.md        # Edge cases and cross-platform considerations
└── BUILD_SETUP.md               # Build system documentation

建筑

yarn build

构建系统使用Rollup为CommonJS和ESM格式创建优化的捆绑包:

  • dist/index.cjs -带有shebang的CommonJS捆绑包,用于CLI使用
  • dist/index.mjs -ESM捆绑包
  • dist/index.d.ts -TypeScript声明

构建功能

  • 双格式支持:生成CommonJS和ESM输出以实现最大兼容性
  • 最小化:所有输出都被缩小,以便与Terser一起用于生产
  • 源地图:包括用于调试的源代码映射
  • TypeScript声明:捆绑的.d.ts文件用于类型安全
  • 全球安装:CommonJS构建包括一个用于全局npm安装的shebang
  • 摇树优化:删除较小捆绑包大小的未使用代码
  • 跨平台构建:跨Windows、macOS和Linux的一致构建
  • 构建验证:具有操作透明度的自动验证
  • 错误恢复:生成失败时自动回滚

NPM出版

该包已配置为通过以下方式发布到NPM:

npm publish

发布后,可以全局安装服务器:

npm install -g @coderrob/backstage-mcp-server
backstage-mcp-server

运营透明度和企业特征

此MCP服务器包括全面的运营透明度和企业级功能:

监测和健康检查

  • 实时健康监测:持续的系统健康跟踪
  • 资源使用情况跟踪:内存、磁盘和CPU监控
  • SLA跟踪:服务水平协议监控和报告
  • 自动警报:可配置的紧急情况警报

构建和依赖管理

  • 跨平台兼容性:跨Windows、macOS和Linux的一致操作
  • 相关性分析:全面的依赖冲突检测和解决
  • 构建验证:具有回滚功能的自动构建验证
  • 审计跟踪:完成所有操作的审计日志记录

错误恢复和弹性

  • 网络弹性:网络操作的自动重试逻辑
  • 构建回滚:生成失败时自动回滚
  • 依赖性备份/恢复:依赖关系的备份和恢复功能
  • 结构化日志记录:具有完整上下文的JSON格式日志

使用示例

健康监测

# Check system health
yarn monitor:health

# View monitoring dashboard
yarn monitor:dashboard

# Check alerts
yarn monitor:alerts

依赖管理

# Analyze dependencies
yarn deps:analyze

# Validate dependency health
yarn deps:validate

# Cross-platform dependency operations
yarn deps:crossplatform

构建验证

# Comprehensive build validation
yarn build:validate

# Development build
yarn build:dev

# Watch mode
yarn build:watch

测试

yarn test

掉毛

yarn lint

添加新工具

  1. 在中创建新的工具文件 src/tools/
  2. 使用实现工具类 @Tool 装饰器
  3. 出口自 src/tools/index.ts
  4. 为参数定义Zod模式

例子:

@Tool({
  name: 'my_tool',
  description: 'Description of my tool',
  paramsSchema: z.object({ param: z.string() }),
})
export class MyTool {
  static async execute({ param }, context) {
    // Implementation
    return JsonToTextResponse({ status: 'success', data: result });
  }
}

贡献

我们欢迎捐款!请参阅我们的贡献指南,并确保所有更改都包括适当的测试。

  1. 分叉存储库
  2. 创建要素分支
  3. 通过全面测试进行更改
  4. 运行完整的验证套件: yarn build:validate && yarn deps:analyze
  5. 提交拉取请求

许可证

此项目根据GPLv3许可证获得许可-请参阅 许可证 文件以获取详细信息。

支持和文档

相关项目

import { Client } from '@modelcontextprotocol/sdk/client/index.js';

const client = new Client(
  {
    name: 'example-client',
    version: '1.0.0',
  },
  {
    capabilities: {},
  }
);

// Connect to the Backstage MCP server
await client.connect(new StdioServerTransport(process));

// List available tools
const tools = await client.request({ method: 'tools/list' });
console.log('Available tools:', tools);

// Call a tool
const result = await client.request({
  method: 'tools/call',
  params: {
    name: 'get_entity_by_ref',
    arguments: {
      entityRef: 'component:default/my-component',
    },
  },
});
console.log('Tool result:', result);

目录标签

目录标签

TypeScript云端部署Docker企业级服务本地部署大型语言模型工具Backstage集成跨平台兼容操作透明性

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

oauth

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明oauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP