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.3.0.tar.gz (11.1 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.3.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nacos-mcp-wrapper-python-0.3.0.tar.gz
  • Upload date:
  • Size: 11.1 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.3.0.tar.gz
Algorithm Hash digest
SHA256 5c0ba2e2196a9af84a38e3a2ce0a6d5d4cce47755ef7de28bd91041eee679b3c
MD5 1e929dceea3616fcd96cf31febb66bd9
BLAKE2b-256 e7e90dcc712e96cd6e0a3db289761bf764d6ac1c6976ef92ea785ab48d9be4f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nacos_mcp_wrapper_python-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 541685f093506af993e4e925525cfc98451bf4dd94d5a11ae8b0d52e6cfdf8fd
MD5 c0e80702f72ae774ccdf2cb2d563100c
BLAKE2b-256 c09c0ac03143eff930f8e818fe2942a0781f458b888735407e5c7f5c3c143b97

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