@cyanheads/pubmed-mcp-server
Version:
Search PubMed/Europe PMC, fetch articles and full text (PMC/EPMC/Unpaywall), citations, MeSH terms via MCP. STDIO or Streamable HTTP.
35 lines • 1.61 kB
TypeScript
/**
* @fileoverview Core HTTP client for NCBI E-utility requests. Handles URL construction,
* API key injection, and GET/POST selection based on payload size. Single-attempt only;
* retry logic lives in NcbiService.performRequest to cover both HTTP and XML-level errors.
* @module src/services/ncbi/api-client
*/
import { type NcbiRequestOptions, type NcbiRequestParams } from './types.js';
export interface NcbiApiClientConfig {
adminEmail?: string;
apiKey?: string;
timeoutMs: number;
toolIdentifier: string;
}
/**
* Low-level HTTP client for NCBI E-utilities. Constructs URLs, injects credentials,
* and chooses GET/POST based on payload size. Single-attempt — retry logic lives
* in {@link NcbiService.performRequest} so it covers both HTTP and XML-level errors.
*/
export declare class NcbiApiClient {
private readonly config;
constructor(config: NcbiApiClientConfig);
makeRequest(endpoint: string, params: NcbiRequestParams, options?: NcbiRequestOptions): Promise<string>;
/**
* Make a GET request to a non-eutils NCBI endpoint (e.g., PMC ID Converter).
* Uses plain fetch (not fetchWithTimeout) so we can capture response bodies on
* error status codes — fetchWithTimeout throws before the body can be read.
* Injects tool and email params but not api_key (eutils-specific).
*/
makeExternalRequest(url: string, params: NcbiRequestParams, externalSignal?: AbortSignal): Promise<string>;
private buildParams;
private shouldPost;
private getRequest;
private postRequest;
}
//# sourceMappingURL=api-client.d.ts.map