HammerTime

io.github.WentTheFox由 GitHub 账号 WentTheFox 发布v0.1.0更新于 Oct 30, 2026

Generate Discord timestamps and manage your HammerTime bot settings.

已验证Streamable HTTP可网页运行效率与工作流沟通与协作

概览

AI 生成的概览

远程 HammerTime MCP 服务器,可生成 Discord 时间戳,并读取或修改所绑定 HammerTime 机器人账号的设置。

可以做什么
  • 生成多种格式的 Discord 时间戳(at、at12、iso、unix、in、ago、add、subtract、snowflake),并按账号已保存的设置解析
  • 读取和修改所绑定 Discord 账号的机器人设置
  • 查询当前使用的 API 密钥以及服务状态
适用场景
适合让助手为消息、活动或嵌入内容生成 Discord 格式的时间戳,或在不离开对话的情况下查看和调整所绑定 Discord 账号的 HammerTime 机器人设置。
运行要求
远程 Streamable HTTP 端点,无需本地安装包。需要 HammerTime 网站个人资料页创建的 API 密钥,通过 Authorization 请求头以 Bearer 方式发送。每个密钥对应一个已绑定的 Discord 账号。
安装前请注意
API 密钥是与 Discord 账号绑定的凭据,具备该账号的权限范围,包括 settings:write,因此助手可以修改机器人设置。除非关闭遥测,使用情况会像机器人一样被记录。请求按密钥限流(约每分钟 60 次,允许突发),同一地址多次认证失败也会被限流。

安装

