Token导航 LogoToken导航TokenDH.com
Port Hackathon logo
开发工具stdio官方级别未说明来源级核验

Port Hackathon

MCP Server

Port MCP 服务器是一个用于与 Port 软件目录 API 交互的模型上下文协议服务器,支持 GitHub Copilot 和其他 MCP 客户端查询和交互 Port 实体。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
PythonClaudeAPI集成Claude DesktopClaude

安装说明

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

作者 / 组织

manan-smarsh

提供方

manan-smarsh

最后核验

2026/5/17 20:22

快速接入

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

命令预览

pip install -r requirements.txt

详细介绍

端口MCP服务器

模型上下文协议(MCP)服务器,用于与端口的软件目录API交互。这使GitHub Copilot和其他MCP客户端能够查询您的端口实体并与之交互。

特性

此MCP服务器提供以下工具:

1. get_entity

通过蓝图和实体标识符从Port获取特定实体。

使用案例: 检索有关特定服务、产品或任何其他实体的详细信息。

参数:

  • blueprint_identifier (必填):蓝图类型(例如“服务”、“产品”)
  • entity_identifier (必填):实体的唯一标识符
  • exclude_calculated_properties (可选):从响应中排除计算属性

2. search_entities

使用Port强大的查询规则搜索实体。

使用案例: 根据特定条件、属性或关系查找实体。

参数:

  • rules (必需):包含属性、运算符和值的搜索规则数组
  • combinator (可选):如何组合规则-“和”或“或”(默认值:“和”)
  • exclude_calculated_properties (可选):从响应中排除计算属性

示例规则:

[
  {
    "property": "$blueprint",
    "operator": "=",
    "value": "service"
  },
  {
    "property": "environment",
    "operator": "=",
    "value": "production"
  }
]

3. find_product_for_service

帮助工具,用于查找服务所属的产品实体。

使用案例: 当你有一项服务并想知道它是什么产品的一部分时。

参数:

  • service_identifier (必填):服务实体的标识符

退货: 服务实体及其相关产品实体。

4. find_services_for_product

帮助工具,用于查找属于特定产品的所有服务实体。

使用案例: 当您想查看组成产品的所有服务/应用程序时。

参数:

  • product_identifier (必填):产品实体的标识符

退货: 与产品相关的所有服务实体。

设置

1.安装依赖项

pip install -r requirements.txt

2.设置环境变量

您需要端口API凭据才能使用此服务器。从您的端口组织设置中获取它们。

export PORT_CLIENT_ID="your-client-id"
export PORT_CLIENT_SECRET="your-client-secret"

3.在GitHub Copilot中配置MCP

将此服务器添加到MCP配置文件中。位置取决于您的设置:

对于VS代码: 编辑 ~/Library/Application Support/Code/User/mcp.json (macOS)或您操作系统上的同等版本。

添加以下配置:

{
  "mcpServers": {
    "port": {
      "command": "python3",
      "args": [
        "/path/to/port-er/port_mcp_server.py"
      ],
      "env": {
        "PORT_CLIENT_ID": "your-client-id",
        "PORT_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

对于Claude Desktop: 编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "port": {
      "command": "python3",
      "args": [
        "/path/to/port-er/port_mcp_server.py"
      ],
      "env": {
        "PORT_CLIENT_ID": "your-client-id",
        "PORT_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

4.使脚本可执行(可选)

chmod +x port_mcp_server.py

5.测试服务器

您可以直接测试服务器:

export PORT_CLIENT_ID="your-client-id"
export PORT_CLIENT_SECRET="your-client-secret"
python3 port_mcp_server.py

然后通过stdin发送JSON-RPC请求:

{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}

使用示例

配置后,您可以在GitHub Copilot中使用自然语言:

示例1:为服务查找产品

"What product does the service 'auth-service' belong to?"

助理将使用 find_product_for_service 随着 service_identifier: "auth-service".

示例2:列出产品中的所有服务

"Show me all services that are part of the 'payments-platform' product"

助理将使用 find_services_for_product 随着 product_identifier: "payments-platform".

示例3:获取服务详细信息

"Get the details of the service 'user-api'"

助理将使用 get_entity 随着 blueprint_identifier: "service"entity_identifier: "user-api".

示例4:搜索生产服务

"Find all services running in production environment"

助理将使用 search_entities 有适当的规则。

常见用例

1.查找服务所有权

获取服务实体以查看其所有者、团队和存储库信息:

"Who owns the 'checkout-service'?"

2.产品发现

查找服务所属的产品并获取产品级别信息:

"What product is 'payment-gateway' part of, and who are the product stakeholders?"

3.服务库存

列出产品的所有服务,以了解其架构:

"List all microservices in the 'e-commerce' product"

4.存储库映射

查找与服务关联的GitHub存储库:

"What's the repository URL for 'notification-service'?"

定制

调整关系名称

辅助工具(find_product_for_servicefind_services_for_product)假定某些关系属性名称。您可能需要根据端口配置调整这些参数:

port_mcp_server.py,查找:

for rel_key in ["product", "parentProduct", "belongsToProduct"]:

更新此列表以匹配您的实际关系属性名称。

添加更多辅助工具

您可以按照以下模式添加其他辅助工具:

  1. 创建一个处理函数(例如。, handle_your_tool)
  2. 将其添加到中的工具列表 tools/list 响应
  3. 在中添加一个案例 tools/call 处理器

故障排除

身份验证问题

  • 验证您的 PORT_CLIENT_IDPORT_CLIENT_SECRET 是正确的
  • 检查您的端口凭据是否具有必要的权限

未找到实体

  • 验证蓝图标识符是否与您的端口配置匹配
  • 检查实体标识符是否存在于端口目录中

未找到关系属性

  • 端口设置中的关系属性名称可能不同
  • 检查端口蓝图配置中的实际关系属性名称

api参考

使用的端口API端点

  • POST /v1/auth/access_token -身份验证
  • GET /v1/blueprints/{blueprint}/entities/{entity} -获取实体
  • POST /v1/entities/search -搜索实体

有关更多详细信息,请参阅:

许可证

麻省理工学院

目录标签

目录标签

PythonClaudeAPI集成软件目录交互本地部署MCP协议GitHubCopilot集成实体查询

支持客户端

Claude DesktopClaude

接入字段

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

stdio

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

none

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdionone部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP