mcpzoo-random-string 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcpzoo-random-string
3
+ Version: 0.1.0
4
+ Summary: MCP tool: 生成指定长度和字符集的随机字符串
5
+ License: MIT
6
+ Keywords: claude,mcp,mcpzoo,random-string,uvx
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: mcp>=1.0.0
9
+ Description-Content-Type: text/markdown
10
+
11
+ # mcpzoo-random-string
12
+
13
+ > 随机字符串 — 生成指定长度和字符集的随机字符串
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ uvx mcpzoo-random-string
19
+ ```
20
+
21
+ ## uvx JSON
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "random-string": {
27
+ "args": ["mcpzoo-random-string"],
28
+ "command": "uvx"
29
+ }
30
+ }
31
+ }
32
+ ```
@@ -0,0 +1,22 @@
1
+ # mcpzoo-random-string
2
+
3
+ > 随机字符串 — 生成指定长度和字符集的随机字符串
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uvx mcpzoo-random-string
9
+ ```
10
+
11
+ ## uvx JSON
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "random-string": {
17
+ "args": ["mcpzoo-random-string"],
18
+ "command": "uvx"
19
+ }
20
+ }
21
+ }
22
+ ```
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mcpzoo-random-string"
7
+ version = "0.1.0"
8
+ description = "MCP tool: 生成指定长度和字符集的随机字符串"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "MIT" }
12
+ keywords = ["mcp", "random-string", "uvx", "claude", "mcpzoo"]
13
+ dependencies = [
14
+ "mcp>=1.0.0",
15
+ ]
16
+
17
+ [project.scripts]
18
+ mcpzoo-random-string = "mcpzoo_random_string.server:main"
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,39 @@
1
+ import random
2
+ import string
3
+ from mcp.server.fastmcp import FastMCP
4
+
5
+ mcp = FastMCP("random-string")
6
+
7
+
8
+ @mcp.tool()
9
+ def gen_random_string(length: int = 16, charset: str = "alphanumeric") -> str:
10
+ """生成指定长度和字符集的随机字符串。
11
+
12
+ charset可选: alphanumeric, alpha, numeric, hex, all
13
+ """
14
+ if length < 1 or length > 10000:
15
+ return "长度需要在 1-10000 之间"
16
+
17
+ if charset == "alphanumeric":
18
+ chars = string.ascii_letters + string.digits
19
+ elif charset == "alpha":
20
+ chars = string.ascii_letters
21
+ elif charset == "numeric":
22
+ chars = string.digits
23
+ elif charset == "hex":
24
+ chars = string.hexdigits.lower()
25
+ elif charset == "all":
26
+ chars = string.ascii_letters + string.digits + string.punctuation
27
+ else:
28
+ # 允许传入自定义字符集
29
+ chars = charset
30
+
31
+ return "".join(random.choice(chars) for _ in range(length))
32
+
33
+
34
+ def main():
35
+ mcp.run()
36
+
37
+
38
+ if __name__ == "__main__":
39
+ main()