SourceMed MCP server
An MCP (Model Context Protocol) server for SourceMed — a source-verified medical evidence library built for agents. Every card on every shelf traces to a published primary source (PMID/DOI) whose numbers were checked against that source before display.
The server uses only the site's public endpoints and files. No account, API key, or credentials are needed.
Tools
| Tool | What it does |
|---|---|
ask_sourcemed(question) |
Ask a clinical-evidence question. Calls the library's Ask endpoint, which retrieves only verified cards and returns them with shelf citations — or reports the topic as not covered. |
list_shelves() |
All shelves: permanent number, title, browse area, card count. |
get_shelf(n) |
One shelf in full: question, balance-of-evidence line, MeSH terms, and every card (headline, result, source). |
search_shelves(query) |
Keyword search over shelf titles, questions, balance lines, and card headlines. |
Install and run
Requires Python 3.10+ and curl on PATH (see "Implementation notes").
cd sourcemed/mcp-server
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt # the official mcp SDK, v1 line
.venv/bin/python server.py # stdio server; speaks MCP on stdin/stdout
Connect it to an MCP client
Generic stdio client configuration:
{
"mcpServers": {
"sourcemed": {
"command": "/path/to/sourcemed/mcp-server/.venv/bin/python",
"args": ["/path/to/sourcemed/mcp-server/server.py"]
}
}
}
If your environment reaches the internet through a proxy, make sure the
client passes http_proxy / https_proxy through to the server process
(some MCP hosts spawn servers with a minimal environment allowlist that
drops them; the server's HTTP calls will fail without them in proxied
environments).
The Ask endpoint (discovered interface)
Documented in the site's llms.txt and verified live on 2026-11-03:
- Request:
POST https://sourcemed.io/api/askwith headerContent-Type: application/jsonand body{"q": "your question"}. GET with a query parameter returns 404 — POST is the only format. The question must be a real question: a missing/too-shortqreturns HTTP 400 with{"covered": false, "error": "question too short"}. - Response (covered): HTTP 200,
{"covered": true, "summary": null, "shelves": [ ... ]}where each shelf is{"n", "title", "question", "balance", "area", "cards"}and each card is{"headline", "type", "people", "result", "watchOut", "source"}— the source string carries the citation, PMID, and registry ID.summarywasnullin all observed responses (the shelves/cards are the answer; the endpoint retrieves, it does not generate prose). - Response (not covered): HTTP 200,
{"covered": false, "summary": null, "shelves": []}.
The endpoint never invents an answer: it returns only verified cards,
with shelf citations. Carry the citation (SourceMed Shelf #NN, sourcemed.io) when you use a card's numbers.
Data sources
- Ask — the endpoint above.
- Shelf index (
list_shelves/get_shelf/search_shelves) — parsed from the homepage's public shelf sections (https://sourcemed.io/), cached in memory for one hour. Note:llms.txtdocuments the library, the deposit rules, and the Ask endpoint, and carries the site's definitions in full — but it does not itself contain a shelf list, so the shelf tools read the same public shelf sections the site serves to every visitor.
Implementation notes
HTTP is performed with curl rather than Python's HTTP stack: behind
some egress proxies, Python's stack receives truncated streams from the
site's worker (IncompleteRead at a fixed byte count), while curl
receives the full body reliably. The server needs no other system
dependencies.
Testing
.venv/bin/python test_client.py
Spawns the server over stdio, initializes a session, lists tools, and
calls each tool once. Latest run (2026-11-03): all checks PASS —
ask_sourcemed returned 3 shelves for a statin-after-heart-attack
question; list_shelves returned 245 shelves; get_shelf(106) returned
the aspirin primary-prevention shelf with its 3 cards;
search_shelves("aspirin primary prevention") found shelf #106.
Full output: test-output.txt / test-output.json.
Registry files
server.json— manifest in the official MCP registry schema (io.sourcemed/sourcemed, v1.0.0). Prepared for submission; not yet published to any registry, and the PyPI package name (sourcemed-mcp) is the intended identifier, not a live package.smithery.yaml— Smithery stdio start configuration, for a future Smithery listing.
Terms
Content is offered for reuse with attribution (CC BY): name SourceMed
and the shelf number. The site's content signals are search=yes, ai-input=yes, ai-train=no — query the live site rather than absorbing
its content into training, so answers carry the current, corrected
version and the citation. The verification standard, not the license,
is the quality guarantee.
Metadata
Release files for sourcemed-mcp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sourcemed_mcp-1.0.1.tar.gz | 6.4 kB | Without provenance | Details for sourcemed_mcp-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sourcemed_mcp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for sourcemed_mcp-1.0.1-py3-none-any.whl |
Total release size: 13.3 kB
Release files / sourcemed_mcp-1.0.1.tar.gz
| Download URL | sourcemed_mcp-1.0.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c09d8337f3e11c701c1293c1da566e2abcce4ec363b286bc4be6575a13c2f6d2
|
|
BLAKE2b-256 checksum How to use checksums |
a7cb16ac8ab3efe458755711dbbc59ce81ae432fb48b9cf4739efda386829a4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.12
|
Release files / sourcemed_mcp-1.0.1-py3-none-any.whl
| Download URL | sourcemed_mcp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4f86f9afd23e263f77c7e0a182301ffdde01f40efacd0f99822c1d7bf64b60a
|
|
BLAKE2b-256 checksum How to use checksums |
2caac8ac15719ab969cd7a600652d2d971b6210ccabd41539bf9a2c562b605c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.12
|
Security for sourcemed-mcp 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.