Skip to main content

Read-only MCP server for DSpace 7+ repositories

Project description

dspace-mcp

CI PyPI Python License: MIT

A read-only MCP server that lets an AI assistant talk to any DSpace 7+ repository.

Ask your repository questions in plain language — "how many theses did we publish in 2025?", "which authors appear most often in this collection?", "summarise the PDF attached to this item" — and the assistant answers by querying the DSpace REST API directly.

Read-only by construction, not by promise

The server holds no credentials and never issues a request other than GET. It cannot deposit, edit or delete anything, and it cannot read what the public cannot already see — embargoed items, workflow submissions and restricted collections stay invisible.

That is a property of the code, not of the model's behaviour: there is nothing to prompt-inject your way into. A test in the suite asserts that no other HTTP method ever leaves the process.

Install

Nothing to install if you have uv:

uvx dspace-mcp --base-url https://demo.dspace.org/server

Or with pip:

pip install dspace-mcp

Configure your MCP client

Claude Code:

claude mcp add dspace -- uvx dspace-mcp --base-url https://demo.dspace.org/server

Claude Desktop / any client using mcp.json:

{
  "mcpServers": {
    "dspace": {
      "command": "uvx",
      "args": ["dspace-mcp", "--base-url", "https://demo.dspace.org/server"]
    }
  }
}

Point --base-url at your own repository's REST API — usually your DSpace URL with /server appended. If you leave /server off, the server detects it and corrects the URL for you.

To connect to several repositories, add several entries under different names. One process serves exactly one repository, which keeps the assistant from mixing them up.

Tools

Tool What it does
search_items Search items; filter by year range, author, collection; sort by relevance, date or title. limit=0 returns just the count.
get_item Fetch one item by UUID, Handle or DOI — whichever identifier you happen to have.
list_communities Walk the community tree (up to 3 levels).
list_collections List collections, of one community or of the whole repository.
list_bitstreams List an item's files with sizes, MIME types, checksums and download URLs.
get_bitstream_text Extract the text of a bitstream so the assistant can read or summarise it — PDF, Word (.docx/.doc), OpenDocument (.odt/.ods/.odp) and Office XML (.pptx/.xlsx).
list_facet_values Count values of a facet (authors, subjects, years) — the repository does the counting, so no records are downloaded.
get_item_statistics View count of an item.
get_repository_info Name, version, item counts, and which search filters, sort fields and facets this instance actually supports.

Two things worth knowing

Ask get_repository_info first. DSpace installations differ: the set of search filters and facets is configured per instance, so a filter that exists on one repository returns an error on another. This tool reports what the instance in front of you supports.

Counting is free. search_items with limit=0, and list_facet_values, answer "how many" questions with a single request and a handful of tokens, instead of downloading records and counting them.

Configuration

Variable Default Meaning
DSPACE_BASE_URL (required) REST API root, e.g. https://demo.dspace.org/server
DSPACE_TIMEOUT 15 seconds per HTTP request
DSPACE_MAX_RESULTS 50 hard ceiling on how many records any tool may return
DSPACE_EXTRACT_MAX_MB 20 refuse to download bitstreams larger than this for text extraction

Every variable has a matching flag: --base-url, --timeout, --max-results, --extract-max-mb.

DSPACE_PDF_MAX_MB / --pdf-max-mb still work as backward-compatible aliases for DSPACE_EXTRACT_MAX_MB / --extract-max-mb from before text extraction covered more than PDF.

Compatibility

Nothing here branches on a version number. The server asks each instance which search filters, sort fields and facets it supports and works from that answer, which is what actually varies between installations — two sites on the same DSpace version can differ more than two versions of the same site.

The offline test suite runs against recorded responses from a live DSpace 10.1-SNAPSHOT (demo.dspace.org), covering every endpoint the server touches, plus root and search responses from a vanilla 7.6.5, a DSpace-CRIS 8.2 and an 11.0-SNAPSHOT for comparing response shape. The contract tests (pytest -m live) run against one instance at a time — demo.dspace.org by default, or point DSPACE_TEST_URL at your own.

While the tool was being designed, its assumptions about the REST API were checked by hand against live instances of 7.2.1, 7.5, 7.6.5, 8.2, 8.4, 9.2, 10.1 and 11.0-SNAPSHOT. That was a survey of the API, not a test run of this code. If it misbehaves on a version or a configuration I could not test, a bug report is welcome.

Development

git clone https://github.com/mpasternak/dspace-mcp
cd dspace-mcp
uv sync --dev
uv run pytest              # unit tests, offline
uv run pytest -m live      # contract tests against demo.dspace.org
uv run ruff check .

Contributions are welcome. The design and its rationale — including why several plausible-sounding assumptions about the DSpace API turned out to be wrong — live in docs/superpowers/specs/.

License

MIT — see LICENSE.

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

dspace_mcp-0.2.0.tar.gz (89.3 kB view details)

Uploaded Source

Built Distribution

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

dspace_mcp-0.2.0-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dspace_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 89.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for dspace_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 01b3f641125958b196088751e773f255b66a457a7549779a08cf691a07db4958
MD5 b36dc4318d21e724be1f08b15a8c2153
BLAKE2b-256 cee7fd514c17b6159b890b171f86705d28ad78f45590d2ab3a8870194996b553

See more details on using hashes here.

Provenance

The following attestation bundles were made for dspace_mcp-0.2.0.tar.gz:

Publisher: publish.yml on mpasternak/dspace-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: dspace_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for dspace_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 331e8396e8fa798250398990f6e3268ef24b0bc301c51442e68c2c72d1f3da40
MD5 ab11109b70cd83664e7929737ebdcf33
BLAKE2b-256 81f4201868a6302eda9cf68c35ad70cc95feb5b636b1efa1d479094f024cafbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for dspace_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on mpasternak/dspace-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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