Token导航 LogoToken导航TokenDH.com
Random Number Server logo
地图位置stdio官方级别未说明来源级核验

Random Number Server

MCP Server

一个使用国家天气数据作为种子生成随机数的MCP服务器。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
位置天气PythonClaudeToken认证Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

nobelk

提供方

nobelk

最后核验

2026/5/17 20:19

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run src/random_server.py

详细介绍

随机数服务器

![CI](https://github.com/nobelk/random-number-server/actions/workflows/ci.yml) ![codecov](https://codecov.io/gh/nobelk/random-number-server) ![Python 3.13+](https://www.python.org/downloads/) ![License](LICENSE)

MCP服务器使用国家天气数据作为种子生成随机数。

构建说明

地方发展建设

# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/nobelk/random-number-server.git
cd random-number-server

# Install dependencies and build the project
uv sync

# Install in editable mode for development
uv pip install -e .

Docker构建

# Build the Docker image
docker build -t random-number-server:latest .

# Or use Docker Compose to build
docker-compose build

快速开始

使用Docker Compose(推荐)

# Build and run the server
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the server
docker-compose down

直接使用uv

# Install dependencies
uv sync

# Run the server
uv run src/random_server.py

单元测试

该项目包括对两个核心模块进行全面的单元测试,代码覆盖率为86%。

运行测试

# Install dependencies
uv sync

# Run all tests
uv run pytest

# Run tests with verbose output
uv run pytest -v

# Run tests with coverage report
uv run pytest --cov=src --cov-report=term-missing

# Run specific test files
uv run pytest tests/test_random_number_generator.py
uv run pytest tests/test_random_server.py

测试覆盖率

  • src/RandomNumberGenerator.py:83%的覆盖率(13次测试)
  • src/random_server.py:92%的覆盖率(17次测试)
  • 总计:86%的覆盖率(30次测试)

测试包括:

  • 初始化及配置
  • 随机数生成算法
  • 天气API集成
  • 错误处理和边缘情况
  • FastMCP工具注册和执行
  • 并发请求处理

Docker设置

该项目包括Docker和Docker Compose配置,便于部署。

Docker镜像

  • 基地: Python 3.13 Alpine(针对大小进行了优化)
  • 尺寸: ~110MB
  • 安全: 以非root用户身份运行
  • 构建: 多阶段构建以实现优化

Docker Compose

# Production
docker-compose up -d

# Development (with live reload)
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

# Run tests in container
docker-compose run --rm --entrypoint /app/.venv/bin/python random-server -m pytest

看 了解详细的Docker说明。

MCP配置

在本地运行MCP服务器

uv --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/random-number-server run src/random_server.py

配置Claude桌面

编辑 ~/Library/Application\ Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "command": "/Users/Nobel.Khandaker/.pyenv/shims/uv",
      "args": [
        "--directory",
        "/Users/Nobel.Khandaker/sources/random-number-server",
        "run",
        "src/random_server.py"
      ]
    }
  }
}

目录标签

目录标签

位置天气PythonClaudeToken认证随机数生成本地部署天气数据MCP服务器

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Python

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotokenremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP