存量接口升级MCP协议

mtain 2025年04月14日 43次浏览

说明

Nacos 发布 MCP Registry,实现存量应用接口“0改动”升级到 MCP 协议
https://nacos.io/blog/nacos-gvr7dx_awbbpb_vksfvdh9258pgddl/

实现方式:通过nacos的配置将nacos中的服务映射到网关Higress上

实测需要有以下注意事项:

1.kind安装单节点k8s,注意映射80、443端口

# cluster.conf
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# networking:
  # WARNING: It is _strongly_ recommended that you keep this the default
  # (127.0.0.1) for security reasons. However it is possible to change this.
  # apiServerAddress: "0.0.0.0"
  # By default the API server listens on a random open port.
  # You may choose a specific port but probably don't need to in most cases.
  # Using a random port makes it easier to spin up multiple clusters.
  # apiServerPort: 6443
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
  1. 安装过程中的一些操作命令
sudo kind create cluster --name k8s --config=cluster.conf
sudo kubectl cluster-info --context kind-k8s

sudo kind delete cluster --name k8s

sudo hgctl install --set profile=local-k8s

sudo hgctl uninstall --purge-resources


sudo kubectl -n higress-system get all
sudo kubectl -n higress-system get configmap
sudo kubectl -n higress-system edit cm higress-config

sudo kubectl -n higress-system logs -f pod/higress-gateway-cc684c85b-bxhq4

# 启动Higress的web控制台
sudo  hgctl dashboard console

  1. nacos服务中“服务名、分组名称”需要和配置中“分组名称”一致