mathcp
A stateless MCP server for mathematical constants, hosted on Cloudflare Workers, enabling listing constants, calculating pi to arbitrary precision, finding primes in a range, and investigating prime gaps.
README
mathcp
A small, stateless MCP server for some of mathematics' most interesting constants, hosted on Cloudflare Workers.
What it exposes
list_interesting_numberslists the available constants.get_interesting_numberreturns a constant, its defining formula, a decimal approximation, and why it matters.- The
mathcp://pi/methodsresource lists ten methods for calculating π, including each formula and its convergence characteristics. calculate_piaccepts a method identifier and a number of decimal digits (0–10,000), then returns the arbitrary-precision result and method metadata.find_prime_numbersuses MCP elicitation to ask exactly two questions (the minimum and maximum), then returns every prime in that inclusive range.investigate_prime_patternscalculates verified primes and successive prime gaps, then uses MCP sampling to ask the client's language model for a cautious pattern analysis. Ranges are limited to a span of 2,000 integers to keep the sampling request bounded. This tool requires a client that supports sampling.- Prompt templates provide three different ways to explore a maths topic:
mc_escheruses symmetry, tessellation, recursion, and visual metaphors. Example: “Explain hyperbolic geometry using a repeating tiled world.”ada_lovelaceturns an idea into an algorithm with pseudocode and a traced example. Example: “Turn Euclid's algorithm into a small program and trace one example.”srinivasa_ramanujansearches small examples for patterns before carefully separating conjecture from proof. Example: “Investigate patterns in the partition numbers for small integers.”
GET /describes the service.GET /healthprovides a conventional health check./mcpis the Streamable HTTP MCP endpoint.
The initial catalogue includes pi, Euler's number, the golden ratio, and the imaginary unit. The code is deliberately data-driven so another constant can be added in one place.
Develop locally
npm install
npm run check
npm test
npm run dev
Run the same MCP server locally over stdio:
npm run mcp:local
For Codex, register the executable directly so npm does not write status text to the MCP protocol stream:
codex mcp add mathcp-local -- \
node \
--import /absolute/path/to/mathcp/node_modules/tsx/dist/loader.mjs \
/absolute/path/to/mathcp/src/stdio.ts
Copy the example secrets file and set a long random bearer token before starting the local server:
cp .dev.vars.example .dev.vars
The local MCP endpoint is normally http://localhost:8787/mcp. Clients must send
the configured token in the Authorization header:
Authorization: Bearer <your-token>
Deploy to Cloudflare
Authenticate Wrangler, then deploy:
npx wrangler login
npx wrangler secret put AUTH_TOKEN
npm run deploy
Wrangler prints the deployed Worker URL. Append /mcp when configuring an MCP
client, for example https://mathcp.<account>.workers.dev/mcp. Configure the MCP
client to send the same bearer header. The root description and /health remain
public; /mcp requires authentication in both local and deployed environments.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.