Skip to main content

MCP server for querying TheAlgorithms/Python — search algorithms and fetch implementations with their doctests as examples.

Project description

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?, limit_per_language=1) The same algorithm across languages

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().

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thealgorithms_mcp-0.2.0.tar.gz (70.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thealgorithms_mcp-0.2.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file thealgorithms_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: thealgorithms_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for thealgorithms_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 40b4c793d4b51baef6f39fef3d75a792f95e02ba48a000e51bbddba893ccc9fb
MD5 46252f81d49985df2d506834e5a08c99
BLAKE2b-256 a5fb2fe753087a1eb15dcfd989f9fe074f606ce6274b28651bd39acab6e261ce

See more details on using hashes here.

File details

Details for the file thealgorithms_mcp-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for thealgorithms_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2edb3202c624824cbc1130ad3904d076aeb3aa7730f479be0d960c297d6eb09e
MD5 efccbfe8e0b99530b1e6e9f44e0a01e8
BLAKE2b-256 9152c686506dd3092ca7cec30346e14499abb71a20f6e36986196d4fccb9ff77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page