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.0.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.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nacos-mcp-wrapper-python-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 29dab77553dd60be739d4d905342d6f45b0b5a9c3fbc0d378fb237fbe5d1a89a
MD5 8a2ad914c5c90a01f4feca89d2ae1ce2
BLAKE2b-256 58db1e3d1c01b5c1a06561b5255c7c51837db0b9f5d7083dd3d0703573de4fbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nacos_mcp_wrapper_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47dacf204c9fee13ec238da017a7b3bfc836b8f28ddfd44d0c41a118aca71234
MD5 9767d8fc323273626921aa092758e3cb
BLAKE2b-256 6af12b4d47765cbbdf7c913d5b4d10c684865519f496543662d0c570392ee83b

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