MCP ExplorerExplorer

Spring Ai Mcp Nacos

@zhangtushengon a month ago
1 MIT
FreeCommunity
AI Systems
# Spring AI with Nacos for Automatic MCP Registration Spring AI integrates with Nacos to achieve automatic registration of MCP (Microservice Control Plane).

Overview

What is Spring Ai Mcp Nacos

spring-ai-mcp-nacos is a project that integrates Spring AI with Nacos to facilitate automatic registration of MCP services.

Use cases

Use cases for spring-ai-mcp-nacos include deploying scalable microservices that need to register themselves with a service registry, enabling seamless communication between services, and managing service configurations dynamically.

How to use

To use spring-ai-mcp-nacos, first install Nacos via Docker by pulling the Nacos server image and running it with the specified environment variables. Then, configure your Spring application with the necessary properties for MCP and Nacos, including server address, namespace, and authentication details.

Key features

Key features of spring-ai-mcp-nacos include automatic service registration, integration with Nacos for service discovery, and support for synchronous message handling.

Where to use

spring-ai-mcp-nacos can be used in microservices architectures, cloud-native applications, and any environment that requires dynamic service registration and discovery.

Content

spring-ai-mcp-nacos

1. 安装nacos:

docker 安装nacos:

  1. docker pull nacos/nacos-server:v3.0.0

  2. 然后执行:
    docker run --name nacos-standalone-derby
    -e MODE=standalone
    -e NACOS_AUTH_TOKEN=c2stMDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg=
    -e NACOS_AUTH_IDENTITY_KEY=nacos_server
    -e NACOS_AUTH_IDENTITY_VALUE=nacos_2025
    -p 8080:8080
    -p 8848:8848
    -p 9848:9848
    -d nacos/nacos-server:v3.0.0

    备注:NACOS_AUTH_TOKEN:是要用来解密的密钥。相关的可以看:https://nacos.io/en/docs/v3.0/quickstart/quick-start-docker/

2. 项目配置

spring:
  ai:
    mcp:
      server:
        name: spring-ai-alibaba-demo
        version: 1.0.0
        type: SYNC
        sse-message-endpoint: /spring-ai-alibaba-demo/message
    alibaba:
      mcp:
        nacos:
          enabled: true
          server-addr: 127.0.0.1:8848  # Nacos 地址
          service-namespace: public    # Nacos 命名空间 ID
          service-group: DEFAULT_GROUP
          username: nacos  # nacos用户
          password: nacos  # nacos密码

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers