Thealgorithms Mcp

io.github.mcande21由 GitHub 账号 mcande21 发布v0.3.1更新于 Oct 27, 2026

Search TheAlgorithms across 24 languages; fetch implementations with examples.

概览

AI 生成的概览

搜索 TheAlgorithms 组织下 24 种编程语言的算法实现,并获取源码及其文件内示例。

可以做什么
  • 列出已索引的语言及数量、别名,并说明被排除的仓库及原因
  • 列出指定语言下的分类及各分类条目数
  • 按名称搜索算法,返回带分类和路径的排序结果
  • 获取某个分类下的全部算法,或读取单个文件的源码与提取出的示例
  • 跨语言比较同一算法,并列出缺失的语言
  • 根据前缀自动补全算法名称
适用场景
需要某门语言的经典算法参考实现、想对比同一算法在不同语言中的写法,或想直接拿到源码文件中的示例用法时适用。
运行要求
以 stdio 方式在本机运行,可通过 uvx 从 PyPI 安装(也可从 GitHub 或本地代码检出运行)。需要访问 GitHub 与 raw.githubusercontent.com 的网络。无需令牌;可选设置 GITHUB_TOKEN 以提高 GitHub API 速率上限。
安装前请注意
未设置 GITHUB_TOKEN 时可能受 GitHub API 速率限制影响。目录索引会在本地按 ETag 和 TTL 缓存,语言清单缓存 7 天,结果可能滞后于上游更新。文件内容按需从 GitHub 拉取。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

thealgorithms-mcp

mcp-name: io.github.mcande21/thealgorithms-mcp

An MCP server for querying the TheAlgorithms org across every language repo — search algorithm implementations and fetch any one with its in-file examples.

Languages are auto-discovered from the org (not a hardcoded list): a repo is indexed when it publishes a parseable DIRECTORY.md — currently 24 languages (Python, Java, C++, JavaScript, Rust, C, TypeScript, PHP, Dart, Kotlin, Ruby, R, Scala, Swift, Julia, Haskell, MATLAB, Zig, Fortran, Nim, Clojure, F#, Jule, aarch64-assembly). Repos without a DIRECTORY.md (Go, C#, Lua, Solidity, …) are reported by list_languages with their exclusion reason — no silent gaps.

Hybrid design: each repo's DIRECTORY.md index is cached locally (ETag + TTL); file contents are fetched on demand from raw.githubusercontent.com. The org/language manifest is auto-discovered via the GitHub API and cached 7 days. No token required (set GITHUB_TOKEN to raise the rate limit). See DESIGN.md.

Tools

ToolPurpose
list_languages()Indexed languages (+ counts, aliases) and excluded repos with reasons
list_categories(language='python')Categories with entry counts for a language
search_algorithms(query, language='python', category?, limit=10)Ranked {name, category, path, score}
get_category(category, language='python')Every algorithm in a category
get_algorithm(path, language='python', include_source=True)Source + extracted examples
compare(name, languages?, min_score=90, limit_per_language=1)Real matches across languages + missing_in
suggest(prefix, language='python', limit=10)Trie-backed name autocomplete (dij → Dijkstra)

language accepts names or aliases (cpp/c++, js, ts, …). Typical flow: search_algorithms("dijkstra", language="rust") → get_algorithm("src/graph/dijkstra.rs", language="rust"). Examples are extracted where the language has an in-file convention (Python doctests, Rust doc-tests); other languages return source plus a note.

Install

From PyPI (recommended):

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

From GitHub:

json
{ "thealgorithms": {    "command": "uvx",    "args": ["--from", "git+https://github.com/mcande21/thealgorithms-mcp", "thealgorithms-mcp"] } }

From a local checkout (development):

bash
uv syncuv run thealgorithms-mcp          # serves over stdio

Add any of the above to ~/.normandy-generic/mcp.json (or your MCP client config).

Verify

bash
uv run python scripts/verify_stdio.py                 # multi-language contract over stdiouv run python scripts/verify_language.py rust         # one language, end-to-end

The harness spawns the server over stdio and asserts every tool against the live org, including binary-search fetch across ≥8 languages and cross-language compare().

来源:README.md,提交 3f22961

工具

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

版本历史

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

评分

已满足适用检查项的 40%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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

    请在仓库或注册中心条目中声明许可证。