Random.org MCP Server
A Model Context Protocol server that provides access to api.random.org for generating true random numbers, strings, UUIDs, and more.
README
Random.org MCP Server
A Model Context Protocol (MCP) server that provides access to the api.random.org service for generating true random numbers, strings, UUIDs, and more.
Features
This MCP server provides the following tools:
- generateIntegers - Generate true random integers within a specified range
- generateIntegerSequences - Generate sequences of true random integers
- generateDecimalFractions - Generate random decimal fractions between 0 and 1
- generateGaussians - Generate random numbers from a Gaussian distribution
- generateStrings - Generate random strings from specified characters
- generateUUIDs - Generate true random UUIDs (version 4)
- generateBlobs - Generate random binary data in base64 or hex format
- getUsage - Get API usage statistics
Installation & Deployment
🚀 Quick Start with npm (Recommended)
Method 1: Global Installation
# Install globally
npm install -g random-org-mcp-server
# Verify installation
random-org-mcp --version
Method 2: Use without Installation
# Run directly with npx (no installation required)
npx random-org-mcp-server
Method 3: Local Project Installation
# Install in your project
npm install random-org-mcp-server
# Run from node_modules
npx random-org-mcp-server
🛠️ Build from Source
- Clone this repository:
git clone https://github.com/QianJue-CN/TRUERandomMCP.git
cd TRUERandomMCP
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
🔑 Get API Key
- Visit api.random.org to get a free API key
- Register and obtain your API key
⚙️ Configuration Methods
Method 1: Environment Variables (Recommended)
Create a .env file in your working directory:
# Copy example file (if building from source)
cp .env.example .env
Edit .env file:
RANDOM_ORG_API_KEY=your_api_key_here
RATE_LIMIT_REQUESTS_PER_SECOND=1
RATE_LIMIT_BURST_SIZE=5
REQUEST_TIMEOUT_MS=10000
MAX_RETRIES=3
RETRY_DELAY_MS=1000
Method 2: MCP Client Configuration
Configure directly in your MCP client (e.g., Claude Desktop):
{
"mcpServers": {
"random-org": {
"command": "npx",
"args": ["random-org-mcp-server"],
"env": {
"RANDOM_ORG_API_KEY": "your_api_key_here"
}
}
}
}
Environment Variables
RANDOM_ORG_API_KEY(required) - Your api.random.org API keyRATE_LIMIT_REQUESTS_PER_SECOND(optional, default: 1) - Rate limitingRATE_LIMIT_BURST_SIZE(optional, default: 5) - Burst size for rate limitingREQUEST_TIMEOUT_MS(optional, default: 10000) - Request timeout in millisecondsMAX_RETRIES(optional, default: 3) - Maximum number of retriesRETRY_DELAY_MS(optional, default: 1000) - Delay between retries
Usage
🔗 MCP Client Integration
Claude Desktop Configuration
-
Locate your Claude Desktop configuration file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Windows:
-
Add the Random.org MCP server configuration:
{
"mcpServers": {
"random-org": {
"command": "npx",
"args": ["random-org-mcp-server"],
"env": {
"RANDOM_ORG_API_KEY": "your_api_key_here"
}
}
}
}
- Restart Claude Desktop
Alternative Configurations
Using Global Installation
{
"mcpServers": {
"random-org": {
"command": "random-org-mcp",
"env": {
"RANDOM_ORG_API_KEY": "your_api_key_here"
}
}
}
}
Using Local Installation
{
"mcpServers": {
"random-org": {
"command": "node",
"args": ["node_modules/random-org-mcp-server/dist/index.js"],
"env": {
"RANDOM_ORG_API_KEY": "your_api_key_here"
}
}
}
}
Running the Server
🚀 Production Usage
If installed globally:
random-org-mcp
Using npx (no installation required):
npx random-org-mcp-server
From source:
npm start
🛠️ Development
For development with auto-reload:
npm run dev
Tool Examples
Generate Random Integers
{
"name": "generateIntegers",
"arguments": {
"n": 5,
"min": 1,
"max": 100,
"replacement": true,
"base": 10
}
}
Generate Random Strings
{
"name": "generateStrings",
"arguments": {
"n": 3,
"length": 8,
"characters": "abcdefghijklmnopqrstuvwxyz0123456789",
"replacement": true
}
}
Generate UUIDs
{
"name": "generateUUIDs",
"arguments": {
"n": 5
}
}
Generate Gaussian Numbers
{
"name": "generateGaussians",
"arguments": {
"n": 10,
"mean": 0,
"standardDeviation": 1,
"significantDigits": 6
}
}
Get Usage Statistics
{
"name": "getUsage",
"arguments": {}
}
API Limits
The api.random.org service has the following limits:
- Integers: 1-10,000 numbers per request
- Integer Sequences: 1-10,000 sequences, each 1-10,000 numbers long
- Decimal Fractions: 1-10,000 numbers per request
- Gaussians: 1-10,000 numbers per request
- Strings: 1-10,000 strings per request, each 1-20 characters long
- UUIDs: 1-1,000 UUIDs per request
- Blobs: 1-100 blobs per request, each 1-1,048,576 bytes
Error Handling
The server includes comprehensive error handling:
- Input validation for all parameters
- Rate limiting to respect API limits
- Automatic retries with exponential backoff
- Detailed error messages for troubleshooting
Development
Scripts
npm run build- Build the TypeScript codenpm start- Run the compiled servernpm run dev- Run in development mode with auto-reloadnpm run clean- Clean the build directory
Project Structure
src/
├── index.ts # Main entry point
├── server.ts # MCP server implementation
├── randomOrgClient.ts # API client for random.org
├── rateLimiter.ts # Rate limiting implementation
├── config.ts # Configuration management
└── types.ts # TypeScript type definitions
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
For issues related to this MCP server, please open an issue on GitHub. For api.random.org API issues, please refer to their documentation.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。