gnomon

io.github.lihtness由 GitHub 账号 lihtness 发布v0.1.2更新于 Oct 24, 2026

Deterministic batch tools so LLM agents stop guessing dates and math.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

本地 MCP 服务器,为助手提供确定性的日期、日历、算术和单位换算工具,让模型计算而不是猜测。

可以做什么
获取当前时刻的详细快照,可指定时区,包含 ISO 周、季度和是否周末等字段。批量执行日历操作:差值、距今、自某日、加减、星期、工作日计数、自然语言日期解析和格式化。一次调用计算一组数学与统计表达式,结果按顺序返回。在长度、质量、温度等单位之间换算数值。
适用场景
适合助手需要跨月或跨年做日期运算、回答距某日期还有多久或已过多久、解析“下周四”这类说法,或处理较复杂的数学与单位换算时。批量工具适合需要对表格每一行执行同类计算的场景。
运行要求
作为本地 stdio 进程在用户机器上运行,通常用 uvx 按需启动或从 PyPI 安装。未声明账号、API 密钥、环境变量或请求头。需要 Python 运行时以及 uv 或 pip 工具。
安装前请注意
calc 工具会执行 Python 表达式,应视为代码执行而非普通算术。README 说明 calc 基于浮点数,不适合货币计算。工作日计数只排除周末,不考虑节假日。未声明任何凭据或数据外发。

安装

在 SourceWeft 中

  1. 打开 控制台中的 gnomon,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

gnomon-mcp

[PyPI] [Python] [License: MIT] [MCP Registry]

The pointer on a sundial that turns shadow into time.

A small MCP server for the boring-but-essential utilities every model needs: dates, calendars, arithmetic, unit conversion. Use it so your assistant stops "next-token guessing" math and date math.

Why

LLMs are bad at arithmetic and date math by default. They produce plausible answers that are often wrong by a small amount — exactly the kind of mistake that's hard to notice in a long response. gnomon-mcp exposes deterministic Python implementations through MCP so your model can compute instead of guess.

When an agent should reach for gnomon

Anywhere the next plausible token is not the right answer. Concretely:

  • Math that matters — anything beyond trivial mental arithmetic, anything with a decimal point, anything that compounds. Call calc.
  • "What day is it" / "how long until" / "how long since" — the model's training cutoff is not today. Call now for a snapshot; calendar with until/since/diff for elapsed time; parse for natural-language dates ("next thursday").
  • Date arithmetic across month/year boundaries — adding 30 days, finding a quarter-end, counting business days. Models routinely off-by-one these. Call calendar with add / business_days.
  • Unit conversion — call calc_convert. Never eyeball "kg → lb" or "°C → °F".
  • Table-row workloads — when the same kind of computation needs to run on every row of a table, both batch tools (calendar, calc) take a list and return a list in order. One call, N results.

The rule of thumb: if you'd ask a colleague to "just double-check that number," call gnomon instead.

How this compares to other MCP servers

Time and math already have several MCP servers — the official Time reference (timezone-only), mcp-time and mcp-datetime (date formatting / timezone), calculator-server (math + units, no dates), and bundles like agent-utils-mcp (regex / hashing / JWT). gnomon's lane is narrower:

  • Batch-first. calendar(ops) and calc(expressions) take lists; one tool call covers a whole table column instead of N calls.
  • A real now(). One call returns 18 fields — ISO week, quarter, fiscal year, day-of-year, is_weekend, … — instead of just {iso, tz}.
  • Dates and math and units in one wiring. No need to compose three separate servers.
  • Natural-language dates baked in ("next thursday", "in 3 hours") without a separate NLP server.

If you only need timezone conversion, the official Time server is enough. If you want a broad utility bundle (regex, hashing, encoding, JWT), agent-utils-mcp is a better fit. gnomon is for the boring date-arithmetic-and-arithmetic core, batched.

Tools

Calendar

