MCP Demo

Model Context Protocol 的一个简单示例代码
  • javascript

2

GitHub Stars

javascript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs

You run an MCP server that provides quick randomness utilities—drawing lots, rolling dice, and flipping coins—accessible via a local web interface or through standard input/output integration. This enables you to build interactive prompts, game helpers, or decision-makers that rely on reliable randomness within your MCP client workflows.

How to use

You connect to the MCP server from your client using either the standard input/output mode or the HTTP mode. In standard mode, you interact with the server as a local process and send tool requests directly. In HTTP mode, you access a Web UI and MCP endpoint from your browser or network client to trigger the same tools.

How to install

Prerequisites: you need Node.js and npm installed on your machine.

  1. Install dependencies for the MCP server package.
npm install

Run modes and endpoints

Two run modes are available. Choose the one that fits your workflow.

# Standard input/output mode (for AI client integration)
npm start

# HTTP server mode (Web UI and network access)
npm run start:http

Access points

After starting, you can use the following endpoints.

Web UI: http://localhost:3000
MCP endpoint: http://localhost:3000/mcp
Health check: http://localhost:3000/health

Available tools

draw_lottery

Select one or more items at random from a provided list of options. Supports specifying count and whether duplicates are allowed.

roll_dice

Roll dice with configurable number of sides and quantity. Returns the results of each die roll.

flip_coin

Flip a coin a specified number of times and return the counts of heads and tails.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational