sas-local-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| SAS_DATA_ROOT | No | 数据根目录,所有数据集路径必须落在其内(沙箱边界)。支持 ~ 家目录展开;未设置时退化为启动进程的当前目录。建议始终设置为你的数据根目录。 | 进程当前工作目录(CWD) |
| SAS_LOCAL_MCP_NAME | No | 服务名(显示在客户端)。 | sas-local-mcp |
| SAS_LOCAL_MCP_ENCODING | No | 数据集字符编码;中文数据常需 utf-8 或 gbk。 | |
| SAS_LOCAL_MCP_MAX_ROWS | No | 行预览上限:read_dataset 一次最多返回多少条原始记录。 | 200 |
| SAS_LOCAL_MCP_CACHE_SIZE | No | 缓存多少个已解析数据集(按 mtime/size 失效);0 关闭。 | 8 |
| SAS_LOCAL_MCP_MAX_AGG_ROWS | No | 聚合结果上限:frequency 的取值个数、query_dataset 的返回行数。 | 1000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"subscribe": false,
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_datasetsA | 列出 SAS_DATA_ROOT 下所有 SAS 数据集文件(.sas7bdat / .xpt / .sas7bcat)。 |
| get_dataset_metadataB | 获取数据集元数据:行数、每变量 label/type/format、文件标签、创建时间。 |
| read_datasetA | 按 offset/limit 分页读取记录(records 为 JSON,NaN 为 null,日期为 ISO 字符串)。 |
| summarize_datasetA | 逐变量概要统计——了解一张表的首选入口,省去手写 SQL。 每个变量给出:类型、非空数 n、缺失数 n_missing、缺失率 pct_missing、 唯一值数 n_distinct,以及 has_value_labels(有值标签时改用 frequency 看解码分布)。 再按类型给分布指标: 数值 -> mean/std/min/p25/median/p75/max; 日期 -> min/max; 字符 -> max_length 与 Top5 取值(value/label/n/pct)。 |
| frequencyA | 单变量频数表:各取值的 n 与占比,默认自动套用 SAS 值标签。 结果按 n 降序;原始 value 与解码后的 label 一并返回。 denominator 回传百分比的分母(include_missing 为 True 时是总行数,否则是非缺失行数)。 |
| get_value_labelsB | 获取变量的 SAS 格式值标签映射(QC 时解码 coded 值用)。 |
| query_datasetA | 对数据集执行 duckdb SQL(仅 SELECT / WITH)。 主数据集表名固定为 dataset。传入 extra_paths 可再注册附加表,表名取文件名主干 (如 lb.sas7bdat -> lb),冲突时回退 dataset2/dataset3;返回的 tables 给出 表名->路径 映射。用于跨数据集对比,例如: sql="SELECT COUNT(*) FROM dataset a FULL JOIN lb b USING(USUBJID)" |
| search_variablesA | 在 SAS_DATA_ROOT 下搜索含指定变量的数据集。 回答"哪个数据集里有 USUBJID / 哪些表有 AEDECOD",避免逐个 get_dataset_metadata 试错。只读取元数据,不加载数据行;损坏文件记入 errors 而不中断搜索。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 8 tools
Each tool targets a distinct step in the SAS data exploration workflow: discovery (list_datasets, search_variables), schema (get_dataset_metadata, get_value_labels), and content (read_dataset, summarize_dataset, frequency, query_dataset). The closest pair is summarize_dataset vs frequency, but the descriptions explicitly delineate overview-per-variable versus single-variable frequency table. read_dataset vs query_dataset also overlap slightly (both return rows), though paging vs SQL is clear enough.
Seven of eight tools follow a clean verb_noun snake_case pattern (list_datasets, get_dataset_metadata, read_dataset, summarize_dataset, get_value_labels, query_dataset, search_variables). The outlier is 'frequency', a bare noun that breaks the verb-first convention. Minor deviation, still readable and predictable overall.
Eight tools is well-scoped for a local SAS dataset inspection server, with each tool earning its place across discovery, metadata, reading, summarization, and querying. No redundant or filler tools are present.
The surface covers discovery, schema inspection, row reading, statistical summaries, value-label decoding, and arbitrary SQL querying — a full read-side lifecycle for local SAS data. Gaps are minor: no export/materialization of results (e.g., write to CSV/parquet) and no explicit write/modify operations, though the latter is plausibly intentional for a read-only analysis server.