legal_scholarship_mcp
Enables searching scholarly literature via the OpenAlex database, with tools for full-text search, work details, citation lookup, and author queries.
README
legal_scholarship_mcp
An MCP (Model Context Protocol) server that lets an AI assistant search scholarly literature — useful for legal and academic research — through the OpenAlex database of 250M+ works. It exposes five read-only tools that a client such as Claude Desktop can call directly.
**Personal proof-of-concept, in active development.** It returns scholarly **metadata and abstracts** — not full-text articles — and it does not give legal advice. The tools below work; more are planned (see Status).
What it does
search\_scholarship— full-text search of works by query, with year filters and sort by relevance / citations / date. Returns title, authors, year, venue, citation count, OpenAlex ID and DOI.get\_work\_details— fetch one work's full record by OpenAlex ID or DOI, including a plain-text abstract reconstructed from OpenAlex's inverted index, and its reference count.find\_citing\_works— the citation-graph workhorse: given a work's ID, find the works that cite it (forward citations), newest or most-cited first.search\_authors— resolve an author name to OpenAlex author profiles (ID, institution, works count, citations, h-index). Names are ambiguous, so this implements OpenAlex's recommended "resolve to an ID first" pattern.get\_author\_works— given an author ID (fromsearch\_authors), list that author's works.
Every tool returns either readable Markdown or structured JSON, and all are read-only.
What it does not do
- It does not return full-text articles (OpenAlex provides metadata and abstracts).
- It does not give legal advice or evaluate authority — it finds and summarises sources for a human to read.
Requirements
pip install -r requirements.txt
OpenAlex API key (free, required)
Since 13 February 2026, OpenAlex requires a free API key for all requests (the old "polite pool" / mailto parameter was retired). Get one in about 30 seconds:
- Create a free account at https://openalex.org.
- Copy your key from https://openalex.org/settings/api.
- Set it in your environment:
export OPENALEX\_API\_KEY="your-free-key"
A free key gives $1 of usage per day — ample for interactive research. The key is sent as the api\_key query parameter on each request.
Run it
Inspect the tools with the MCP Inspector:
mcp dev legal\_scholarship\_mcp.py
Connect it to Claude Desktop — add this to your claude\_desktop\_config.json (Settings → Developer → Edit Config), using the absolute path to the file:
{
"mcpServers": {
"legal-scholarship": {
"command": "python",
"args": \["/absolute/path/to/legal\_scholarship\_mcp.py"],
"env": { "OPENALEX\_API\_KEY": "your-free-key" }
}
}
}
Restart Claude Desktop, and the five tools become available in chat.
How it works
Built on the MCP Python SDK's FastMCP. Each tool validates its inputs with Pydantic field constraints, calls OpenAlex asynchronously via httpx, and formats the result as Markdown or JSON. Shared logic — the API request (with a polite User-Agent and retry-with-exponential-backoff on transient 429/5xx/timeout failures, as OpenAlex recommends), error handling, abstract reconstruction, field formatting and the works-list path — is factored into helper functions. Author queries follow OpenAlex's "resolve a name to an ID, then filter by ID" pattern. Transport is stdio, which is what local clients like Claude Desktop use.
Tests
pip install pytest
pytest
The suite runs fully offline: the deterministic helpers are tested directly, the tools are tested with the network call replaced by a fake, and the retry logic is tested with httpx's MockTransport. No API key or network access is needed. (One test is a regression guard ensuring the pagination parameter stays per\_page, OpenAlex's required spelling.)
Status & roadmap
Working now: the five read-only tools above, with input validation, retries, and Markdown/JSON output.
Planned (this is an in-development prototype):
- Structured tool output — define
outputSchema/ returnstructuredContentper MCP best practice, so clients get typed results rather than text/JSON strings. - More entity coverage — tools for topics, institutions and sources; a related-works tool and a reference-list (backward-citation) tool.
- Open-access PDF retrieval for works that have a free full text.
- An MCP evaluation suite — a set of realistic, verifiable questions (per the MCP evaluation methodology) run against a live key.
- Response caching to reduce repeat calls and cost.
Boundaries and responsible use
Proof-of-concept in development, for demonstration and research only. Not legal advice; it returns scholarly metadata and abstracts, not full text, and does not evaluate the authority or correctness of any source. Confirm anything important against the original. Built through AI-assisted development.
Licence
MIT — see LICENSE.
About
Built by Mahmoud Hussein, an Egypt-qualified lawyer (registered at Appeal level), through AI-assisted development — directing and assembling AI-generated code on a foundation of Python, with the design and the OpenAlex API verification his own. This server is an actively-developed work in progress.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.