European Parliament MCP Server API - v1.3.10
    Preparing search index...

    Sub-client for document EP API endpoints.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    baseURL: string

    European Parliament API base URL.

    cache: LRUCache<string, Record<string, unknown>>

    LRU cache for API responses.

    enableRetry: boolean

    Enable automatic retry on transient failures.

    maxResponseBytes: number

    Maximum allowed response body size in bytes.

    maxRetries: number

    Maximum number of retry attempts.

    rateLimiter: RateLimiter

    Token bucket rate limiter.

    timeoutMs: number

    Request timeout in milliseconds.

    Methods

    • Builds EP API parameters for document search.

      Parameters

      • params: { dateFrom?: string; documentType?: string; limit?: number; offset?: number }

      Returns Record<string, unknown>

    • Evicts a single cache entry matching the given endpoint and params. Sub-clients use this when they detect that a successfully-fetched payload is a content-pending sentinel that must not be served from cache for the remainder of the TTL — eviction lets availability recover as soon as the upstream document is enriched.

      Parameters

      • endpoint: string

        API endpoint path (same value passed to get)

      • Optionalparams: Record<string, unknown>

        Optional query parameters (same value passed to get)

      Returns void

    • Executes a cached, rate-limited GET request to the EP API.

      Type Parameters

      • T extends Record<string, unknown>

        Expected response type (extends Record<string, unknown>)

      Parameters

      • endpoint: string

        API endpoint path (relative to baseURL)

      • Optionalparams: Record<string, unknown>

        Optional query parameters

      • OptionalminimumTimeoutMs: number

        Optional per-request minimum timeout in milliseconds. When provided, the effective timeout is Math.max(minimumTimeoutMs, this.timeoutMs), so the global timeout (set via --timeout or EP_REQUEST_TIMEOUT_MS) can still extend it beyond the per-endpoint minimum. Use for known slow EP API endpoints such as procedures/feed.

      • OptionalabortSignal: AbortSignal

        Optional caller-provided cancellation signal. When already aborted on entry the request is rejected immediately before consuming a rate-limiter token (so a cancelled fan-out does not starve the bucket). When aborted mid-flight, the underlying fetch is cancelled and the rejection is surfaced as APIError(..., 0, { cause }).

      Returns Promise<T>

      Promise resolving to the typed API response

      On HTTP errors, network failures, parse failures, or cancellation (statusCode 0). Aborts are NOT retried.

    • Returns cache statistics for monitoring and debugging.

      Returns { hitRate: number; hits: number; maxSize: number; misses: number; size: number }

      { size, maxSize, hitRate, hits, misses }

    • Retrieves recently updated committee documents via the feed endpoint. EP API Endpoint: GET /committee-documents/feed

      Fixed-window feed — no timeframe parameter. Extended timeout applied (120 s minimum).

      Parameters

      • options: { abortSignal?: AbortSignal } = {}

      Returns Promise<JSONLDResponse<Record<string, unknown>>>

    • Retrieves recently updated documents via the feed endpoint. EP API Endpoint: GET /documents/feed

      This is a fixed-window feed — the EP API does NOT accept a timeframe parameter. It returns updates from a server-defined default window (typically one month). Response times can exceed 120 s, so an extended minimum timeout is applied automatically.

      Parameters

      • options: { abortSignal?: AbortSignal } = {}

      Returns Promise<JSONLDResponse<Record<string, unknown>>>

    • Retrieves recently updated external documents via the feed endpoint. EP API Endpoint: GET /external-documents/feed

      This is a configurable-window feed that accepts timeframe, start-date, and work-type parameters. Extended timeout applied for one-month timeframe.

      Parameters

      • params: {
            abortSignal?: AbortSignal;
            startDate?: string;
            timeframe?: string;
            workType?: string;
        } = {}

      Returns Promise<JSONLDResponse<Record<string, unknown>>>

    • Retrieves recently updated plenary documents via the feed endpoint. EP API Endpoint: GET /plenary-documents/feed

      Fixed-window feed — no timeframe parameter. Extended timeout applied (120 s minimum).

      Parameters

      • options: { abortSignal?: AbortSignal } = {}

      Returns Promise<JSONLDResponse<Record<string, unknown>>>

    • Retrieves recently updated plenary session documents via the feed endpoint. EP API Endpoint: GET /plenary-session-documents/feed

      Fixed-window feed — no timeframe parameter. Extended timeout applied (120 s minimum).

      Parameters

      • options: { abortSignal?: AbortSignal } = {}

      Returns Promise<JSONLDResponse<Record<string, unknown>>>

    • Searches legislative documents by keyword, type, date, and committee.

      EP API Endpoint: GET /documents

      Parameters

      • params: {
            keyword: string;
            abortSignal?: AbortSignal;
            committee?: string;
            dateFrom?: string;
            dateTo?: string;
            documentType?: string;
            limit?: number;
            offset?: number;
        }

        keyword, documentType, dateFrom, dateTo, committee, limit, offset

      Returns Promise<PaginatedResponse<LegislativeDocument>>

      Paginated legislative documents list

      Audit logged per GDPR Article 30