Define-XML MCP Server
# define-xml-mcp-server
TypeScript MCP server for CDISC Define-XML.
## Features
- Supports Define-XML 2.0 and 2.1
- Detects Define version and ARM presence from ODM attributes
- Supports both MCP transports:
- `stdio` (default)
- Streamable HTTP (`/mcp` endpoint)
- Local file-path input only
- Multi-document in-memory cache using `document_id`
- Response formats:
- `json`
- `markdown`
## Install
```bash
npm install
```
## Build
```bash
npm run build
```
## Run
### stdio (default)
```bash
npm run dev
```
or
```bash
node dist/index.js --transport=stdio
```
### Streamable HTTP
```bash
node dist/index.js --transport=http --port=3000
```
Server endpoint:
- `POST /mcp`
## Tool Catalog
### Document Tools
- `define_load_document`
- Input: `file_path`, `response_format`
- Loads/parses XML and returns `document_id`
- `define_close_document`
- Input: `document_id`, `response_format`
- Removes document from cache
- `define_get_metadata_summary`
- Input: `document_id`, `response_format`
- Returns metadata and entity counts
### Required List/Get Tools
- Datasets
- `define_list_datasets`
- `define_get_dataset`
- Variables
- `define_list_variables`
- `define_get_variable`
- Codelists
- `define_list_codelists`
- `define_get_codelist`
- ARM
- `define_list_arm_results`
- `define_get_arm_result`
### Search Tool
- `define_search`
## Notes
- ARM is optional. ARM tools return empty results when ARM data is not present.
- All list tools support pagination via `offset` and `limit`.
TDQS
Scored across 13 tools
Each tool has a clearly distinct purpose: loading, closing, listing, and getting specific components (datasets, variables, codelists, ARM results) plus metadata summary and search. No overlap in functionality.
All tools follow the consistent pattern 'define_verb_noun' (e.g., define_load_document, define_list_datasets). Verbs and nouns are descriptive and uniform.
13 tools is well-scoped for a Define-XML document server: covers loading, reloading, querying individual items, listing with pagination, search, metadata summary, and memory management (close). Not excessive nor too sparse.
The tool set covers all fundamental read operations for Define-XML documents: load, list and get datasets/variables/codelists/ARM results, search, and metadata summary. Minor gaps like retrieving item groups beyond datasets or getting raw XML snippets exist but don't hinder core usage.