wikimedia
Searches Wikimedia Commons for media by phrase or exact title with filters for SVG, image, audio, video, or PDF files. Resolves files to source page, direct URL, dimensions, size, artist, license, and restrictions; generates Markdown, HTML, URL, or attribution references; downloads original media or rendered previews with a JSON provenance sidecar; and lists direct file members of Commons categories with pagination.
Retrieves Wikipedia article introductions or full extracts, revision links, optional wikitext, and image titles.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@wikimediafind a reusable photo of the Eiffel Tower on Wikimedia Commons"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Quick Start
Python 3.11 or newer is required. Install uv to create the project environment and install the optional MCP server dependency.
cd ~/Projects/wikimedia
uv sync --extra mcp
.venv/bin/wikimedia --help
.venv/bin/wikimedia search "Discogs logo" --type svg --limit 5If the shell command is already installed, run wikimedia "Discogs logo" to open the interactive result picker. Use an exact Commons file title for repeatable downloads and references.
cd ~/Projects/wikimedia
python3 -m venv .venv
.venv/bin/python -m pip install -e ".[mcp]"Search results are ranked suggestions. Check the file page, license, attribution, and restrictions before reusing media.
Related MCP server: call-copilot
Features
Feature | What it does | |
Commons search | Search files by phrase and filter by SVG, image, audio, video, or PDF. | |
File details | Resolve an exact title to source page, original URL, size, dimensions, artist, license, and restrictions. | |
References | Format Markdown, HTML, a direct URL, or an attribution line. | |
Downloads | Save original media or a rendered preview with a JSON provenance sidecar. Existing files are protected unless | |
Categories | List direct file members of a Commons category and continue through result pages. | |
Wikipedia | Retrieve an article introduction or full extract, revision link, optional wikitext, and image titles. | |
MCP tools | Expose Commons and Wikipedia lookups to MCP-compatible clients over local stdio. |
Compatibility
Platform | CLI and MCP core | Clipboard and open |
macOS | Python 3.11+ | Text and file clipboard via |
Linux | Python 3.11+ | Text clipboard via |
Windows | Not verified | Clipboard and open helpers are not implemented for Windows. |
The HTTP client uses Python's standard library. MCP support adds the optional mcp package. The project is developed and verified on macOS; platform entries describe the integrations present in the code.
Workflow
Step | What happens | CLI example |
Search | Find media by phrase, exact title, or Commons URL. |
|
Review | Inspect creator, source, license, and restrictions. |
|
Choose | Pick an original, rendered preview, or reference format. |
|
Act | Download, copy, or open the file page. |
|
Retain | Keep the media and its provenance sidecar together. |
|
Interactive terminals show a numbered picker and action menu. In a non-interactive shell, a plain search prints results; a search combined with an action uses the first ranked result. Use an exact File: title when a script must target a specific item.
Usage
Search And Select
# Interactive search and selection in a terminal
wikimedia "Discogs logo"
# Filter for vector files and print structured results
wikimedia search "Discogs logo" --type svg --limit 5 --json
# Search for images, audio, video, or PDF files
wikimedia search "field recording" --type audio --limit 10search is optional for a Commons query. The first example uses the interactive selector when stdin is a terminal. --json disables interactive output.
Inspect A File
wikimedia info "File:Discogs icon.svg"
wikimedia "https://commons.wikimedia.org/wiki/File:Discogs_icon.svg" --jsonThe record includes the Commons source page and direct media URL, file dimensions and size, MIME type, upload timestamp, artist, license fields, and restrictions such as trademark notices.
Create References
# Print a Markdown image reference
wikimedia md "File:Discogs icon.svg"
# Print an HTML image element with a display height
wikimedia html "File:Discogs icon.svg" --height 32
# Print the direct media URL or an attribution line
wikimedia url "File:Discogs icon.svg"
wikimedia attr "File:Discogs icon.svg"
# Copy a Markdown reference to the text clipboard
wikimedia md -c "File:Discogs icon.svg"When l or url is used without a style, an interactive terminal offers Markdown, HTML, URL, and attribution formats. md, html, and attr select a format directly. A width requests a Wikimedia thumbnail, which may change an SVG reference into a PNG preview URL.
Download Media
# Download the original file to ./downloads
wikimedia d --out ./downloads "File:Discogs icon.svg"
# Download a 120 px preview. SVG previews are raster PNGs.
wikimedia d --out ./downloads --width 120 "File:Discogs icon.svg"
# Download and copy the downloaded file to the system clipboard
wikimedia d c --out ./downloads "File:Discogs icon.svg"
# Download, print a Markdown reference, and force replacement if needed
wikimedia d l md -f --out ./downloads "File:Discogs icon.svg"Each download writes a sibling .wikimedia.json file with the source record, representation, retrieval time, byte count, and SHA-256 hash. Downloads are staged before publication and do not overwrite existing media or sidecars by default.
Group short actions:d c downloads then copies the file; d l md downloads and prints Markdown. -O is the short output-directory flag. -o means open in a browser.
Browse Categories
wikimedia category "ITunes logos" --limit 10
wikimedia cat "Category:Discogs logos" --limit 20 --jsonThe category command lists direct file members, not recursive descendants. Use --cursor with the continuation token from JSON output to request another page.
Read Wikipedia
# Fetch an article introduction
wikimedia wiki "MediaWiki"
# Fetch the full plain-text extract or include revision wikitext
wikimedia wiki "MediaWiki" --full
wikimedia wiki "MediaWiki" --full --wikitext --language en
# Create a revision-specific Markdown citation
wikimedia wiki md "MediaWiki"The CLI fetches a known article title. Wikipedia title search is available through the MCP wikipedia_search tool; the CLI does not currently expose a separate Wikipedia search command. wikipedia_list_images returns titles only. Some may be local Wikipedia files or non-free media, so a title alone does not establish that a Commons download is available.
Copy And Open
Action | Command | Behavior |
Open |
| Opens the Commons file page in the default browser. |
Copy a reference |
| Copies the generated text reference. |
Copy a file |
| Downloads the original, then copies the file item where supported. |
On macOS, file clipboard uses AppleScript and text clipboard uses pbcopy. On Linux, text clipboard tries wl-copy, xclip, then xsel; file clipboard falls back to copying the local path. Browser opening uses open on macOS and xdg-open on Linux.
Commands
Command | Purpose | Example |
| Search Commons or resolve a supplied file, category, or supported Wikimedia URL. |
|
| Search Commons media. |
|
| Print full metadata. |
|
| Download original media or a width-rendered preview. |
|
| Generate a Markdown, HTML, URL, or attribution reference. |
|
| Open the Commons file page. |
|
| List direct Commons category members. |
|
| Fetch a Wikipedia article. |
|
| Start the MCP stdio server. |
|
Option | Default | Meaning |
| Current directory | Download destination. |
|
| Request a rendered thumbnail at this width. |
|
| HTML reference display height. |
|
| Result count, from 1 to 50. |
|
| Search offset, from 0 to 10,000. |
|
| Commons filter: |
| API filename | Choose a safe output filename. |
|
| Wikipedia language code. |
| Off | Fetch a full Wikipedia text extract. |
| Off | Include the current revision wikitext. |
| Empty | Continue a Commons category listing. |
| Off | Replace an existing media file and sidecar. |
| Off | Copy the downloaded file or generated reference to the clipboard. |
| Off | Download the selected file. |
| Off | Generate a reference; prompts for format in an interactive terminal. |
| Off | Select Markdown or HTML reference output. |
| Off | Emit JSON rather than styled terminal output. |
| — | Show usage. |
| — | Print the CLI version. |
Short actions can be separate words (d c) or grouped (-dcf). --out may appear before or after the query. The output-directory short flag is -O; -o is reserved for open.
MCP Server
Install the optional MCP dependency with uv sync --extra mcp. The server uses stdio and exposes nine tools for Commons search, file metadata, categories, references, downloads, Wikipedia articles, images, and citations.
# Start the standalone server with downloads disabled
.venv/bin/wikimedia-mcp
# Enable downloads under a fixed directory
.venv/bin/wikimedia-mcp --download-dir ~/Downloads/Wikimedia
# Or start it through the main CLI
.venv/bin/wikimedia mcp --download-dir ~/Downloads/WikimediaAdd the executable to your MCP client's configuration. Use an absolute path to the checkout and choose a download directory the server may write to.
{
"mcpServers": {
"wikimedia": {
"command": "/absolute/path/to/wikimedia/.venv/bin/wikimedia",
"args": [
"mcp",
"--download-dir",
"/absolute/path/to/wikimedia-downloads"
]
}
}
}Tool | What it returns |
| Ranked Commons files with optional type filter, preview width, and continuation. |
| Exact file record and reuse metadata. |
| Direct file members and category continuation. |
| URL, Markdown, HTML, or attribution text. |
| Downloaded file and provenance sidecar under the configured root. |
| Search results for an article query and language. |
| Article intro or full extract with revision metadata. |
| Image titles on a Wikipedia article. |
| Citation text tied to a retrieved revision. |
Downloads are disabled until a root is configured with --download-dir or WIKIMEDIA_DOWNLOAD_DIR. MCP downloads accept a relative subdir, validate path containment, and refuse to overwrite existing files.
Configuration
There is no configuration file or API key. The CLI reads these environment variables when present:
Variable | Default | Purpose |
|
| Override the HTTP User-Agent sent to Wikimedia. Include a contact URL in a custom value. |
| Unset | Enable MCP downloads under this directory when no |
| Unset | Disable ANSI colors when set. |
|
| Set to |
The CLI defaults downloads to the current directory. --out changes that location for a command; it does not enable MCP downloads.
Reuse And Safety
Wikimedia records can contain license, author, source, and restriction metadata. The tool carries that data into references and download sidecars, but it does not determine whether a particular reuse is lawful or whether a mark may be used commercially.
A public-domain copyright status does not remove trademark restrictions. Review the Commons file page and relevant rights before publishing or redistributing a file.
The header mark is Commons-logo.svg, by Reidab, Grunt, 3247, and Pumbaa. It is licensed under CC BY-SA 3.0 and is identified on Commons as a Wikimedia trademark. Its source record is preserved in assets/Commons-logo.svg.wikimedia.json; see the Commons file page.
The downloader only accepts HTTPS Wikimedia media hosts, follows redirects only to supported hosts, caps files at 100 MiB in the CLI, and checks the downloaded original size against the API record when available. --force replaces both the media file and sidecar.
How It Works
The CLI and MCP adapter share one Python core. Both query the same Wikimedia APIs and use the same reference formatter and downloader. The downloader writes a media file and a provenance sidecar. Network access uses Python's standard library; the MCP SDK is the only optional runtime dependency.
Component | Responsibility |
| API requests, title and URL parsing, response shaping, retry handling. |
| Escaped Markdown and HTML references plus attribution text. |
| Host validation, bounded transfer, no-clobber publication, SHA-256, sidecar metadata. |
| Platform clipboard and default-app integration. |
| Flexible action parser, search workflow, and terminal selection. |
| MCP stdio tools using the shared core. |
Troubleshooting
Install the optional server dependency from the project root:
uv sync --extra mcpChoose another destination or filename. Add --force only when replacing both the media and its metadata sidecar is intended.
Some files have no preview URL at the requested size. Remove --width to use the original file, or try a smaller width.
On macOS, check that pbcopy and osascript are available. On Linux, install one of wl-copy, xclip, or xsel for text. File-item clipboard integration is macOS-specific.
Check network access and retry later. The client retries temporary API or transport failures, but honors long Retry-After pauses by returning an error rather than sleeping for an extended period.
Structure
wikimedia/
├── assets/
│ ├── Commons-logo.svg # Wikimedia Commons source mark
│ ├── Commons-logo.svg.wikimedia.json # License and source record
│ ├── wikimedia-header.svg # Repository header banner
│ ├── workflow.svg # Wide workflow graphic
│ └── workflow-mobile.svg # Mobile workflow graphic
├── bin/
│ └── wikimedia # Symlink-friendly development launcher
├── src/wikimedia_tool/
│ ├── cli.py # Command-line entry point
│ ├── client.py # Shared Wikimedia API client
│ ├── clipboard.py # Clipboard and system-open helpers
│ ├── downloads.py # Safe media transfer and provenance
│ ├── references.py # Markdown, HTML, URL, attribution output
│ ├── server.py # Optional MCP stdio server
│ └── ui.py # Terminal cards and selectors
├── tests/
│ └── test_wikimedia.py # Unit tests
├── downloads/ # Local download examples and output
├── pyproject.toml # Package metadata and entry points
└── uv.lock # Locked development environmentDevelopment
uv sync --extra mcp
uv run python -m unittest discover -s tests -v
uv run wikimedia --help
uv buildThe test suite uses the standard-library unittest runner. Tests mock network transfers; live API and download behavior should be checked separately when changing the HTTP client or downloader.
License
𝗗𝗢 𝗪𝗛𝗔𝗧 𝗧𝗛𝗘 𝗙𝗨𝗖𝗞 𝗬𝗢𝗨 𝗪𝗔𝗡𝗧 𝗧𝗢 𝗣𝗨𝗕𝗟𝗜𝗖 𝗟𝗜𝗖𝗘𝗡𝗦𝗘
𝗖𝗢𝗣𝗬𝗥𝗜𝗚𝗛𝗧 © 𝟮𝟬𝟮𝟲 𝗗𝗘𝗔𝗧𝗛𝗥𝗔𝗦𝗛𝗘𝗗
This server cannot be deployed
Maintenance
Related MCP Connectors
Wikimedia Commons MCP — Action API for files.
MCP server for StyleKit styles, tokens, recipes, lint and repair over stdio or HTTP.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server providing web search, news search, and X/Twitter search capabilities via HTTP or stdio.-
- AlicenseNot gradedqualityAmaintenanceSearch and read locally-recorded meeting transcripts over stdio. Read-only, no network. Exposes list_sessions, get_session, and search_transcripts to any MCP client.67 PyPI7MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that exposes a single tool to retrieve Wikipedia articles from local multistream dump files, offering fast offline access with redirect following and fuzzy matching.-

openrhyme-mcpofficial
AlicenseAqualityBmaintenanceEnables any MCP-compatible agent to query a local OpenRhyme activity timeline, search history, and issue control commands over stdio while keeping all data on-machine.5MIT