Skip to main content
Glama
h-lu

Paper Search MCP Server

by h-lu

download_iacr

Download free PDFs from IACR ePrint using paper IDs like '2024/123' to access cryptographic research papers directly.

Instructions

Download PDF from IACR ePrint (always free).

Args:
    paper_id: IACR ID (e.g., '2024/123', '2009/101').
    save_path: Directory to save PDF.

Returns:
    Path to downloaded PDF.

Example:
    download_iacr("2024/123")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo

Implementation Reference

  • MCP tool handler and registration for download_iacr. Defines input schema via type hints and docstring, delegates to generic _download using 'iacr' searcher.
    @mcp.tool()
    async def download_iacr(paper_id: str, save_path: Optional[str] = None) -> str:
        """Download PDF from IACR ePrint (always free).
        
        Args:
            paper_id: IACR ID (e.g., '2024/123', '2009/101').
            save_path: Directory to save PDF.
        
        Returns:
            Path to downloaded PDF.
        
        Example:
            download_iacr("2024/123")
        """
        return await _download('iacr', paper_id, save_path)
  • Exact implementation of the PDF download logic in IACRSearcher class, constructing the PDF URL and performing the HTTP download.
    def download_pdf(self, paper_id: str, save_path: str) -> str:
        """
        Download PDF from IACR ePrint Archive
    
        Args:
            paper_id: IACR paper ID (e.g., "2025/1014")
            save_path: Path to save the PDF
    
        Returns:
            str: Path to downloaded file or error message
        """
        try:
            pdf_url = f"{self.IACR_BASE_URL}/{paper_id}.pdf"
    
            response = self.session.get(pdf_url)
    
            if response.status_code == 200:
                filename = f"{save_path}/iacr_{paper_id.replace('/', '_')}.pdf"
                with open(filename, "wb") as f:
                    f.write(response.content)
                return filename
            else:
                return f"Failed to download PDF: HTTP {response.status_code}"
    
        except Exception as e:
            logger.error(f"PDF download error: {e}")
            return f"Error downloading PDF: {e}"
  • Generic download helper function that dispatches to the specific platform's searcher.download_pdf method.
    async def _download(
        searcher_name: str, 
        paper_id: str, 
        save_path: Optional[str] = None
    ) -> str:
        """通用下载函数"""
        if save_path is None:
            save_path = get_download_path()
        
        searcher = SEARCHERS.get(searcher_name)
        if not searcher:
            return f"Error: Unknown searcher {searcher_name}"
        
        try:
            return searcher.download_pdf(paper_id, save_path)
        except NotImplementedError as e:
            return str(e)
        except Exception as e:
            logger.error(f"Download failed for {searcher_name}: {e}")
            return f"Error downloading: {str(e)}"
  • Global SEARCHERS dictionary that instantiates and provides the IACRSearcher instance under the 'iacr' key for use by download handlers.
    SEARCHERS = {
        'arxiv': ArxivSearcher(),
        'pubmed': PubMedSearcher(),
        'biorxiv': BioRxivSearcher(),
        'medrxiv': MedRxivSearcher(),
        'google_scholar': GoogleScholarSearcher(),
        'iacr': IACRSearcher(),
        'semantic': SemanticSearcher(),
        'crossref': CrossRefSearcher(),
        'repec': RePECSearcher(),
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/h-lu/paper-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server