Skip to main content
Glama
toolkit-mcp-server

toolkit-mcp-server

by cyanheads

版本 许可证 Docker MCP SDK npm TypeScript Bun

在 Claude Desktop 中安装 在 Cursor 中安装 在 VS Code 中安装

框架

公共托管服务器: https://toolkit.caseyjhand.com/mcp


工具

七个工具。其中五个始终可用,无需任何配置——纯计算工具加上一个无 SSRF 风险的 IP 查询工具。另外两个会探测服务器主机,在 tools/list 中默认不出现,除非你主动启用,且默认关闭(fail-closed)。

工具

描述

toolkit_hash_value

生成加密摘要(sha256/sha512/sha1/md5),或对值进行常量时间比较,与预期摘要进行比对。

toolkit_generate_id

生成加密随机标识符——UUIDv4、UUIDv7 或 ULID——可单个生成,也可批量生成最多 1000 个。

toolkit_generate_qr

将文本或 URL 编码为 QR 码,输出格式为 SVG 标记、base64 PNG 或终端可渲染字符串。

toolkit_encode_value

对值进行编码或解码,支持 base64、base64url、hex 或 URL 百分比编码,可双向操作。

toolkit_geolocate_ip

将公共 IP 或主机名解析为地理和网络元数据——国家、城市、坐标、ASN、时区。

toolkit_check_network

受限,默认关闭。 只读网络诊断,从服务器主机执行——ping、traceroute、TCP 连接性或出口 IP 检测。

toolkit_check_system

受限,默认关闭。 报告服务器主机系统状态的某个方面——操作系统、CPU、内存、平均负载或网络接口。

toolkit_hash_value

生成摘要,或对值进行常量时间验证,与预期值比对。

  • operation:generate(小写十六进制摘要)或 compare(通过 timingSafeEqual 进行时序安全检查)

  • 算法:sha256(默认)和 sha512 用于安全场景;sha1 和 md5 仅用于校验和和文件完整性兼容——绝不可用于密码或签名

  • inputEncoding 将 value 视为 utf8(默认)、hex 或 base64,因此二进制数据可跳过一轮解码往返

  • 典型用法:将下载文件与供应商发布的校验和进行匹配


toolkit_generate_id

从平台 CSPRNG 生成加密随机标识符——这是生成不可预测 ID 的正确来源,不同于模型自行构造的值。

  • type:uuid_v4(随机,默认)、uuid_v7(按创建时间排序,可排序)或 ulid(26 个字符的 Crockford base32,按字典序可排序)

  • count 可在一次调用中批量生成最多 1000 个;返回的 ids 数组始终恰好包含 count 个值

  • uuid_v7 和 ulid 批次是单调递增的——即使在同一毫秒内也严格递增——因此 ids 保持按创建顺序排序

  • 只读——生成操作不改变任何状态——但绝不幂等,因此客户端不会缓存或去重一个批次


toolkit_generate_qr

将文本或 URL 编码为 QR 码。

  • format:svg(内联标记)、png_base64(带有 mimeType 和 byteLength 的栅格字节)或 terminal(Unicode 块字符字符串)

  • errorCorrection(L/M/Q/H)在数据容量与容错能力之间权衡;margin 设置静区宽度;scale 设置栅格输出的每模块像素数

  • 返回的 version(1–40)反映编码数据的密度

  • png_base64 还会作为 MCP 图像内容块提供,因此读取 content[] 的客户端无需解码 structuredContent 即可渲染二维码

  • 渲染的 PNG 每边限制在 2048 像素以内——(modules + 2 × margin) × scale——因此高密度符号在较大 scale 下会被拒绝,并返回带有 raster_too_large 类型的错误,提示一个合适的 scale 值;svg 和 terminal 无此限制

  • data 最大为 2953 字节——绝对上限(版本 40,L 级,字节模式);在更高的 errorCorrection 级别下可用容量更低,因此超出容量的输入会被拒绝,并返回带有 data_too_large 类型的错误,而非通用失败


toolkit_encode_value

对值进行编码或解码,支持双向操作。

  • encoding:base64、base64url(URL 安全字母表)、hex 或 url(百分比编码)

  • operation:encode(原始 UTF-8 → 编码)或 decode(编码值 → 文本)

  • 格式错误的解码输入返回带有 decode_failed 类型的错误及恢复提示,而非静默尽力解码


toolkit_geolocate_ip

