Skip to main content

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

Tool Purpose
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):

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

From GitHub:

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

From a local checkout (development):

uv sync
uv run thealgorithms-mcp          # serves over stdio

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

Verify

uv run python scripts/verify_stdio.py                 # multi-language contract over stdio
uv 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().

Metadata

Release files for thealgorithms-mcp 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thealgorithms-mcp 0.3.1
File Size Uploaded
thealgorithms_mcp-0.3.1.tar.gz 75.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thealgorithms-mcp 0.3.1
File Interpreter ABI Platform
thealgorithms_mcp-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 92.8 kB

Release files / thealgorithms_mcp-0.3.1.tar.gz

Download URL thealgorithms_mcp-0.3.1.tar.gz
Size 75.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0d187f52678409005e8a2f9a4854fd9d150bdf396e46b52b4d1df73d840a631e
BLAKE2b-256 checksum
How to use checksums
382c2f39e5b468067a632f8830984137219aafabf2c742c98f3f87d03f2e8f78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release files / thealgorithms_mcp-0.3.1-py3-none-any.whl

Download URL thealgorithms_mcp-0.3.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3517535af9d2fdb68844d71dacb3594557c214da64f7f3990549acd92fe0cdb8
BLAKE2b-256 checksum
How to use checksums
d1d0b73c4d040b08e7c7f128ad0b022ea8e2dc91fd57da28823138e0a4695488
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page