• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dcm31

dcm31

mcp-dice

Minimal dice rolling MCP server
Public
Like
mcp-dice
Home
Code
2
README.md
H
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v2
View latest version
README.md

Dice MCP Server

A minimal MCP (Model Context Protocol) server example. Use this as a starting point for building your own MCP tools.

Tools

ToolDescription
roll_diceRoll 1-10 six-sided dice
flip_coinFlip a coin (heads/tails)

Usage

With OpenAI Responses API

const response = await openai.responses.create({ model: "gpt-4o-mini", input: "Roll 3 dice for me", tools: [{ type: "mcp", server_label: "dice", server_url: "YOUR_VAL_URL_HERE", require_approval: "never", }], });

With MCP Chat

Add this server in the MCP Servers settings panel.

Direct Testing

# List tools curl -X POST YOUR_VAL_URL_HERE \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' # Roll dice curl -X POST YOUR_VAL_URL_HERE \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"roll_dice","arguments":{"count":3}}}'

Building Your Own MCP Server

This template shows the essential MCP pattern:

  1. Define tools with name, description, and JSON Schema for inputs
  2. Handle protocol methods: initialize, tools/list, tools/call
  3. Return JSON-RPC 2.0 responses

Key methods to implement:

  • initialize - Return server capabilities
  • tools/list - Return array of available tools
  • tools/call - Execute a tool and return results

See the MCP specification for the full protocol.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.