Python sdk support mcp server auto register to nacos
Project description
nacos-mcp-wrapper-python
Nacos mcp wrapper Python sdk
How to use:
- Install:
pip install nacos-mcp-wrapper-python
- 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>"
mcp = NacosMCP(nacos_settings, "nacos-mcp-python")
# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
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>"
app = NacosServer(nacos_settings,"mcp-website-fetcher")
For more examples, please refer to the content under the example directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nacos-mcp-wrapper-python-0.1.1.tar.gz.
File metadata
- Download URL: nacos-mcp-wrapper-python-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a888c172b91984a59c75c9dcd8b2009292a32870cd80a70dbed2ab8c6387560a
|
|
| MD5 |
40931633ddaf0d0b52899d6caf90be66
|
|
| BLAKE2b-256 |
96ab0a0894f908e49ca99cc48aded8b5ac506d190220d6ce9235988741685ecb
|
File details
Details for the file nacos_mcp_wrapper_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nacos_mcp_wrapper_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55ef23924883bd749cf3ee46147945b9f8d17d5464499faa4f14bf046dac9aa1
|
|
| MD5 |
0b02add7c63753140be8ba95d0a8ea5f
|
|
| BLAKE2b-256 |
56ed96edb86fd5a08387fe6dae471765a7a0dc52edb40ea7a8a2739f99d878e4
|