io.github.CloudCorpRecords/calcport

السجل الرسمي أخرى

Safe arithmetic: evaluate expressions and add, subtract, multiply, divide.

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

NPM package @reneturcios/calcport
Claude Code
claude mcp add calcport -- npx -y @reneturcios/calcport@0.1.0 mcp
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "calcport": {
            "command": "npx",
            "args": [
                "-y",
                "@reneturcios/calcport@0.1.0",
                "mcp"
            ]
        }
    }
}
OCI package ghcr.io/cloudcorprecords/calcport:0.1.0
Claude Code
claude mcp add calcport -- docker run -i --rm ghcr.io/cloudcorprecords/calcport:0.1.0 mcp
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "calcport": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "ghcr.io/cloudcorprecords/calcport:0.1.0",
                "mcp"
            ]
        }
    }
}

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. calcport
  2. Install
  3. CLI
  4. MCP server
  5. Development
  6. License

calcport

calcport does arithmetic safely. Its centrepiece is an expression evaluator that understands the usual operators, parentheses, a handful of functions, and the constants pi and e — and nothing else. The evaluator is a hand-written parser, so an expression can never turn into code execution, a shell call, or a property lookup. Around it sit four single-purpose operations for callers that just need one sum, difference, product, or quotient.

Install

npx @reneturcios/calcport calculate "2+3*4"

Or run the container image:

docker run -i ghcr.io/cloudcorprecords/calcport

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

# Evaluate an expression
calcport calculate "sqrt(3^2 + 4^2) + pi"
# 8.141592653589793

# Single operations
calcport add 2 3          # 5
calcport subtract 10 4    # 6
calcport multiply 2.5 4   # 10
calcport divide 7 2       # 3.5

# Machine-readable output
calcport calculate "2^10" --json
calcport add 2 3 --json

calcport --version

Expressions may use + - * / % ^, parentheses, unary minus, the functions sqrt, abs, floor, ceil, and round, and the constants pi and e. ^ is right-associative, so 2^3^2 is 512.

Exit codes: 0 on success, 1 when a calculation cannot be done (division by zero, a malformed expression — the error says why), 2 for usage errors.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

npx -y @reneturcios/calcport mcp

MCP client configuration:

{
  "mcpServers": {
    "calcport": {
      "command": "npx",
      "args": ["-y", "@reneturcios/calcport", "mcp"]
    }
  }
}
Tools
ToolInputWhat it returns
calculateexpression (string, required)The numeric result of the expression, with the expression echoed back.
adda, b (numbers, required)a + b, with both operands.
subtracta, b (numbers, required)a - b, with both operands.
multiplya, b (numbers, required)a * b, with both operands.
dividea, b (numbers, required)a / b, with both operands. Dividing by zero is an error.

Development

npm install
npm run build   # tsc -> dist/
npm test        # node test runner over test/*.test.ts, no network
npm run dev     # run the CLI from source via tsx

License

MIT — see LICENSE.

الأسئلة الشائعة

ما هو io.github.CloudCorpRecords/calcport؟

Safe arithmetic: evaluate expressions and add, subtract, multiply, divide.

كيف أثبّت io.github.CloudCorpRecords/calcport؟

يعمل على جهازك. في Claude Code: claude mcp add calcport -- npx -y @reneturcios/calcport@0.1.0 mcp. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج io.github.CloudCorpRecords/calcport إلى مفتاح API؟

لا يذكر إدراجه في السجل أي مفتاح أو سر إلزامي. قد تتطلب بعض الميزات حسابًا لدى الخدمة التي يتصل بها.

هل io.github.CloudCorpRecords/calcport مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون io.github.CloudCorpRecords/calcport؟

ينشره CloudCorpRecords. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.