将公共 IP 或主机名解析为地理和网络元数据。

  • 返回国家、地区、城市、纬度/经度、ASN、所属组织及时区

  • proxy、hosting 和 mobile 标志用于指示地址是否为代理/VPN/Tor 出口、数据中心网络或移动运营商——其中任何一个为 true 表示坐标描述的是基础设施,而非个人。当提供商未报告时,这些字段不存在

  • 主机名首先通过 DNS 解析;resolvedIp 回显实际定位的 IP,source 指明提供方名称

  • 无 SSRF——服务器调用的是提供方,永远不会调用目标地址;解析后的 IP 会再次检查是否为私有地址,私有/保留地址会被拒绝(它们没有公共地理定位信息)

  • 尽力而为且受限于提供方:VPN、代理、移动 NAT 和任播都会影响 IP 定位,精度最多到城市级别,缺失字段报告为未知而非编造

  • 提供方提供的字符串会被截断并去除控制字符后才进入响应,因此注册中心控制的文本(org、isp、as)不会淹没或影响模型上下文格式

  • 默认无需密钥(ip-api 免费版,使用明文 HTTP——参见 TOOLKIT_GEO_BASE_URL);结果按解析后的 IP 缓存于内存中,并有固定条目上限


toolkit_check_network

受限——仅在 TOOLKIT_ENABLE_NET_DIAGNOSTICS=true 时注册。只读网络诊断,从服务器主机执行。

  • mode:ping(ICMP 往返)、traceroute(到目标的跃点路径)、connectivity(向 target 的 port 进行原始 TCP 连接)或 public_ip(主机自身的出口 IP)

  • 无响应的主机报告为 reachable: false——这是一个有效结果,而非错误

  • 诊断的是服务器自身的网络,因此在本地或自托管部署中很有用;要访问私有/保留/内部目标,还需 TOOLKIT_ALLOW_PRIVATE_NETWORK=true,这默认会阻止云元数据端点


toolkit_check_system

受限——仅在 TOOLKIT_ENABLE_SYSTEM_INFO=true 时注册。报告服务器主机系统状态的某个方面,只读。

  • what:os、cpu、memory、load 或 interfaces

  • 每次调用只填充一个方面对象,与 what 匹配

  • 描述的是运行此服务器的主机,而非调用客户端——在本地或自托管部署中有意义;默认关闭,因为 os 和 interfaces 会暴露主机拓扑和版本细节

Related MCP server: IT Tools MCP Server

功能特性

基于 @cyanheads/mcp-ts-core 构建:

  • 声明式工具定义——每个工具一个文件,框架负责注册和验证

  • 统一错误处理——处理函数抛出错误,框架捕获、分类并格式化

  • 类型化错误契约——每个可能失败的工具都会声明其失败原因,并附带代理可操作的恢复提示

  • 可插拔认证:none、jwt、oauth

  • 结构化日志,可选 OpenTelemetry 追踪

  • STDIO 和 Streamable HTTP 传输

工具包特有:

  • 默认关闭的防护机制——两个探测主机的工具在 tools/list 中不出现,除非显式启用,因此托管实例不会暴露 SSRF 或信息泄露面

  • 双层网络防护——即使启用了诊断,私有/保留/回环/链路本地目标(包括云元数据端点)也保持阻断,直到第二个标志允许它们

  • CSPRNG 支持的原语——标识符和摘要来自平台加密源,哈希比较通过 timingSafeEqual 实现常量时间比较

  • 无 SSRF 的地理定位——服务器调用提供方,然后在查询前再次检查 DNS 解析后的 IP 是否在私有范围,因此主机名无法将请求走私到内部地址

对代理友好的输出:

  • 来源追溯——地理定位回显解析后的 IP 并指明提供方名称;上游缺失字段报告为未知,绝不编造

  • 故障但有效的结果——不可达主机返回 reachable: false 而非错误,因此调用者基于数据进行分支判断,而非异常文本

  • 类型化失败原因——解码失败、缺失摘要和被阻止的私有目标各自携带结构化的原因及下一步恢复提示

快速开始

公共托管实例

公共实例地址为 https://toolkit.caseyjhand.com/mcp——无需安装。通过 Streamable HTTP 将任何 MCP 客户端指向该地址:

{
  "mcpServers": {
    "toolkit-mcp-server": {
      "type": "streamable-http",
      "url": "https://toolkit.caseyjhand.com/mcp"
    }
  }
}

自托管 / 本地

将以下内容添加到您的 MCP 客户端配置文件中。无需 API 密钥——五个始终可用的工具和默认的无密钥地理定位层开箱即用。