Two tools:

  • now(tz?) — standalone. Returns a rich dict snapshot of the current moment. One call gets you everything about "right now".
  • calendar(ops) — batch dispatcher. Each item picks its own op. Designed for table-row workloads (e.g. one call computes time-elapsed for every row).

now(tz?) returns:

python
{  "iso": "2026-05-25T14:30:45+00:00",  "date": "2026-05-25",  "time": "14:30:45",  "unix": 1779345045,  "tz": "UTC",  "year": 2026, "month": 5, "month_name": "May", "day": 25,  "weekday": "Monday", "weekday_num": 0,          # 0=Monday  "day_of_year": 145, "week_of_year": 22,         # ISO week  "quarter": 2, "fiscal_year_us_gov": 2026,       # FY starts Oct 1  "hour": 14, "minute": 30, "second": 45,  "is_weekend": False,}

calendar(ops) operations:

OpParamsReturns
diffstart, end, unitend - start — time elapsed between two known dates
untiltarget, unit, tz?target - now — time left to a future point (negative if past)
sincesource, unit, tz?now - source — time elapsed since a past point (negative if future)
adddate, n, unitISO of date + n units (seconds|...|weeks, plus months|years calendar-aware)
weekdaydate"Monday".."Sunday"
business_daysstart, endcount of Mon-Fri days (start inclusive, end exclusive)
parsenatural, tz?ISO from natural language ("next thursday", "in 3 hours")
formatdate, fmtstrftime-formatted string

Units for diff/until/since: seconds, minutes, hours, days, weeks.

Example — compute several things in one call:

python
calendar([  {"op": "until", "target": "2026-12-31", "unit": "days"},          # days left in year  {"op": "since", "source": "2026-01-01", "unit": "days"},          # days elapsed in year  {"op": "diff", "start": "2026-01-01", "end": "2026-12-31", "unit": "days"},  {"op": "weekday", "date": "2026-05-25"},                           # "Monday"  {"op": "add", "date": "2026-05-25", "n": 1, "unit": "months"},  {"op": "parse", "natural": "next thursday", "tz": "America/Los_Angeles"},])

Calculator

ToolPurpose
calc(expressions)Evaluate a list of Python expressions and return a list of results. Math (sqrt, sin, log, pi, e, ...), stats (mean, median, stdev, variance), and useful builtins (abs, round, min, max, sum, range, sorted, ...) are pre-loaded. Batch in / batch out, order preserved.
calc_convert(value, from_unit, to_unit)Unit conversion via Pint (meter → foot, kg → lb, degC → degF, etc.).

Examples:

python
calc(["2 + 3 * 4"])                  # [14]calc(["sqrt(16)", "sin(pi/2)"])      # [4.0, 1.0]calc(["mean([1, 2, 3, 4])"])         # [2.5]calc(["sum(range(101))"])            # [5050]calc(["(25 / 100) * 100"])           # [25.0]

Future tools (sketches)

The same logic — if the model is likely to bluff it, expose a deterministic version — points at several more primitives worth building. None of these are implemented yet; they are candidates, listed roughly in order of bang-for-buck:

  1. Text measurement — count(text, unit) for chars / words / lines / sentences / LLM tokens. Agents constantly miscount "how long is this" and "will this fit in the context window."
  2. Regex match / replace — regex_find(pattern, text) and regex_sub(pattern, repl, text). Models hallucinate which substrings match a regex; a real engine ends the argument.
  3. Structured-data extraction — jq(path, json) / jsonpath(path, json). Reading values out of a nested blob by path, without typos.
  4. Hashing & encoding — hash(text, algo) (sha256, md5, blake2), encode(text, scheme) / decode(text, scheme) (base64, hex, url, jwt-payload). All things models confidently invent wrong.
  5. Decimal money math — money(expr) evaluated under Python's Decimal with explicit rounding. calc is float-based and quietly unsafe for currency.
  6. Holiday-aware business days — extend calendar.business_days with a country (or calendar) parameter so US/UK/IN holidays are excluded. The current implementation only knows weekends.
  7. Cron describe / next-fire — cron_describe("0 9 * * 1-5") → human English; cron_next(expr, n) → next N firing times. Models routinely misread cron fields.
  8. Token counting for a target model — count_tokens(text, model) via tiktoken / Anthropic tokenizer. Lets an agent budget its own prompts and outputs instead of guessing.

If you want one of these, open an issue (or a PR — each is a small self-contained module that fits the existing tools/ layout).

Install

Recommended: no install — run on demand via uv:

bash
uvx gnomon-mcp           # serves stdio MCP, ready for any clientuvx gnomon-mcp --demo    # call every tool once and print the results (no MCP client needed)

Or install globally:

bash
pip install gnomon-mcp

Wire it into your agent

All recipes assume uvx gnomon-mcp. If you prefer a pinned install, swap the command for gnomon-mcp (with no uvx).

Claude Code

bash
claude mcp add gnomon -- uvx gnomon-mcp

Or edit ~/.claude.json / a project .mcp.json:

json
{  "mcpServers": {    "gnomon": { "command": "uvx", "args": ["gnomon-mcp"] }  }}

Claude Desktop

claude_desktop_config.json:

json
{  "mcpServers": {    "gnomon": { "command": "uvx", "args": ["gnomon-mcp"] }  }}

Cursor

~/.cursor/mcp.json (or .cursor/mcp.json in a project):

json
{  "mcpServers": {    "gnomon": { "command": "uvx", "args": ["gnomon-mcp"] }  }}

Continue

~/.continue/config.yaml:

yaml
mcpServers:  - name: gnomon    command: uvx    args: ["gnomon-mcp"]

Any other client (generic stdio)

Spawn uvx gnomon-mcp as a subprocess and speak MCP over stdin/stdout. That is the entire integration.

Hosted / remote (HTTP transport)

For team-shared instances or agents that can't spawn a local subprocess:

bash
uvx gnomon-mcp --transport streamable-http --host 0.0.0.0 --port 8000# also supported: --transport sse

Then point your MCP client at http://<host>:8000/mcp (or /sse for the SSE transport).

Tell your agent to actually use it

The MCP tool descriptions are intentionally terse to keep persistent context cost minimal (~150 tokens for all four tools). The richer "when to reach for gnomon" guidance lives in a Claude Code skill that loads on demand.

Option A — Claude Code plugin (one command, recommended)

The plugin wires both the MCP server and the skill in one shot. Inside Claude Code:

/plugin marketplace add lihtness/gnomon-mcp/plugin install gnomon@gnomon-mcp

That registers gnomon as an MCP server (auto-starts via uvx) and installs the on-demand skill. Skill body loads only when the task triggers it — persistent context stays ~150 tokens for the four tool descriptions plus ~40 tokens for the skill's name + summary.

Option B — manual skill install (no plugin)

If you've already wired the MCP server with claude mcp add gnomon -- uvx gnomon-mcp and only want the skill:

bash
mkdir -p ~/.claude/skills/gnomoncurl -fsSL https://raw.githubusercontent.com/lihtness/gnomon-mcp/main/skills/gnomon/SKILL.md \  -o ~/.claude/skills/gnomon/SKILL.md

Option C — paste into your system prompt (non-Claude-Code agents)

For agents without skill support, paste this short version into your system prompt or CLAUDE.md:

text
You have gnomon: deterministic tools for dates and math. Use them insteadof guessing.
- `now` — current moment (your training cutoff isn't today).- `calendar(ops)` — batch date math: diff/until/since/add/weekday/  business_days/parse (natural language)/format.- `calc(expressions)` — batch Python eval; math + statistics + common  builtins pre-loaded.- `calc_convert(value, from, to)` — unit conversion via Pint.
Both batch tools take a list and return a list. Prefer one batched callover many small ones.

Development

bash
git clone https://github.com/lihtness/gnomon-mcpcd gnomon-mcppip install -e ".[dev]"pytest

License

MIT

来源:README.md,提交 dbc546a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分