{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/calculator-mcp-server</h1>\n  <p><b>Evaluate, simplify, and differentiate mathematical expressions via MCP. STDIO or Streamable HTTP.</b>\n  <div>1 Tool • 1 Resource</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.4.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/calculator-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/calculator-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/calculator-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-1.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/calculator-mcp-server/releases/latest/download/calculator-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=calculator-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvY2FsY3VsYXRvci1tY3Atc2VydmVyIl19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22calculator-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fcalculator-mcp-server%22%5D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n<div align=\"center\">\n\n**Public Hosted Server:** [https://calculator.caseyjhand.com/mcp](https://calculator.caseyjhand.com/mcp)\n\n</div>\n\n---\n\n## Tools\n\nOne tool for all mathematical operations:\n\n| Tool Name | Description |\n|:----------|:------------|\n| `calculate` | Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives. |\n\n### `calculate`\n\nA single tool covering 100% of the server's purpose. The `operation` parameter defaults to `evaluate`, so the common case is just `{ expression: \"...\" }`.\n\n- **Evaluate** — arithmetic, trigonometry, logarithms, statistics, matrices, complex numbers, unit conversion, combinatorics\n- **Simplify** — reduce algebraic expressions symbolically (e.g., `2x + 3x` -> `5 * x`). Supports algebraic and trigonometric identities\n- **Derivative** — compute symbolic derivatives (e.g., `3x^2 + 2x + 1` -> `6 * x + 2`)\n- Variable scope via `scope` parameter: `{ \"x\": 5, \"y\": 3 }`\n- Configurable precision for numeric results\n- Blank optional `variable` and `precision` values from form-based MCP clients are treated as omitted\n\n---\n\n## Resources\n\n| URI Pattern | Description |\n|:------------|:------------|\n| `calculator://help` | Available functions, operators, constants, and syntax reference. |\n\n---\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core):\n\n- Declarative tool definitions — single file per tool, framework handles registration and validation\n- Unified error handling across all tools\n- Structured logging with optional OpenTelemetry tracing\n- Runs locally (stdio/HTTP) or in Docker\n\nCalculator-specific:\n\n- Hardened math.js v15 instance — dangerous functions disabled, evaluation sandboxed via `vm.runInNewContext()` with timeout\n- No auth required — all operations are read-only and stateless\n- Input validation: expression length limits, expression separator rejection (semicolons and newlines), numeric-only scope values\n- Result validation: blocked result types (functions, parsers, result sets), configurable max result size\n- Scope sanitization: numeric-only values, prototype pollution prevention (blocked `__proto__`, `constructor`, etc.)\n\n---\n\n## Getting Started\n\n### Public Hosted Instance\n\nA public instance is available at `https://calculator.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"calculator-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://calculator.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nAdd one of the following to your MCP client configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"calculator-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/calculator-mcp-server@latest\"]\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"calculator-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/calculator-mcp-server@latest\"]\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"calculator-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/calculator-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher\n\n### Installation\n\n1. **Clone the repository:**\n```sh\ngit clone https://github.com/cyanheads/calculator-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n```sh\ncd calculator-mcp-server\n```\n\n3. **Install dependencies:**\n```sh\nbun install\n```\n\n---\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `CALC_MAX_EXPRESSION_LENGTH` | Maximum allowed expression string length (10–10,000). | `1000` |\n| `CALC_EVALUATION_TIMEOUT_MS` | Maximum evaluation time in milliseconds (100–30,000). | `5000` |\n| `CALC_MAX_RESULT_LENGTH` | Maximum result string length in characters (1,000–1,000,000). | `100000` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_HOST` | Hostname for the HTTP server. | `localhost` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_HTTP_ENDPOINT_PATH` | Path for the HTTP MCP endpoint. | `/mcp` |\n| `MCP_HTTP_MAX_BODY_BYTES` | Maximum inbound HTTP request size; `0` disables the limit. | `1048576` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n\nSee [`.env.example`](./.env.example) for optional session, resumability, logging, and telemetry settings.\n\n---\n\n## Running the Server\n\n### Local Development\n\n- **Build and run the production version:**\n  ```sh\n  bun run build\n  bun run start:http   # or start:stdio\n  ```\n\n- **Run checks and tests:**\n  ```sh\n  bun run devcheck     # Lints, formats, type-checks\n  bun run test         # Runs test suite\n  ```\n\n### Docker\n\n```sh\ndocker build -t calculator-mcp-server .\ndocker run -p 3010:3010 calculator-mcp-server\n```\n\nThe image defaults to Streamable HTTP on port `3010`, stateless sessions, and logs at `/var/log/calculator-mcp-server`.\n\n---\n\n## Project Structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/mcp-server/tools/` | Tool definitions (`*.tool.ts`). |\n| `src/mcp-server/resources/` | Resource definitions (`*.resource.ts`). |\n| `src/services/` | Domain service integrations (MathService). |\n| `src/config/` | Environment variable parsing and validation with Zod. |\n| `docs/` | Generated directory tree. |\n\n---\n\n## Development Guide\n\nSee [`AGENTS.md`](./AGENTS.md) or [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for logging\n- Register new tools and resources in `src/index.ts`\n\n---\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n---\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 8241,
  "sha": "92b94c71f8197c9cf3dff80c3a53797f4c8d5cb9b58f563084ed93ed2c2647e6",
  "repo_slug": "cyanheads/calculator-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_calculator_mcp_serve_05e53130/readme"
}