Skip to main content

Python sdk support mcp server auto register to nacos

Project description

nacos-mcp-wrapper-python

Nacos-mcp-wrapper-python helps you quickly register your Mcp Server on Nacos. By using Nacos to host your Mcp Server, it supports dynamic modifications of the descriptions for Mcp Server Tools and their corresponding parameters, assisting in the rapid evolution of your Mcp Server.

How to use:

python >=3.10

  1. Install:
pip install nacos-mcp-wrapper-python
  1. Use

Before use nacos-mcp-wrapper-python,

# server.py
from mcp.server.fastmcp import FastMCP

# Create an MCP server
mcp = FastMCP("Demo")


# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b

Replace the FashMCP with NacosMCP to register your mcp server to nacos

# server.py
from nacos_mcp_wrapper.server.nacos_mcp import NacosMCP
from nacos_mcp_wrapper.server.nacos_settings import NacosSettings

# Create an MCP server
# mcp = FastMCP("Demo")
nacos_settings = NacosSettings()
nacos_settings.SERVER_ADDR = "<nacos_server_addr> e.g.127.0.0.1:8848"
mcp = NacosMCP("nacos-mcp-python",nacos_settings=nacos_settings)


# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b

mcp.run(transport="sse")

After registering to Nacos, you can dynamically update the descriptions of Tools and the descriptions of parameters in the Mcp Server on Nacos without restarting your Mcp Server.

You can also replace the Server with NacosServer:

from mcp.server import Server
app = Server("mcp-website-fetcher")

change to NacosServer:

from nacos_mcp_wrapper.server.nacos_server import NacosServer
from nacos_mcp_wrapper.server.nacos_settings import NacosSettings

nacos_settings = NacosSettings()
nacos_settings.SERVER_ADDR = "<nacos_server_addr> e.g.127.0.0.1:8848"
app = NacosServer("mcp-website-fetcher",nacos_settings=nacos_settings)

For more examples, please refer to the content under the example directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nacos-mcp-wrapper-python-0.2.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nacos_mcp_wrapper_python-0.2.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file nacos-mcp-wrapper-python-0.2.1.tar.gz.

File metadata

  • Download URL: nacos-mcp-wrapper-python-0.2.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for nacos-mcp-wrapper-python-0.2.1.tar.gz
Algorithm Hash digest
SHA256 90917b5020a05ab1625e3bacb0a505295159b0e3c931d42fde406958d2dd872d
MD5 bfba19d07bb62e13febf86c13ec2f361
BLAKE2b-256 57094eee79c431a63f90bed385e59125d6be21952dca098b67832d16c8dc37ca

See more details on using hashes here.

File details

Details for the file nacos_mcp_wrapper_python-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nacos_mcp_wrapper_python-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 679859466459c1bda9282c2fe8f42a19450778ac14391d87c0cc9bdf165fa1e8
MD5 a6532f130e03807a312c2080a9f0327d
BLAKE2b-256 4863b01646f61eb50424a1deefcbb26c1af6b7a5f8dab8de317cd3f7dee9a966

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page