在 SourceWeft 中

  1. 打开 控制台中的 HammerTime,将其添加到工作区。
  2. 连接 Authorization token 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.WentTheFox%2Fhammertime/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "hammertime": {
      "type": "http",
      "url": "https://api.hammertime.cyou/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}

README

HammerTime API

The public REST API and the MCP server of HammerTime. Every endpoint, and every MCP tool, is the bot command of the same name, and every input is the command's option with the same name, so POST /at takes year, month, day, hour, minute, timezone, format and so on, resolved against the saved settings of the account exactly as the bot does it. The logic is @went.tf/hammertime-core, which the bot uses too.

POST /at, /at12, /iso, /unix, /in, /ago, /add, /subtract, /snowflakeThe commands, scope timestamps:create
GET/PATCH /settingsThe bot settings of the account, scopes settings:read / settings:write
GET /me, GET /healthThe key in use, and the service status
POST /mcpThe MCP server (Streamable HTTP, stateless), the same API keys
GET / and GET /generated/api-docs.jsonSwagger UI and the OpenAPI document

Usage is recorded as the bot's is (same counters, with the source api or mcp) unless the account turned telemetry off, and the replies carry the run count the way the bot's do.

Keys

Users create them on the HammerTime website (profile page), each acts as one linked Discord account. Send one as Authorization: Bearer htk_.... The bot has a service key of its own that names the account per request in X-Discord-User-Id; it is accepted by the REST endpoints for the commands only, not by /mcp.

An MCP client is configured with the URL of /mcp and the header, for example:

json
{ "mcpServers": { "hammertime": { "type": "http", "url": "https://<host>/mcp", "headers": { "Authorization": "Bearer htk_..." } } } }

The bot as a client

The bot can ask this API to handle its timestamp commands (COMMANDS_API_URL and COMMANDS_API_KEY in the bot's .env, see .env.example). It sends the options the user gave, as the service key with X-Discord-User-Id, and turns the answer into the Discord reply. The API has recorded the run by then and the reply carries the note about it, so the bot does not record it a second time. When the API is down, slow (COMMANDS_API_TIMEOUT_MS), refuses the bot or limits it, the bot handles the command itself exactly as it did before, including recording the run, so an outage of this service costs nothing but the logged warning. Input the API rejects is worded by the bot and recorded as it always was.

Rate limits

Each key may make RATE_LIMIT_PER_MINUTE requests (60) on average, with a burst of half of that, across the REST endpoints and /mcp together. The bot's service key is limited per Discord account it acts for, so one noisy user cannot use up what the others get. Every response of an authenticated request carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset, and a refused one is a 429 with Retry-After (seconds). /health and the documentation are not limited.

A client address that fails to authenticate AUTH_FAILURES_PER_MINUTE times (20) is turned away with a 429 until it has waited, before anything is looked up, so a flood of made-up keys does not each cost the Laravel app a lookup. Even a good key from that address waits, which can catch innocent users behind a shared address, so keep the number generous.

Behind a reverse proxy every client has the proxy's address, so they would all count as one. Set CLIENT_IP_HEADER to a header the proxy sets to the client's address and overwrites (nginx: proxy_set_header X-Real-IP $remote_addr;), otherwise anyone could pick the address they are counted under. Nothing runs in the background to clean up after the limits: a bucket is only brought up to date when it is used, and Redis forgets one by itself when it has filled up again.

Counting in Redis

pm2.json runs two workers (see below). Left alone, each counts for itself, so a key can make up to the number of workers times RATE_LIMIT_PER_MINUTE requests, and the same goes for the failed authentications of an address. Set up Redis to count them as one: either REDIS_URL, or REDIS_HOST with REDIS_PORT, REDIS_USERNAME, REDIS_PASSWORD, REDIS_DB and REDIS_TLS (see .env.example), and the limits are shared by every worker.

  • One Lua script refills the bucket, checks it and spends from it, so two workers can not both take the last token. The keys are <REDIS_KEY_PREFIX><kind>:<key or address> (hammertime-api:requests:key:42) and expire by themselves. Give the API a database of its own (REDIS_DB), the prefix keeps the keys of the Laravel app, which may share the Redis, safe in any case.
  • A request never waits for Redis for more than 150 ms. When it does not answer, that request is counted in memory, per worker, as it is without Redis: a limit that is a little looser is better than an API that is down because its rate limiter is. It says so in the log, once a minute at most, and counts in Redis again when Redis is back.
  • REDIS_TLS=true is for a Redis on another machine, on this one it is not needed.

Running as a cluster

pm2 runs the server as two workers that share the port (exec_mode, instances, wait_ready and kill_timeout in pm2.json). A worker sends ready once it listens and stops on SIGINT by finishing the requests in flight, which is what lets a deploy replace them one at a time without dropping any (src/graceful-shutdown.ts, the bot has the same one). Nothing a request needs is kept from the one before. The key cache is per worker, so each of them validates a key against the Laravel app once per KEY_CACHE_TTL_SECONDS, and the rate limits are per worker too unless Redis is set up.

Where the data lives

Nothing is stored here. The Laravel app (SledgeHammerTime) owns keys, settings and telemetry, and this service talks to its /internal endpoints with INTERNAL_API_SECRET (see docs/api.md in that repository). Validated keys are remembered for KEY_CACHE_TTL_SECONDS, so a revoked key keeps working for that long.

Generated parts

src/generated/commands.ts (the request schemas, option types and English texts) is generated from the bot's src/commands.json and its en-US locale, and docs/openapi/api-docs.json (in the repository root) from the routes. Both are committed, and the tests fail when they are stale:

sh
pnpm --filter @went.tf/hammertime-api run generate                       # after changing commands.json or the localepnpm --filter @went.tf/hammertime-api run generate -- --commands <path>  # from another commands filepnpm --filter @went.tf/hammertime-api run generate -- --check            # write nothing, fail when out of datepnpm --filter @went.tf/hammertime-api run openapi:sync [-- --check]      # after changing routes or their descriptions

Running it

sh
pnpm run build:core && pnpm --filter @went.tf/hammertime-api run buildcp packages/api/.env.example packages/api/.env    # fill it in, git ignores itnode packages/api/dist/src/server.js    # reads packages/api/.env by itself

On the server pm2 runs it (HammerTimeBot:Api in pm2.json), but only when packages/api/.env exists, see deploy.conf. (It used to be .env.api in the root of the repository, the deploy moves such a file by itself.) Deploy the Laravel app first, since this service calls its internal endpoints. It listens on 127.0.0.1:3010 only, so nginx has to proxy it to a hostname: nginx/api.hammertime.cyou.conf is the vhost, with the one-time setup in its header.

Tests

pnpm run test:packages from the root (core and API). They run the app in-process against an in-memory backend, the MCP tests use the real MCP SDK client.

Listing in the MCP Registry

server.json is what the MCP Registry lists: the endpoint of the MCP server and that it wants the API key as a bearer token. The registry only keeps metadata, so there is no package to publish.

The name is io.github.WentTheFox/hammertime. The workflow in .github/workflows/publish-mcp.yml authenticates with the OIDC token of GitHub Actions, which proves that the repository belongs to that owner, so no secret is stored anywhere.

To publish a version:

  1. Raise version in both packages/api/package.json and packages/api/server.json. A test fails when they differ.
  2. Merge it, then tag it: git tag mcp-v0.2.0 && git push origin mcp-v0.2.0.

The workflow tests the packages, checks that the tag matches server.json, validates it with mcp-publisher validate and publishes. A version can be published once. To try the file without publishing, run mcp-publisher validate in packages/api.

来源:packages/api/README.md,提交 ca851be

工具

0
该服务器需要 API 密钥等凭据,因此 SourceWeft 无法在没有凭据的情况下读取其工具,也未收录。

版本历史

1
  1. v0.1.0最新Oct 23, 2026

评分

已满足适用检查项的 85%

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

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具15 分

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

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