{
  "mcpServers": {
    "toolkit-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["@cyanheads/toolkit-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

或者使用 npx(无需 Bun):

{
  "mcpServers": {
    "toolkit-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@cyanheads/toolkit-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

或者使用 Docker:

{
  "mcpServers": {
    "toolkit-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/toolkit-mcp-server:latest"]
    }
  }
}

要启用受限制的主机探测工具,请将相应的标志添加到 env(或 Docker 的 -e):

"env": {
  "MCP_TRANSPORT_TYPE": "stdio",
  "TOOLKIT_ENABLE_NET_DIAGNOSTICS": "true",
  "TOOLKIT_ENABLE_SYSTEM_INFO": "true"
}

对于 Streamable HTTP,设置传输方式并启动服务器:

MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp

前提条件

  • Bun v1.3.2 或更高版本(或 Node.js v24+)。

  • 无需 API 密钥——地理定位默认使用无密钥的 ip-api 免费版。

安装

  1. 克隆仓库:

git clone https://github.com/cyanheads/toolkit-mcp-server.git
  1. 进入目录:

cd toolkit-mcp-server
  1. 安装依赖:

bun install

配置

每个变量都是可选的。服务器特定的选项在启动时通过 src/config/server-config.ts 中的 Zod 模式进行验证。

变量

描述

默认值

TOOLKIT_ENABLE_NET_DIAGNOSTICS

注册受门控的 toolkit_check_network 工具。对于托管或共享部署,请省略此变量。

false

TOOLKIT_ENABLE_SYSTEM_INFO

注册受门控的 toolkit_check_system 工具。仅在本地或自托管部署中有意义。

false

TOOLKIT_ALLOW_PRIVATE_NETWORK

启用网络诊断时,允许私有/保留/回环目标。这是第二道显式门控。

false

TOOLKIT_GEO_API_KEY

地理定位端点的 API 密钥(如果需要)。

无

TOOLKIT_GEO_BASE_URL

兼容 ip-api 的地理定位端点的基础 URL。默认是明文 HTTP——ip-api 的 HTTPS 端点不属于无密钥免费套餐,如果没有付费密钥,会返回 403 SSL unavailable for this endpoint。将此指向 HTTPS 端点(配合 TOOLKIT_GEO_API_KEY)以加密提供商请求。

http://ip-api.com

TOOLKIT_GEO_CACHE_TTL_SECONDS

内存中地理定位缓存的 TTL(秒)。

3600

TOOLKIT_GEO_RATE_LIMIT_PER_MIN

每分钟最大地理定位请求数。

45

MCP_TRANSPORT_TYPE

传输方式:stdio 或 http。

stdio

MCP_HTTP_PORT

HTTP 服务器的端口。

3010

MCP_AUTH_MODE

认证模式:none、jwt 或 oauth。

none

MCP_LOG_LEVEL

日志级别(RFC 5424)。

info

OTEL_ENABLED

启用 OpenTelemetry 检测(跨度、指标、完成日志)。

false

请参阅 .env.example 获取完整的可选覆盖列表。

运行服务器

本地开发

  • 构建并运行:

    # One-time build
    bun run rebuild
    
    # Run the built server
    bun run start:stdio
    # or
    bun run start:http
  • 运行检查和测试:

    bun run devcheck   # Lint, format, typecheck, security, changelog sync
    bun run test       # Vitest test suite
    bun run lint:mcp   # Validate MCP definitions against spec

Docker

docker build -t toolkit-mcp-server .
docker run --rm -e MCP_TRANSPORT_TYPE=http -p 3010:3010 toolkit-mcp-server

Dockerfile 默认使用 HTTP 传输、无状态会话模式,并将日志记录到 /var/log/toolkit-mcp-server。OpenTelemetry 对等依赖项默认安装——使用 --build-arg OTEL_ENABLED=false 构建以省略它们。

项目结构

目录

用途

src/index.ts

createApp() 入口点——注册工具并初始化服务,对两个主机探测工具采用失败关闭的门控。

src/config

使用 Zod 进行服务器特定的环境变量解析和验证。

src/mcp-server/tools

工具定义(*.tool.ts)。共七个工具——五个始终开启,两个受门控。

src/services/geo

地理定位服务——DNS 解析、带重试/退避的提供商调用、标准化、内存缓存。

src/services/network

网络诊断服务,以及共享的目标验证器和私有范围分类器。

tests/

单元测试和集成测试,镜像 src/ 的结构。

开发指南

请参阅 CLAUDE.md / AGENTS.md 获取开发指南和架构规则。简要说明:

  • 处理程序抛出异常,框架捕获——工具逻辑中不使用 try/catch

  • 使用 ctx.log 进行请求范围的日志记录,使用 ctx.state 进行租户范围的存储

  • 在 src/index.ts 的 createApp() 数组中注册新工具

  • 两个主机探测工具在其启用标志后注册;网络目标门控在 DNS 解析后验证——切勿为无法定位或无法访问的目标伪造结果

贡献

欢迎提交 Issue 和 Pull Request。提交前请运行检查和测试:

bun run devcheck
bun run test

许可证

Apache-2.0——详情请参阅 LICENSE。

Available Tools

5 tools
toolkit_encode_valuetoolkit-mcp-server: encode valueA
Read-onlyIdempotent
Inspect

Encode or decode a value across base64, base64url, hex, or URL (percent) encoding, in either direction. Set operation to "encode" to transform raw UTF-8 text into the chosen encoding, or "decode" to recover the original bytes from an encoded value. Decoded bytes come back as UTF-8 text by default; set outputEncoding to "hex", "base64", or "base64url" (unpadded, the form JWK members, JWS signatures, and PKCE code challenges use) to receive them re-encoded instead, which is lossless for binary data and transcodes between encodings (a base64 digest to hex, or hex key bytes to base64url, for example). Decoding never substitutes replacement characters: bytes that are not valid UTF-8 text are reported as a recoverable error that points at outputEncoding. Whitespace in hex, base64, and base64url values is ignored, so line-wrapped MIME bodies and PEM bodies decode as-is (drop PEM's -----BEGIN/END----- lines, which are not base64). base64url uses the URL-safe alphabet (- and _ instead of + and /); url applies encodeURIComponent and percent-decoding. A value that is malformed for the chosen encoding is reported as a recoverable error, not a silent best-effort.

Inputs: value (required), encoding (required), operation (required), outputEncoding. Returns: error, result, encoding, operation, +1 more

toolkit_generate_idtoolkit-mcp-server: generate idA
Read-only
Inspect

Mint cryptographically-random identifiers using the platform CSPRNG — the correct source for IDs that must be unpredictable, unlike model-generated values. type selects the format: uuid_v4 (random, the default), uuid_v7 (time-ordered, sortable by creation), or ulid (26-char Crockford-base32, lexicographically sortable). Set count to mint a batch in one call (up to 1000); the returned ids array always contains exactly count values and is never truncated. For uuid_v7 and ulid, a batch is monotonic — strictly increasing even within the same millisecond — so the ids array stays in sorted creation order; ids minted in the same millisecond are separated by random gaps, so no id in a batch can be derived from another. IDs from this tool feed into toolkit_generate_qr (pass ids[0] as data) to create a scannable code.

Inputs: type, count. Returns: ids, type, count, error

toolkit_generate_qrtoolkit-mcp-server: generate QR codeA
Read-onlyIdempotent
Inspect

Encode text or a URL into a QR code. data is the content to encode (a link, a generated identifier such as toolkit_generate_id's ids[0], or any string). format selects the output: svg returns inline SVG markup sized in pixels, png_base64 returns base64-encoded PNG bytes (with mimeType and byteLength), and terminal returns plain Unicode half-block characters (no escape codes) for a monospace display, drawn for a dark background: light modules, quiet zone included, are blocks and dark modules are spaces. errorCorrection (L/M/Q/H) trades data capacity for damage tolerance, margin sets the quiet-zone width in modules, and scale sets pixels per module for svg and png_base64, so both are (modules + 2 × margin) × scale pixels per side. The returned version (1–40) reflects how dense the encoded data is. png_base64 rejects an image past 2048 px per side with a typed raster_too_large error, so a dense symbol needs a lower scale; svg is vector markup and carries no such limit.

Inputs: data (required), scale, format, margin, +1 more. Returns: error, format, content, version, +2 more

toolkit_geolocate_iptoolkit-mcp-server: geolocate IPA
Read-onlyIdempotent
Inspect

Resolve a public IP or dotted hostname to country, region, city, coordinates, ASN, AS holder and name, organization, ISP, timezone, and proxy/hosting/mobile flags. Supply target for one lookup or targets for an ordered batch, never both; blank target and empty targets are unset. Batches process the first 100 positions (duplicates retained) and disclose every remainder in unprocessedTargets; at most 1000 inputs are accepted. Each batch position reports its result or an error with recovery, so cached and local outcomes survive quota refusals. The provider is called directly, never the target. Hostnames are DNS-resolved and resolvedIp names the located address. Private/reserved addresses have no public geolocation. Results are best-effort, city-level at best; VPNs, proxies, mobile NAT, and anycast defeat IP-to-location. Read proxy, hosting, and mobile before trusting coordinates: true describes infrastructure, not the user. org can name a customer or sub-allocation rather than the network operator; read isp, asHolder, and asName for the operator. Absent metadata remains unknown. Provider-supplied names are third-party registry text; content[] escapes them so they read as literal text, never as Markdown. source names the provider. Single and batch quotas are independent; cache hits consume neither quota.

Inputs: target, targets. Returns: asn, isp, org, city, +18 more

toolkit_hash_valuetoolkit-mcp-server: hash valueA
Read-onlyIdempotent
Inspect

Generate a cryptographic digest or HMAC of a value, or verify a value against an expected digest. Set operation to "generate" for a digest, or "compare" to constant-time-check value against the expected digest — compare is timing-safe and avoids manual string equality checks. Omitting operation compares when expected is supplied and generates otherwise. Algorithm defaults to sha256; sha384 and sha512 are also secure, while md5 and sha1 are exposed ONLY for checksum and file-integrity compatibility and for verifying existing HMAC-SHA1 signatures, and must not be used for passwords, new signatures, or any other security purpose. Set secret to compute HMAC(algorithm, secret, value) instead of a plain digest, for generate and compare alike — the check behind webhook signatures such as GitHub's X-Hub-Signature-256 (pass the header value as expected) and HS256 JWT signatures; secretEncoding says how secret is written (utf8 default, hex, base64, or base64url for a JWK k), the result carries hmac: true, and the secret is never echoed back. digestEncoding selects the generated digest form: lowercase hex (default), base64, base64url (unpadded, the JWS signature form), or sri (-, the npm lockfile integrity and Subresource Integrity form, sha256/sha384/sha512 only, plain digests only). expected is recognized by its shape at the algorithm's digest length, so a published checksum can be pasted as-is: a bare hex, base64, or base64url digest; SRI, which may hold several space-separated entries as an npm integrity field can and matches when any entry for algorithm does; one checksum-file line as sha256sum, shasum, md5, or openssl dgst prints it ( , or SHA256 () = ); or a digest prefixed sha256: or sha256= (OCI and release-asset digests, webhook signature headers). A tag or prefix naming another algorithm fails rather than being ignored, a multi-line checksum file must be cut to the one line for the file, and with secret an SRI value or a tagged line fails, since both carry plain digests. inputEncoding controls how value is read before hashing (utf8 default, or hex/base64 for raw binary data) so binary blobs need no decode round-trip. The canonical use is matching a download against a vendor-published checksum or a lockfile integrity entry.

Inputs: value (required), secret, expected, algorithm, +4 more. Returns: hmac, error, digest, matches, +3 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool targets a clearly different job: hashing, reversible encoding, ID minting, QR rendering, and IP geolocation. The only mild overlap is between hash and encode, since both accept base64/hex encodings and one can transcode digests, but the descriptions make the digest-vs-reversible-transform boundary explicit.

    Naming Consistency5/5

    Every tool uses the same toolkit_ prefix followed by a snake_case verb_noun pair: hash_value, encode_value, generate_id, generate_qr, geolocate_ip. The pattern is fully predictable.

    Tool Count4/5

    Five tools is a sensible size for a general utility server, and each tool carries a distinct capability rather than a thin variant of another. The grouping is inherently a grab bag, so the set is slightly arbitrary in membership but not padded.

    Completeness4/5

    Each individual tool covers its sub-domain well: hash does generate and compare/HMAC, encode does both directions with multiple transcodes, id supports three formats with batches, qr supports three output formats, and geolocate supports single and batch. As a general toolkit there are predictable gaps (no time/date or JWT-decode style utilities), but nothing that blocks the advertised workflows.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
      2
      -
    • A
      license
      B
      quality
      F
      maintenance
      A comprehensive Model Context Protocol server providing access to 70+ IT tools for developers and system administrators, including encoding/decoding, text manipulation, hashing, and network utilities.
      2
      100
      216 npm
      21
      TypeScript
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A secure Model Context Protocol server providing HTTP endpoints for AI agent tool execution, including file system operations, shell commands, and LLM-based code generation.
      1
      -