VOOZH about

URL: https://deepwiki.com/Digilac/simap-mcp/12-glossary

⇱ Glossary | Digilac/simap-mcp | DeepWiki


Loading...
Menu

Glossary

This page defines codebase-specific terms, jargon, and domain concepts used in the simap-mcp project. It serves as a technical reference for onboarding engineers to understand the mapping between the Swiss public procurement domain and the implementation details in the code.

Core Concepts

MCP (Model Context Protocol)

The architectural foundation of this project. It allows AI models (like Claude) to use local or remote tools via a standardized JSON-RPC based protocol CLAUDE.md7-8

  • McpServer: The main class from @modelcontextprotocol/sdk that manages tool registration and request handling CONTRIBUTING.md136
  • StdioServerTransport: The communication layer that enables the server to talk to the client via stdin and stdout CLAUDE.md38
  • registerTools: A pattern used to modularize tool registration. The McpServer instance is passed to registration functions which call server.tool() CONTRIBUTING.md171-172

simap.ch (Système d'information sur les marchés publics en Suisse)

The official platform for public procurement in Switzerland. This MCP server acts as a wrapper around the simap.ch public API CLAUDE.md7-8

  • SimapClient: A specialized HTTP client (singleton simap) that wraps fetch, handles URL building, timeouts, and Zod response validation src/api/client.ts32-101
  • SIMAP_API_BASE: The base URL for API requests src/api/client.ts6
  • SimapApiError: A custom error class used to wrap non-2xx HTTP responses from the API, including the status code and endpoint src/types/api.ts7

Nomenclature Systems

Public procurement uses several standardized classification systems to categorize what is being bought. The codebase implements search and tree-browsing tools for four major systems:

TermFull NameDomainCode Reference
CPVCommon Procurement VocabularyEU-standardized goods/servicesCLAUDE.md52
BKPBaukostenplanSwiss construction costsCLAUDE.md52
NPKNormpositionen-KatalogStandardized construction itemsCLAUDE.md52
OAGObject typesSpecific procurement objectsCLAUDE.md52
CantonSwiss CantonSub-national administrative divisionsrc/tools/codes/list-cantons.ts1-10

Sources: CLAUDE.md49-58 src/api/client.ts6-7 src/types/common.ts1-27

Domain Mapping Diagram

The following diagram illustrates how natural language concepts from the Swiss procurement domain map to specific TypeScript entities and code structures.

Domain to Code Entity Mapping


Sources: CLAUDE.md44-58 src/utils/formatting.ts7-10 src/types/common.ts1-27

Technical Terms & Implementation Details

Rate Limiting

To prevent overwhelming the simap API and avoid 429 errors, the server implements a queuing mechanism.

  • SlidingWindowRateLimiter: A FIFO-based limiter that ensures requests are throttled according to the window src/api/rate-limiter.ts43
  • acquire(): The method called by SimapClient before every request to wait for an available slot src/api/client.ts48

Translation & Fallback Chain

simap data is inherently multilingual (German, French, Italian, and English). The codebase uses a specific fallback logic to ensure the AI always receives text even if the preferred language is missing.

Project and Publication Structure

The simap API distinguishes between the overall procurement effort and specific notices.

  • Tender: Often used interchangeably with "Project" in the tool layer, represented by ProjectSearchEntry src/utils/formatting.ts7
  • Publication: A specific notice (tender, award, etc.) within a project src/utils/formatting.ts158-161
  • Lot: A sub-division of a tender. The lotTitle in LotEntrySchema is marked as .nullish() to handle API responses where titles are missing CHANGELOG.md58-59
  • fullRaw: A boolean parameter in get_tender_details that, when true, appends the unmodified JSON response to the Markdown output CHANGELOG.md123-124
  • zurichTodayDate: A utility (used in buildTenderSearchQuery) that defaults publicationFrom to the current date in the Europe/Zurich timezone src/tools/search-tenders-params.ts90-97

Formatting & Security

  • formatInlineCode: Wraps user input in a CommonMark-safe inline code span using dynamic backtick fences to handle backticks within the content src/utils/formatting.ts54-63
  • escapeInlineCode: Escapes backslashes and backticks for use in Markdown prose context (e.g., within paragraphs). Now escapes backslashes before backticks to prevent incomplete sanitization src/utils/formatting.ts27-32 CHANGELOG.md22
  • toToolErrorResult: Converts caught errors into a typed user-facing tool result, distinguishing between 404, 4xx, 5xx, and network/timeout issues src/utils/errors.ts44-69

Tool Patterns

  • InputShape/InputSchema/Input pattern: Every tool exports its Zod shape (for registration), the Zod schema (for validation/testing), and the TypeScript type (inferred from schema) CONTRIBUTING.md131-150
  • passthrough (Zod): Used in response schemas to ensure unknown API fields are preserved rather than stripped during validation CHANGELOG.md123-124

Data Flow Diagram

This diagram shows how a request from a user flows through the MCP server logic, specifically highlighting the transformation of search parameters and the role of the rate limiter.

Request and Data Flow


Sources: CLAUDE.md76-81 src/utils/formatting.ts75-111 src/utils/errors.ts44-69 src/tools/search-tenders-params.ts41-87

Reference Tables

Key Functions & Utilities

FunctionPurposeCode Reference
buildUrlConstruct URLs with repeated query keys for arrayssrc/api/client.ts109-131
toToolErrorResultMap exceptions to user-friendly error messagessrc/utils/errors.ts44-69
buildTenderSearchQueryMap user filters to simap API parameterssrc/tools/search-tenders-params.ts41-87
formatPublicationDetailsRender structured tender data into Markdownsrc/utils/formatting.ts158-185
formatInlineCodeCommonMark §6.1 compliant code span wrappingsrc/utils/formatting.ts54-63
getTranslationExtract text using the standard fallback chainsrc/utils/translation.ts15-21

Core Parameters & Config

ParameterMeaningCode Reference
lastItemPagination token for the next page of resultssrc/types/common.ts24
SEARCH_TENDERS_PARAM_MAPStatic mapping of tool keys to API keyssrc/tools/search-tenders-params.ts18-30
SIMAP_MCP_DEBUGEnv var to enable verbose stderr loggingsrc/api/client.ts15-18
changesetsTool for versioning and changelog managementCHANGELOG.md40-43
mcp-publisherWorkflow for dual-registry publicationCHANGELOG.md40

Sources: src/types/common.ts1-27 src/utils/formatting.ts1-185 src/utils/translation.ts1-22 CHANGELOG.md1-124 src/api/client.ts1-137