Sponsored by Deepsite.site

Random Tables MCP Server

Created By
MikeORed6 months ago
MCP server for generating dynamic random tables for tabletop RPGs with nested templates and weighted probabilities
Content

Random Tables MCP Server

Need a drop‑in random‑table engine for your next one‑shot? MCP Random Tables has you covered.

An MCP (Model Context Protocol) server for managing and rolling on random-table assets used in tabletop RPGs, following a hexagonal architecture (ports & adapters) approach.

Project Overview

This section details the server’s core capabilities and architecture—how random‑table definitions are stored, rolled, and extended while ports & adapters keep concerns isolated and the codebase easy to test and maintain.

Features

  • Create random tables in seconds and keep them updated
  • Roll results instantly on any table
  • Link tables together with powerful template support
  • Define range‑based entries for dice‑driven tables
  • Weight entries to fine‑tune probabilities
  • Choose your access model – MCP Resources or Tools (see the Environment Variables section to toggle)

Available Tools

  • create_table - Create a new random table with optional initial entries
  • roll_on_table - Roll on a specific table and returns the result
  • update_table - Update an existing table (name, description, entries)
  • list_tables - List available tables with metadata
  • get_table - Get details of a specific table

See the Environment Variables section for how to switch between using Tools and Resources.

Available Resources

  • table://{tableId} - Access a specific table
  • tables:// - Access a list of all tables

Key Use Cases

  • RPG Encounter Generation: Generate random encounters for tabletop RPGs
  • Loot Generation: Create dynamic treasure and item drops
  • NPC Generation: Build complex NPCs with personality traits, equipment, and motivations
  • Story Prompt Generation: Generate creative writing prompts and plot hooks

Template System Example

Here’s how easy it is to chain tables together:

{
  "name": "Treasure",
  "description": "Random treasure found in dungeons",
  "entries": [
    {
      "content": "{{::currency}}",
      "weight": 3
    },
    {
      "content": "{{::items::Items::3}} worth {{::currency}}",
      "weight": 2
    }
  ]
}

When you roll on this table, the system automatically resolves templates by rolling on referenced tables. For example, {{::items::Items::3}} will roll 3 times on the "Items" table.

Requirements

  • Node.js (v20 or higher)
  • npm

Installation

Claude Desktop Integration

To integrate the MCP Random Tables server with Claude Desktop, you need to add the server configuration to your claude_desktop_config.json file.

Windows Configuration

Add this to your claude_desktop_config.json (located at %APPDATA%\\Claude\\claude_desktop_config.json):

{
  "mcpServers": {
    "random-tables": {
      "type": "stdio",
      "command": "node",
      "args": ["C:\\path\\to\\mcp-random-tables\\dist\\index.js"],
      "env": {
        "CAN_USE_RESOURCE": "false"
      }
    }
  }
}

Replace C:\\path\\to\\mcp-random-tables with the actual path to your local installation.

macOS Configuration

Add this to your claude_desktop_config.json (located at ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "random-tables": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/mcp-random-tables/dist/index.js"],
      "env": {
        "CAN_USE_RESOURCE": "false"
      }
    }
  }
}

Replace /path/to/mcp-random-tables with the actual path to your local installation.

NPX Configuration – 🚧 We’re hammering out the NPX package; stay tuned!

Note: The MCP Random Tables server is not yet published to npm. We plan to deploy it after test coverage is solid and we're comfortable with the functionality.

Manual Installation

# Clone the repository
git clone https://github.com/MikeORed/random-tables-mcp
cd mcp-random-tables

# Install dependencies
npm install

# Build the project
npm run build

Environment Variables

The server can be configured using the following environment variables:

  • DATA_DIR: Directory where table data is stored (default: ./data)

  • CAN_USE_RESOURCE: Controls whether to use MCP Resources or Tools for certain functionality (default: false)

    • When set to true: Uses the TableResource for accessing tables
    • When not set or any other value: Uses the GetTableTool instead of TableResource

This allows compatibility with LLM clients that may not fully support MCP Resources.

Development

# Run in development mode
npm run dev

# Run tests
npm test

# Build the project
npm run build

# Run the built project
npm start

Troubleshooting – Ran into a hiccup? Start here.

Common issues:

  1. Server not showing up in Claude Desktop

    • Verify your configuration file syntax
    • Make sure the paths are absolute and correct
    • Restart Claude Desktop after making configuration changes
  2. Tool execution failures

    • Check Claude Desktop logs at:

      • macOS: ~/Library/Logs/Claude/mcp*.log
      • Windows: %APPDATA%\\Claude\\logs\\mcp*.log

Documentation

Comprehensive documentation is available in the docs directory:

  • User Guides - Step-by-step instructions for installation, integration, and template usage
  • Examples - Sample tables from simple encounters to complex nested treasure generators
  • Developer Documentation - Architecture details, extension points, and implementation decisions

Project Structure

/
├── docs/                # Documentation for users and developers
├── src/                 # Source code
│   ├── domain/          # Core domain entities and value objects
│   ├── ports/           # Interface definitions for primary and secondary ports
│   ├── useCases/        # Application use cases and service implementations
│   ├── adapters/        # Primary and secondary adapters
│   │   ├── primary/     # Adapters that drive the application (MCP server)
│   │   └── secondary/   # Adapters driven by the application (persistence, RNG)
│   └── index.ts         # Application entry point
├── test/                # Test files
│   ├── unit/            # Unit tests for individual components
│   ├── integration/     # Tests for component interactions
│   └── e2e/             # End-to-end tests
└── scripts/             # Build and utility scripts

Testing

The project uses Jest for testing. Run the tests with:

npm test

Testing Standards

Test Location Standard:

  • All tests should be placed in the test/ directory, mirroring the structure of the src/ directory.
  • For example, tests for src/adapters/secondary/rng/DefaultRandomNumberGenerator.ts should be in test/unit/adapters/secondary/rng/DefaultRandomNumberGenerator.test.ts.

Test Types:

  • Unit tests: test/unit/ - Test individual components in isolation
  • Integration tests: test/integration/ - Test interactions between components
  • End-to-end tests: test/e2e/ - Test the entire system

Contributing

Got an idea or bug? Open an issue and let’s chat—PRs are welcome! See the Contributing Guide for more details.

License

This project is released under the MIT License.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
CursorThe AI Code Editor
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Tavily Mcp
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Amap Maps高德地图官方 MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
DeepChatYour AI Partner on Desktop
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.