SAS MCP Server
OfficialThis is a SAS Viya MCP server that lets an AI client execute SAS code and drive the full SAS Viya analytics lifecycle — from data discovery and preparation through reporting, AutoML, model scoring, decisioning, and business glossary governance.
Run SAS code (Tier 0/8):
execute_sas_codein a persistent, reusable per-user compute session (state like WORK tables and macro variables carries over), plusreset_compute_sessionandlist_compute_contexts.Discover data (Tier 1): search the SAS Information Catalog (
catalog_search, facet/instance helpers, discovery agents, ad-hoc profiling), browse CAS servers/caslibs/tables and compute libraries/tables/columns, and run read-only FedSQLSELECTqueries (query_data) over CAS or compute data.Move and manage data (Tier 2): upload files/URLs into CAS tables, create small inline tables, promote source tables into memory, and list/upload/download files in the Viya Files Service.
Build and export reports (Tier 3): list/get/copy/delete Visual Analytics reports, learn the object catalog (
describe_report_objects), create reports and apply atomic batches of native VA operations (pages, charts, layouts, data swaps), read report outlines, and export to package/pdf/png/svg/csv/tsv/xlsx/summary.Run async batch jobs (Tier 4): submit SAS jobs, poll status, list jobs, cancel, and fetch job logs.
Do AutoML (Tier 5): create, run, and list ML projects; register or publish champion models.
Manage and score models (Tier 6): list registered models, publishing destinations, and MAS modules; inspect MAS step signatures and score data against published models/decisions.
Build decisions (Tier 7): author and version business rule sets and rules, create/update decision flows, inspect generated DS2 code, lock revisions, and publish a decision to MAS so it can be scored.
Govern a business glossary (Tier 9): search/list/read/author glossary terms (including bulk import with hierarchy and dry-run preview), design term types and attributes, and assign/unassign terms to table columns to link vocabulary to data.
Use interactive MCP Apps views: data grids, colour-coded SAS log viewers with HTML results, glossary term editors/browser, and an import preview — in clients that support the extension.
Apply prompt templates for debugging SAS logs, profiling datasets, data-quality checks, statistical analysis, code optimization/explanation, macro building, report generation, and VA dashboard building.
Deploy flexibly: HTTP (OAuth2 PKCE), stdio (cached token), Docker, or Kubernetes, with tier selection (
MCP_TIERS), read-only mode (MCP_READ_ONLY), and optional usage telemetry or HTTP debug tracing.
Enables GitHub Copilot to interact with SAS Viya, allowing AI-assisted SAS code development, execution, and analytics workflows.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SAS MCP Server run a SAS program to summarize sales data by region"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SAS Viya MCP Server
A Model Context Protocol (MCP) server for executing SAS code, training AutoML projects, scoring models and so much more for SAS Viya environments.
Features
137 tools across 12 selectable tiers, spanning the Analytics Life Cycle on SAS Viya
Interactive views (MCP Apps) for data, SAS logs and glossary editing in clients that render them — Claude, ChatGPT, Microsoft 365 Copilot, VS Code, Cursor
Prompt Templates for improving your SAS Code
OAuth2 authentication with PKCE flow
HTTP-based MCP server compatible with MCP clients
Related MCP server: ssh-mcp-server
Articles & Videos
Here you can find getting articles on how to use and integrate the SAS MCP Server in different tools and what to build with it:
From REST APIs to AI Agents: Why the SAS Viya MCP Server Matters
Connecting GitHub Copilot to SAS Viya with the SAS Viya MCP Server
Bring Your Own Key: SAS Viya MCP Server with GitHub Copilot CLI
Connecting Claude Code CLI to SAS Viya with the SAS Viya MCP Server
Five Industry Use Cases using the SAS Viya MCP Server as Videos
Getting Started
Prerequisites
Required
SAS Viya environment with compute service
Which tools work on which Viya release (LTS 2024.09 to Stable 2026.10): see COMPATIBILITY.md
Setup the Viya environment for MCP
See configuration.md
Optional
Docker: refer to container setup
Kubernetes: sample manifests (Contour or nginx) and a Helm chart in deploy/
Installation
Clone the repository:
git clone <repository-url>
cd sas-mcp-serverInstall dependencies
uv syncNOTE: This will by default create a virtual environment called .venv in the project's root directory.
If for some reason the virtual environment is not created, please run uv venv and then re-run uv sync.
Run uv sync again after each git pull, with every MCP client that uses this checkout closed. The stdio client configurations below start the server with uv run --no-sync, so they never sync .venv themselves: on Windows, a sync while another copy of the server is running fails on its locked .exe and the server does not start (see TROUBLESHOOTING.md).
Usage
Configure environment variables:
cp .env.sample .envEdit .env and set
VIYA_ENDPOINT=https://your-viya-server.comStart the MCP server (see Choosing a deployment mode below):
Option A: HTTP mode (pre-run the server, connect from MCP client)
uv run appThe server will be available at http://localhost:8134/mcp by default. Authentication is handled via OAuth2 PKCE flow in the browser.
Option B: Stdio mode (MCP client starts the server on demand)
Authenticate once. Two equivalent options:
# Option B1 — if you have the SAS Viya CLI installed:
sas-viya auth loginCode
# Option B2 — built-in helper, no external CLI needed (Viya 2022.11+):
uv run sas-mcp-loginBoth flows write an access token to a local cache (~/.sas/credentials.json and ~/.sas-mcp-server/credentials.json respectively); the stdio server reads whichever it finds. When the token expires, re-run the same command.
Then configure your MCP client to launch the server directly (see below).
Option C: Docker / Podman (containerized deployment)
Pull the pre-built image from GitHub Container Registry:
docker pull ghcr.io/sassoftware/sas-mcp-server:latest
docker run -e VIYA_ENDPOINT=https://your-viya-server.com -p 8134:8134 ghcr.io/sassoftware/sas-mcp-server:latestOr build locally from source:
docker build -t sas-mcp-server .
docker run -e VIYA_ENDPOINT=https://your-viya-server.com -p 8134:8134 sas-mcp-serverAvailable image tags:
latest— most recent tagged release<major>.<minor>.<patch>(e.g.1.0.0) — specific release<major>.<minor>(e.g.1.0) — latest patch of a minor releaseedge— tip ofmain(unreleased, for testing)sha-<short>— pinned to a specific commit
Programmatic clients with a pre-existing Viya token
If your caller already holds a Viya access token (e.g. an automation script that obtained one via the SAS Viya CLI), start the HTTP-mode server with ALLOW_RAW_BEARER=true and pass the token directly:
curl -H "Authorization: Bearer $VIYA_TOKEN" http://localhost:8134/mcp ...The server validates the token against Viya's JWKS and uses it upstream as-is, bypassing the MCP JWT swap. The default OAuth2 PKCE flow keeps working alongside — both client types share the same /mcp endpoint.
If your Viya APIs are intentionally exposed without auth (for example, a local/dev Compute API endpoint), set VIYA_AUTH=false to bypass all SASLogon/OAuth flows in both HTTP and stdio modes. In this mode the server sends upstream requests without an Authorization header.
If your compute deployment does not expose /compute/contexts and only supports a fixed session, set COMPUTE_SESSION_ID=<session_id>. The compute tools will use that session directly instead of creating context-backed sessions.
Choosing a deployment mode
HTTP | Stdio | Docker | Kubernetes | |
How it runs | Long-running server you start separately | MCP client spawns it on demand | Containerized HTTP server | Containerized, behind an ingress |
Authentication | OAuth2 PKCE flow (browser popup) | Cached token via | OAuth2 PKCE flow (browser popup) | PKCE and/or raw Viya bearer token |
Best for | Multi-user or shared setups; production-like environments | Single-user local development; quick experimentation | Team deployments; CI/CD; environments without Python installed | Shared/organisational deployments alongside Viya |
Requires | Python + uv | Python + uv (+ optional | Docker or Podman only | A cluster, an ingress controller, a TLS secret |
Credentials stored? | No — user authenticates interactively | No — only an access token (not a password) is cached | No — user authenticates interactively | No — a signing key in a |
MCP client config | Point client to | Client runs | Point client to | Point client to |
Quick guidance:
Starting out or exploring? Use stdio — one
sas-viya auth loginCodeoruv run sas-mcp-login, then your MCP client manages the server lifecycle.Need secure, interactive auth? Use HTTP — no stored passwords, each user authenticates via browser.
Deploying for a team or on a server? Use Docker — portable, no Python dependency on the host, easy to integrate with orchestrators.
Running it for a whole organisation? Use Kubernetes — sample manifests and a Helm chart are in deploy/, including the routing the OAuth flow needs for either Contour (the chart's default, and the only one that can mount the server under a path prefix on an existing hostname) or ingress-nginx.
Using Gemini CLI? Use stdio — Gemini CLI does not support HTTP mode or browser-based OAuth. See Gemini CLI configuration.
Integrating with Microsoft 365 Copilot? Use Kubernetes (or any remote HTTPS deployment) — Copilot declarative agents only reach remotely hosted MCP servers. A ready-to-sideload agent package and walkthrough are in examples/m365-copilot/.
Adding it to a Microsoft Copilot Studio agent? Same remote HTTPS deployment, plus
MCP_TOOL_RENAME=catalog_=infocat_— Copilot Studio's agent runtime fails on tool names that start withcatalog_. The steps are in examples/copilot-studio/.Not sure which Microsoft route fits? examples/microsoft-copilot.md compares the declarative agent and the Copilot Studio agent, and shows the settings for one deployment that serves both.
Installing from a client's server catalogue? That path runs the published container in stdio mode (
app-stdio), not as an HTTP server, so it authenticates from your~/.sastoken cache — which has to be mounted into the container at/app/.sas.
Limiting exposed tools (tiers)
Tools are grouped into numbered tiers. By default the server exposes all of them; set MCP_TIERS to expose only a subset — handy for keeping a client's tool list small and focused, or hiding capabilities a deployment shouldn't offer. Accepts ranges and comma lists (e.g. MCP_TIERS=0-4 or MCP_TIERS=0,1,6,7); unset means all tiers.
Tier | Group |
0 | Compute Contexts & Code Execution |
1 | Data Discovery |
2 | Data Operations & Files |
3 | Reports & Visualization |
4 | Batch Jobs & Async Execution |
5 | Automated Machine Learning |
6 | Model Management & Scoring |
7 | Decisioning Foundation (SAS Intelligent Decisioning) |
8 | Workbench (Execute Code Only) |
9 | Business Glossary (SAS Data Governance) |
10 | Decisioning Advanced (SAS Intelligent Decisioning) — needs Tier 7 |
11 | Model Lifecycle (SAS Model Manager) |
# Example: expose only compute/discovery/data-ops and reporting
MCP_TIERS=0-3 uv run appRead-only mode
Set MCP_READ_ONLY=true to expose only tools that neither change server-side state nor cause server-side work — 64 of the 137 tools. Withheld tools are never registered, so they are absent from the client's tool list entirely: the model cannot see them, so it cannot attempt them.
This is a filter over the tiers, not a tier of its own — the read/write split cuts across every tier (Tier 3 has both get_report and delete_report). The two settings compose:
# Every read tool, all tiers
MCP_READ_ONLY=true uv run app
# Read tools of the reporting and decisioning tiers only
MCP_TIERS=3,7 MCP_READ_ONLY=true uv run appThe definition is strict: a tool qualifies only if it can neither write nor start work. Beyond the obvious create/update/delete tools, that withholds:
Withheld | Why |
| Run arbitrary code — can perform any operation, including deletes |
| Start server-side jobs and leave run records, though they return data |
| Mutates CAS in-memory state |
| Run a SAS session or a score job, though they return data and leave nothing behind |
| Destroy something the caller owns |
Classification is fail-closed: a tool that is not explicitly classified as read-only is withheld. The list lives in src/sas_mcp_server/tools/_access.py, and a test asserts it covers every registered tool, so a newly added tool cannot silently land in read-only mode.
Tool annotations (what clients are told)
The same classification is advertised to every client as MCP tool annotations on each tools/list entry — whether or not read-only mode is on:
Hint | Derived from |
| exactly the read-only set above — one table, so what a client is told and what |
| tools that can remove or overwrite existing state: arbitrary code ( |
| reads, the |
| only tools that can reach beyond Viya: arbitrary code, the upload tools' |
Clients use these to shape their approval UX — e.g. Claude groups read-only tools for one-click approval and warns before destructive ones — and to decide when to interrupt the user. They are hints, not enforcement: the spec tells clients to treat them as untrusted unless the server is trusted, and MCP_READ_ONLY remains the server-side control. Without annotations a client must assume the spec's pessimistic defaults (writable, destructive, open-world) for every tool, so this only ever reduces friction. The browser landing page marks each tool read-only / write / destructive from the same hints.
Interactive views (MCP Apps)
Some results read badly as text however well the tool shapes them: a hundred rows of a table, a SAS log, a form's worth of typed attributes. Ten tools therefore also carry a small HTML view, using the MCP Apps extension, that a supporting client renders in a sandboxed frame beside the result:
View | Tools | What it does |
Data grid |
| Sort, filter and page through rows. Paging calls the same tool again from the view, so the person can walk a large table while the model holds only the first page. |
SAS log |
| Colour-coded |
Glossary term editor |
| A form generated from the term type — a real checkbox for a boolean, a date picker, a multi-select — so attribute values cannot be mistyped. Creates or updates the term and tells the assistant what was saved. A term that is still a draft can be published from here, which is the only way the API allows it. |
Glossary browser |
| The whole glossary as a navigable tree beside a detail pane: search across names, definitions, descriptions and attribute values; filter by term type or "has assets"; breadcrumbs, children cards, attributes, assigned assets, and a sunburst of the hierarchy. The tree pane can be resized by dragging the divider or hidden altogether. The listing's own filters become the starting filters; the rest of the glossary is loaded by the view in pages, so the model still holds only the first page. A draft — invisible to everyone but its author, which is why the tree is where you notice one — can be published from its detail pane. |
Glossary import |
| With |
Every view has a ⤢ button that opens it fullscreen where the host offers that (Claude does), which is where a wide table or a long log is meant to be read; the button does not appear on a host without it.
Everything about this is additive. The tool's return value is unchanged, so a client without the extension — Claude Code, a script, an older client — sees exactly what it saw before. Every request a view makes travels through the host to this server as an ordinary tool call with the session's token; the browser never talks to Viya, and a tool a deployment withholds through MCP_TIERS or MCP_READ_ONLY has no view either — nor does any control inside a view that would have called it, so a read-only deployment shows the glossary browser without its Publish button rather than with one that can only fail. The pages are fully inlined — the vendored @modelcontextprotocol/ext-apps bridge included — so they render on hosts that ignore CSP declarations and on an air-gapped Viya. MCP_APPS=false registers no views.
Whether a view is rendered depends on the client and on how it is connected:
Client | Views |
ChatGPT, Microsoft 365 Copilot, VS Code with GitHub Copilot, Cursor, Goose | Rendered — these clients implement the extension. |
Claude (web, Desktop, Cowork) connected to the HTTP server as a custom connector | Rendered, including the SAS log view's Results tab. The connector speaks the 2026 protocol revision, whose handshake has no session, so the server needs |
Claude Desktop with the server in | Not rendered since Claude Desktop 2.2553 (22 September 2026). Desktop passes a local server's tools to the chat through a bridge that rebuilds each tool's metadata and drops the view binding, so the chat never asks for the page. The tools work as before; results are text, and |
Microsoft Copilot Studio agents | Not rendered — the agent runtime does not implement the extension (it announces no UI capability and never reads the view). |
Claude Code | Not rendered — text only, by design. |
A view's own controls call other tools (the Results tab reads the page through download_file, Tier 2), so a deployment that withholds those tiers gets the view without that control. View URIs carry a fingerprint of the page (ui://sas-viya/sas-log/execute_sas_code.<hash>.html) that changes with the server version, the page files and the tier selection, because hosts cache a page by its URI — claude.ai even across a connector being removed and added again; the plain URI is served too, for hosts holding an older tool listing.
HTML results
execute_sas_code returns the SAS log and listing as text, which is what the model reads. By default it also produces the page SAS Data and AI Studio would show, with tables styled by ODS and graphs drawn, and returns a link to it:
How. The compute context opens no HTML destination of its own, so the server runs the code between an
ods html5statement and its close. Before the close comes;*';*";*/;run;quit;, which ends whatever the code left open (an unterminated statement, quote or comment, or a step withoutrun;) so that the close still runs. None of this appears in the log the model reads.html_results=falsesubmits the code exactly as given.The link. When the code printed something, the page is saved to the Viya Files service and the result gains
html_results_url. Opening it in a browser asks you to sign in to SAS Viya; the file sits in no folder, so Viya's default rules let only the person who ran the code (and administrators) open it. Pages are saved without an expiration, the Files service's default, so they stay until someone deletes them.In the SAS log view, the page is the Results tab, shown first when the code ran cleanly. The view fetches it through
download_file, so a deployment without Tier 2 gets the link but not the tab.Cost. Opening and closing the destination adds about a tenth of a second to a job, and saving the page is one more request. The page itself, 40–70 KB and mostly ODS's stylesheet, never enters the model's context; only the link does.
Available Tools
The headings below match the numbered tiers above, so MCP_TIERS maps directly to the tools you expose (e.g. MCP_TIERS=0-3 gives Tiers 0–3).
Tier 0 — Compute Contexts & Code Execution
execute_sas_code: Execute SAS code snippets and retrieve execution results (log and listing output), plus a link to the HTML results unless
html_results=false. Runs in a reusable, per-user compute session that is kept warm across calls, so SAS state (WORK tables, macro variables, assigned librefs) persists between successive calls — use reset_compute_session to start fresh.list_compute_contexts: List available compute contexts
reset_compute_session: Delete the cached compute session for a context, discarding its SAS state and forcing a fresh session on the next call
Tier 1 — Data Discovery
SAS Data Governance (metadata discovery & profiling):
catalog_search: Search the catalog for assets (tables, columns, reports, …) using the SAS catalog search grammar (free text, facets like
AssetType:Report, ranges). Each hit carries aresource_uriyou can hand to the matching tool (e.g.get_report,get_castable_data).catalog_search_helper: Discover how to query the catalog — list the available facets, or the valid values for one facet — so you can build precise
catalog_searchqueries.catalog_find_instance: Resolve the catalog instance for a source-asset
resource_uri, bridging a search hit to the profiling and download tools without handling an instance id by hand.catalog_run_adhoc_analysis: Submit an ad-hoc profiling job for a table. NLP enrichment (language, sentiment, semantic IDs) is on by default, populating
informationPrivacy,nlpTerms,nlpTags, andmostImportantFields.catalog_get_adhoc_analysis: Poll a profiling job and cross-check the target instance, reporting
profile_readyonce results have landed on the asset — so a download isn't fired too early.catalog_download_table_profile: Download a table's data dictionary and column profile as CSV, identified by either
instance_idorresource_uri.catalog_list_agents: List the catalog's discovery agents (the crawlers that populate metadata).
catalog_run_agent: Start a discovery agent run (asynchronous) to crawl its data source and refresh catalog metadata.
catalog_get_agent_history: Inspect an agent's run history — status and how much metadata each run enumerated/added/updated/removed.
CAS data (in-memory):
list_cas_servers: List available CAS servers
list_caslibs: List CAS libraries on a server
list_castables: List tables in a CAS library
list_source_tables: List source tables not yet loaded into memory (candidates for promotion)
get_castable_info: Get table metadata (row count, columns, size)
get_castable_columns: Get column names, types, labels, formats
get_castable_data: Fetch sample rows from a CAS table
query_data: Run a FedSQL
SELECTagainst CAS or compute data and get the rows back — one SQL surface over both storage tiers. Pick the tier withtarget(casforcaslib.table,computeforlibref.table); joins, subqueries, aggregation, andUNIONall work, and the row cap is applied server-side by the tool (aLIMITyou write is ignored, since a malformed one is silently discarded by CAS). Optionally returns the query asCREATE VIEWtext for you to run yourself. Reads only: writes are refused pre-flight, and SAS macro triggers (%/&) are rejected because the macro processor would expand them outside SQL. Note the two tiers cannot be joined in one statement.
Compute libraries (SAS/Compute, within a compute context):
list_compute_libraries: List the SAS libraries (librefs) assigned in a compute context
list_compute_tables: List the tables in a SAS library within a compute context
list_compute_columns: List the columns of a table in a SAS library
get_compute_table_data: Fetch a page of rows from a table in a SAS library, values formatted as SAS displays them — the compute-tier counterpart of
get_castable_data
Tier 2 — Data Operations & Files
upload_data: Upload a data file into a CAS table — read server-side so the data never passes through the model's context — from
file_path(the server reads it off disk) orurl(the server fetches it and converts it to the multipart upload the endpoint requires). Ingests the formats the casManagementuploadTableAPI accepts — csv, tsv (csv + tab delimiter), xls, xlsx (single sheet), sas7bdat, sashdat — auto-detected from the extension or set withdata_format. parquet is not accepted by that endpoint and is rejected up front with guidance (load via a path-based caslib +promote_table_to_memory, or convert to csv/sas7bdat).upload_inline_data: Create a small CAS table from inline csv/tsv text passed as a string (a lookup/mapping table the model builds on the fly, or a quick test table). The payload travels through the model's context, so it's for tiny tables only — use upload_data for files or anything larger.
promote_table_to_memory: Load a source table into memory at global scope (idempotent)
list_files: List files in the Viya Files Service
upload_file: Upload a file to the Viya Files Service, optionally into a Content folder (
parent_folder_uri). Content comes from exactly one ofcontent(inline text),file_path(read server-side, binary-safe — xlsx, zip, images — gated byALLOW_LOCAL_FILE_UPLOAD), orurl(server-side fetch)download_file: Download file content
find_folder: Look up a SAS Content folder by path (
/Public/Content/Decisions,My Folder,My Folder/Risk), ID or URI, and return its ID, URI, name and full path — for confirming a folder the user named, or getting the URI thatupload_fileandMCP_DEFAULT_FOLDERtakecreate_folder: Create a SAS Content folder and any missing folders above it:
/Public/Content/RiskandMy Folder/Riskwhere they say, a relative path such asRisk/2026underMCP_DEFAULT_FOLDER(refused when that is unset). An existing folder is returned unchanged, so it can be called twicesave_castable: Save an in-memory CAS table to a file in a caslib (
sashdat,csv,parquetorsas7bdat), so it survives a drop or a CAS restart; an existing file is overwritten only withreplacedrop_castable: Drop a table from CAS memory and keep its source file, so
promote_table_to_memorycan load it again. A table with no source file would lose its data, so it is refused unlessallow_unsaved
Tier 3 — Reports & Visualization
list_reports: List Visual Analytics reports
get_report: Get report metadata and definition
export_report: export a report (or specific report objects) in any format the VA service supports —
package(zip),pdf,png,svg,csv,tsv,xlsx, orsummary. Text formats come back inline,pngas image content, and binary formats (package/pdf/xlsx) as an embedded file with the right MIME type.describe_report_objects: Discover what a report can contain — the eight report operations and every addable object (bar chart, list table, geo map, key value, …) with a one-line purpose, its data roles, common options, and an example payload. Call with no arguments for the catalog (including an intent→object map, placement guide, layout recipes, and the API's hard limits),
object_type=for one object's contract (colloquial aliases likekpiresolve),category=to filter, oroperation=for one operation's full shape —operation="addData"documentsdataItems(column renames, SAS formats, aggregations, geography classification). Backs theapply_report_operationsloop.create_report: Create a Visual Analytics report and return its id. Optionally pass an
operationsarray to build the whole report in one atomic call; the result carries the created page/object names+labels and a verify hint.apply_report_operations: The authoring workhorse — apply an ordered batch of native VA operations (
addData,addPage,addObject,updateObject,setParameterValue,updateData,changeData,applyDataView) to a report. Give a page a title withaddPage'stitlefield (a text band at the top of the page body — VA headers are controls-only); title every chart at add time viaoptions.object.title; arrange objects with placement —page,relativeToObject(left/right/top/bottom for columns, rows, and grids),container(group into astandardContainer), orreport(new_pagecreates-and-names a page inline for one-batch multi-page reports). The batch is atomic. Validates every operation, object key, and placement against the catalog first (reporting all errors at once), supportsdry_run, handles the ETag concurrency handshake, and — withsave_as=trueplusresult_report_name/result_folder— applies the batch save-as to a new report, leaving the source untouched. The flag alone decides the mode: without it the report is edited in place, and a name or folder given without it is refused rather than acted on. Typical loop:describe_report_objects→get_castable_columns→apply_report_operations→get_report_outline/export_report(png, page-by-page) to verify.get_report_outline: Read a report's structure back — pages → objects with the handles the other tools need (object
namefor placement/updateObjecttargets,labelforexport_report, pagelabelfor page placement).copy_report: Copy a report to a new one (optionally renaming/refoldering). Pairs with a
changeDataoperation for the copy-and-replace pattern.delete_report: Delete a report and its content.
Tier 4 — Batch Jobs & Async Execution
submit_batch_job: Submit a SAS job for async execution
get_job_status: Check job state
list_jobs: List recent/running jobs
cancel_job: Cancel a running job
get_job_log: Retrieve job log
Tier 5 — Automated Machine Learning
list_ml_projects: List AutoML projects
create_ml_project: Create a new AutoML project from a loaded, global-scope CAS table (caslib + table + optional CAS server)
run_ml_project: Run pipeline automation
register_ml_champion_model: Register an AutoML project's champion model to the Model Repository
publish_ml_champion_model: Publish an AutoML project's champion model to a scoring destination (default:
MCP_DEFAULT_PUBLISH_DESTINATION)
Tier 6 — Model Management & Scoring
list_registered_models: List models in repository
list_publishing_destinations: List available scoring/publishing destinations, for use with publish_model and publish_ml_champion_model
list_mas_modules: List published MAS modules
get_mas_module_step_signature: Inspect a published MAS module step's input/output variable signature before scoring
score_data: Score data against a published model or decision; for a decision published from the Intelligent Decisioning UI, whose inputs carry a trailing underscore, the plain names are accepted and mapped (
inputs_renamed)get_model: Describe a registered model: project, version, role (champion or not), target, event probability variable, input and output variables, and files
list_model_versions: A model's versions, the current one first
test_score_model: Score a few rows (default 10, at most 100) with a registered model using Model Manager's own score test, wait, and return the scored rows; the scratch tables and score definition are removed again
score_table: Score a whole CAS table with a registered model, straight from the repository (no publishing needed); returns the score execution to follow
get_score_execution: State, output table and, when it failed, the log's errors of a score execution; optionally the first scored rows
list_published_models: Published models by destination and name, with their state and the registered model they came from
Tier 7 — Decisioning Foundation (SAS Intelligent Decisioning)
Build and run SAS Intelligent Decisioning decisions — rule sets that consult lookup tables, and decision flows that combine them with models, branches, conditions, assignments and sub-decisions — then publish a flow to Micro Analytic Score (MAS) so score_data can execute it. The life-cycle tools read, lock, copy and delete every kind of decisioning content. Segmentation trees, code files, value lists and custom functions are written with Tier 10; enable both (MCP_TIERS=...,7,10) for everything — the server logs a warning when Tier 10 is on without Tier 7.
Rule sets and decision flows are always stored in a SAS Content folder. The create tools take a folder — a path such as /Public/Content/Decisions, My Folder or My Folder/Risk, a folder ID, or a folder URI — and fall back to the deployment's MCP_DEFAULT_FOLDER. With neither, they refuse and the model asks the user where to store the asset. An update leaves an asset in its folder; one created before folders were required is filed by its next update, into the folder given or the default. Every create and update result carries folder, with the path the asset is in.
Business rules — rule sets:
create_business_ruleset / update_business_ruleset / get_business_ruleset / list_business_rulesets / delete_business_ruleset: Manage rule sets (the input/output signature the rules operate on)
lock_business_ruleset_revision: Lock the current rule set state as an immutable revision (what a decision step references)
list_business_ruleset_revisions: List a rule set's locked revisions
Business rules — rules:
create_business_rule / update_business_rule / get_business_rule / list_business_rules / delete_business_rule: Manage the conditional rules inside a rule set
Decision flows:
create_decision_flow / update_decision_flow / get_decision_flow / list_decision_flows / delete_decision_flow: Manage decision flows that chain rule set steps
get_decision_flow_code: Retrieve the generated DS2 execution code for a flow
lock_decision_flow_revision / list_decision_flow_revisions / get_decision_flow_revision: Lock, list, and fetch immutable decision revisions
publish_decision_flow: Publish a locked decision revision to a MAS destination, polling to completion and returning the server-generated MAS
moduleId(directly usable with get_mas_module_step_signature / score_data). The code is generated for MAS, as SAS Intelligent Decisioning publishes it, so lookup tables work; the module's inputs keep the decision's variable names (the UI would add a trailing underscore,credit_score_)
create_decision_flow and update_decision_flow take steps, in which each step names what it is and the server wires it: {"type": "rule_set" | "segmentation_tree" | "code_file" | "decision", "id": ...} (a sub-decision is a decision), {"type": "model", "id": <model repository id>}, {"type": "assignment", "assignments": {"band": "GOLD"}}, {"type": "condition", "expression": "score >= 630", "on_true": [...], "on_false": [...]} and {"type": "branch", "branch_type": "range" | "equals" | "like", ...}. A referenced object's newest locked revision is used (one is locked if there is none); step terms map to same-named decision variables, and a term the decision has none for is added as a variable of its type and direction, because Intelligent Decisioning validates and publishes a step only when every term is mapped. Mappings never cross type families. Assignments set constants (compute in a rule set or code file); a model is referenced by its model repository ID and its outputs become decision variables; range branches compare inclusively (>= min, <= max) and their cases must not share a value; steps nest inside branch cases and conditions. The tool's description carries a worked example of each. rule_set_steps still works for rule-set-only flows. The result's steps_report lists the revisions used, the variables added and anything to check.
Content — one life cycle for every kind: asset_type is rule_set, decision, segmentation_tree, code_file, value_list, lookup_table, custom_function or function_category.
list_decisioning_assets / get_decisioning_asset / delete_decisioning_asset: List, read (with the folder it is in; a rule set with its rules, a code file with its code, a value list with its entries, a lookup table with its versions and active entries; content over 150,000 characters is summarised) and delete any of them — a lookup table that rule sets use is refused, naming them, because Viya would delete it and leave those rules invalid
get_decisioning_asset_code: The DS2 Viya generates for a rule set, decision or segmentation tree, or a code file's source
list_decisioning_asset_revisions / lock_decisioning_asset_revision: Revisions of rule sets, decisions, segmentation trees and code files. Locking freezes the current state and opens the next revision; the result says which revision was locked
copy_decisioning_asset: Copy a rule set (with its rules), decision, segmentation tree, code file, value list or lookup table into a folder
validate_decision_expression: Compile a DS2 expression — a rule condition or action, a branch, a condition step — against a signature and return the compiler's error lines, before it goes into a rule set or decision
Lookup tables — keys and the value stored for each, which rules consult: a lookup condition tests whether a variable's value is a key, a lookupValue action assigns the value for a key. create_business_rule / update_business_rule take the lookup table by name and resolve its ID (a reference without one is stored as invalid), and report any condition or action Viya stored as invalid in problems. Rules read a lookup table's active version, which activation publishes to MAS and CAS; a decision already published uses newly activated entries on its next call, without being published again.
get_lookup_table: Versions (which one is active, which failed to activate and why), one version's entries — paged, filtered by key — and the rule sets that use the table
create_lookup_table: Create one from
{"key": "value"}or a list of entries, with optional column labels, in a folder;activatepublishes it right awayupdate_lookup_table: Add or overwrite entries, remove keys, or replace them all; rename; relabel. An active version is never changed — a new version is started from it — and rules keep the active one until the new one is activated (
activatedoes that in the same call)activate_lookup_table: Make a version the active one and wait for the publish to settle (
active,runningorfailedwith the reason); an earlier version (a rollback) or one whose activation failed is activated as a new version with its entries;republishcopies the active version to MAS and CAS again
Tier 8 — Workbench (Execute Code Only)
execute_sas_code: Execute SAS code snippets and retrieve execution results (log and listing output), plus a link to the HTML results unless
html_results=false. Runs in a reusable compute session that is kept warm across calls, so SAS state (WORK tables, macro variables, assigned librefs) persists between successive calls
Tier 9 — Business Glossary (SAS Data Governance)
Read and author the SAS Business Glossary, and link its terms to the columns they describe. Tier 1 tells you a column is called CD_NAC_RSK; this tier tells you what that means and who says so.
Two things about the glossary are worth knowing before you start, because both are invisible in the raw API and both are handled for you here:
A term has two ids. It exists as a Glossary object and as a Catalog entity, with different identifiers. Every tool returns both —
term_id(glossary) andcatalog_entity_id(catalog) — so you never have to work out which one you are holding.Custom attributes are stored under UUID keys. These tools read and write them by the label the glossary UI shows (
{"Scope": "Group"}), validating required attributes and single-select values before the call is made.
Dictionary:
search_glossary_terms: Free-text, ranked search over term names and definitions — the way in when you know a word rather than an id. Reports
assigned_asset_count, so you can see whether a term is actually in uselist_glossary_terms: Exact structural listing — by term type, by parent (the authoritative hierarchy), or by name fragment.
include_attributesreturns each term's attribute values (free — the listing already carries them), andattribute_filterkeeps only the terms matching, e.g.{"Used in Risk": true}. The glossary cannot filter on attributes server-side, so that filter is applied here and the result reports how much of the dictionary it scannedget_glossary_term: One term in full, with its custom attributes named rather than hashed
list_glossary_term_types / get_glossary_term_type: The term types available, and the attribute contract a term of that type must satisfy — call the latter before authoring. Each attribute reports the one value format Viya accepts for it, which the API itself documents nowhere
Where terms meet data:
list_term_assets: The columns a term is attached to, with their tables. The authoritative answer to "where is this term used?"
list_table_terms: The reverse — every column of a table and the term assigned to it, with the term's definition inline. The fastest read on whether a table is governed
Authoring:
create_glossary_term: Create a term. Publishes by default — the underlying API creates an invisible draft unless told otherwise;
update_glossary_term(publish=true)promotes one laterimport_glossary_terms: Create many terms, and their hierarchy, in one call. Children name their parent instead of needing its id, so rows can be given in any order and no id is threaded between levels; per-row failures are reported individually. Returns the
term_idof each row's term, so the next step needs no lookup, and separates rows that were genuinely new from rows whose term already existed — the import job counts both as successful. A row is written whole, soupdate_existingreplaces the term at that path rather than merging into it.dry_run=trueshows the resolved rows without importing — the interactive view turns that into a table with an Import buttonupdate_glossary_term: Change a term's text, parent or attributes. Merges onto the current term, so omitted fields are left alone rather than blanked;
parent_idmoves it in the hierarchy, andpublishpromotes a draft. A draft is a separate resource in the API, so this routes the write accordingly — editing one otherwise fails with a bare 404delete_glossary_term: Permanently delete a term and every assignment that referenced it. There is no cascade — a term with children is refused, so delete a subtree leaf-first
assign_glossary_term / unassign_glossary_term: Attach a term to a table column, or detach it. This is the step that makes a term govern data — a term with no assigned assets governs nothing
Designing the vocabulary:
create_glossary_term_type / update_glossary_term_type / delete_glossary_term_type: Define the template terms are created from — which custom attributes they carry, which are mandatory, and what values each accepts. An edit matches attributes by label and keeps each one's identifier, so terms already carrying a value do not lose it — to rename one, give its
attribute_idalongside the new label, since a new label matches nothing and would otherwise mint a new attribute; delete refuses while terms still use the type
Terms assigned this way also become searchable through Tier 1's catalog_search using the Column.term:"<term name>" facet on the datasets index, which returns the tables carrying a term without resolving individual columns.
Tier 10 — Decisioning Advanced (SAS Intelligent Decisioning)
SAS Intelligent Decisioning content beyond rule sets, for the decision flows of Tier 7: segmentation trees (written, or built from a strategy table), value lists, code files in DS2, Python and SQL, and DS2 custom functions that rule expressions call. Everything is stored in a folder, as in Tier 7. Using what this tier creates — as decision steps, and reading, locking, copying or deleting it — takes Tier 7, so enable the two together; with Tier 10 alone the server logs a warning at startup.
Segmentation trees:
create_segmentation_tree / update_segmentation_tree: Write a tree: nodes test a variable against values (
"A;B"), comparisons (">=630"), ranges ("600<=v<630") or"Other", in order; outcomes assign variables or run DS2. An update replaces only the parts givencreate_segmentation_tree_from_table: Build one tree from a strategy table — one row per branch, a column per decision key — as FICO-style exports (TRIAD, Blaze) describe a strategy. Keys are tested in column order and only where they split; values are range lower bounds (
split="lower_bound") or exact values. Reads inline rows, a CSV, or a CAS table (load an Excel sheet with upload_data), can create a value list per variable, and reports leaves, outcomes and any rows whose path is identical but whose outcome differs
Value lists, code files and custom functions:
create_value_list / update_value_list_entries: Value lists of values or numeric ranges (
"v>=630"); a version in production is left alone and a new version takes the entriescreate_code_file / update_code_file: DS2, Python or SQL code files; Viya reads the signature from the code, and
signaturesupplies the types Python cannot statecreate_custom_function / update_custom_function: DS2 custom functions that rule expressions call, checked to compile first; a category named but missing is created
validate_custom_function: Compile a custom function without saving it and return the compiler's error lines
Tier 11 — Model Lifecycle (SAS Model Manager)
The steps after a model is trained: register it, keep it in a project, make it the champion, publish it, check the published copy, and monitor it with KPI alert rules. Projects live in a model repository (MCP_DEFAULT_MODEL_REPOSITORY, default Public), not in SAS Content.
Python models are currently not supported. The tools work with SAS models: analytic stores and DATA step score code.
Registration and projects:
describe_analytic_store: PROC ASTORE DESCRIBE of an analytic store in CAS: its inputs, outputs and algorithm, before registering it
register_model: Register a SAS model with PROC REGISTERMODEL, run in a compute session of its own: an analytic store in CAS (downloaded to the session and registered from there, never through the client) or DATA step score code. The procedure writes the variables, properties and score code, and with a data table and target the fit statistics, ROC and lift. Not Python or DS2. A model of the same name in the project is refused unless
replace=true, which gives it a new ID and loses its score tests, publish history and monitoringlist_model_repositories: Model repositories, the default one marked
list_model_projects: Projects, by repository and name
create_model_project: Create a project, optionally in a folder inside the repository; one of that name is returned instead of a second one
set_project_champion: Make a model the champion, first copying the model's target, event and variables to the project where they are missing, as Model Manager's UI does (Model Manager refuses a champion without them, and PROC REGISTERMODEL leaves them empty)
Publishing:
publish_model: Publish any registered model to a destination — MAS, CAS, a container registry, Git (
git_remote_path) — withdry_runto see the destination, the published name and whether it would replace one. Default destination:MCP_DEFAULT_PUBLISH_DESTINATION(maslocal)validate_published_model: Score a few rows with the published copy in its destination (Model Manager's publish validation) and return them, to compare with test_score_model
Monitoring:
create_performance_definition: Define how a project's models are monitored, from one CAS table per period named
<prefix>_<n>_<label>; defaults to the champion, its inputs (for drift) and its event probability. A project has one: an existing one is returned, andreplacechanges itrun_performance_definition: Run it — by definition, or by project when it has one — optionally waiting up to ten minutes; reports each model's job and the log's errors of one that failed or completed with errors, and once the run is done returns Model Manager's run summary (rank, periods, headline KPIs per model), has Model Manager calculate the KPIs and reports the alert rules the champion breaks
get_project_kpis: The project's monitoring picture: the KPIs from the last runs (
_AUC_,_MISC_,_F1_, …, anddevIndexper variable for drift), its KPI alert rules, whether the champion (or another model) breaks each — Model Manager's own health check — and its performance definitionsset_kpi_alert_rule: Alert when a KPI crosses a threshold: accuracy KPIs (
AUC,misclassification, …), drift (devIndex, one rule per input or output variable) or fairness for a sensitive variable; above or below, with Model Manager's priority and number of occurrences. A rule for the same KPI, variable and direction is updated, not duplicated, and the result says whether the champion breaks it nowdelete_kpi_alert_rule: Delete a KPI alert rule
Prompt Templates
debug_sas_log: Analyze SAS log for errors with root-cause explanations
explore_dataset: Generate data-profiling SAS code
data_quality_check: Generate DQ assessment code
statistical_analysis: Set up a statistical workflow with diagnostics
optimize_sas_code: Review and optimize SAS code
explain_sas_code: Block-by-block code explanation
sas_macro_builder: Build production-quality SAS macros
generate_report: Generate ODS/PROC REPORT code
build_va_dashboard: Guide a polished multi-page Visual Analytics dashboard build from a CAS table — a discover → shape → structure → polish → verify method over the report-authoring tools
MCP Client Configuration
Example configurations are provided in the examples/ folder. Below are quick-start snippets for common clients.
Tip — open the endpoint in a browser. In HTTP mode, pointing a browser at the MCP URL (e.g.
http://localhost:8134/mcp, orhttps://<host>/mcpfor a deployed server) shows a landing page instead of a bare401: what the server is, which SAS Viya it talks to, the tool tiers this deployment exposes with a one-line summary per tool, and ready-to-copy configuration for Claude Code, VS Code, Cursor, Claude connectors and genericmcp.jsonclients — with the deployment's real URL already filled in. Only a plain browserGET(Accept: text/html) is answered this way; MCP clients andcurlsee exactly what they saw before. The page is unauthenticated and shows deployment shape only (never user data); administrators can turn it off withMCP_LANDING_PAGE=false.
VS Code / Cursor / Claude Code (.vscode/mcp.json)
HTTP mode (requires uv run app running separately):
{
"servers": {
"sas-execution-mcp": {
"url": "http://localhost:8134/mcp",
"type": "http"
}
}
}Stdio mode (starts the server on demand):
{
"servers": {
"sas-execution-mcp": {
"command": "uv",
"args": ["run", "--no-sync", "app-stdio"],
"cwd": "${workspaceFolder}"
}
}
}With the Claude Code CLI, pass the checkout with --directory:
claude mcp add --scope user sas-viya -- uv run --no-sync --directory /path/to/sas-mcp-server app-stdio--no-sync makes the client start the server from .venv as it is; run uv sync yourself after updating (see Installation).
Gemini CLI (.gemini/settings.json)
Gemini CLI only supports stdio mode. Add to your ~/.gemini/settings.json or project-level .gemini/settings.json:
{
"mcpServers": {
"sas-viya-mcp": {
"command": "uv",
"args": ["run", "--no-sync", "app-stdio"],
"cwd": "/path/to/sas-mcp-server",
"timeout": 60000
}
}
}Note: The
timeoutfield (in milliseconds) is important — SAS Viya API calls can take longer than the Gemini CLI default of 10 seconds. A value of60000(60s) is recommended. Setcwdto the absolute path of yoursas-mcp-servercheckout.
Example
Execute SAS code through the MCP tool:
data work.students;
input Name $ Age Grade $;
datalines;
Alice 20 A
Bob 22 B
;
run;
proc print data=work.students;
run;For more details, configuration options, and deployment options, please refer to the examples folder and follow the instructions listed there.
Collection Mode (Usage Telemetry)
An opt-in, off-by-default mode that records how the server is actually used — which tools, for what goals, with what inputs, and where they fall short. It serves two audiences:
Contributors giving structured feedback to the maintainers. Rather than filing prose bug reports, you can turn it on for a while and share the resulting log so maintainers can see which tools are used, which fail, and what goals have no good tool yet — a direct signal for improving existing tools and identifying new ones.
Organizations running the server for their own users. Teams that deploy the MCP server internally can enable it to understand what their users do with it and why, entirely within their own infrastructure.
It is implemented as a FastMCP middleware wrapper (telemetry.py + usage_logger.py) and requires no changes to any tool.
🔒 Nothing is ever sent anywhere automatically. Collection mode only appends to a local log file on the machine running the server. It is disabled unless you explicitly enable it, and even when enabled the data stays on your disk — sharing it with anyone (including the maintainers) is a deliberate, manual step you take by sending the file yourself. There is no phone-home, no network transmission, and no third party involved.
When enabled it does two things:
Injects a required
goalparameter into every tool's schema, asking the model to state in one sentence why it chose that tool for the current request. Thegoalis stripped from the arguments before the real tool runs, so tools never see it.Appends one JSON line per tool call (JSON Lines / NDJSON, schema v3) to a local log file: timestamp, run id, per-run sequence number, tool name, goal, arguments (plus a stable
args_hashfor retry analysis), result, status, error, latency, and the calling client'sclient_name/client_version. When a tool declares a failure as data (e.g.{"status": "apply_failed"}, which the MCP layer sees as success), the record also carriestool_status/is_tool_error/tool_message/failed_operation_index— so tool-level failure rates are analyzable in every mode. Arun_startheader record (transport, pid, server version, result mode, and an optionalCOLLECTION_RUN_TAGlabel for tagging A/B runs) opens the log and is re-emitted every 1000 records, so rotation cannot leave a stretch of the log with no header to resolve; every emission is byte-identical, so any one of them will do. Secret-shaped keys and inline Bearer/JWT tokens are redacted, the Viya hostname is masked in error/result text, and every field is size-capped.Records group by
run_id— one per server process — not by MCP session. The protocol is moving to a sessionless model (FastMCP 4 makes it the default) in whichsession_idis absent or minted per request, so grouping on it would shatter every trace into single-call fragments. Under stdio, one process serves one client, so a run is that client's trace. Under HTTP a run spans every client the process served, andclient_name/client_versionare the only thing separating them — two users on the same client software share onerun_idand oneseqcounter, which is an accepted limitation of dropping the session key, not something a per-processCOLLECTION_LOG_PATHcan fix (that splits by process, the axisrun_idalready covers).
Enabling it
Set the toggle in .env (all options are documented in .env.sample):
COLLECTION_MODE=true
# optional overrides (defaults shown):
# COLLECTION_LOG_PATH=~/.sas-mcp-server/tool-usage.log
# COLLECTION_LOG_RESULTS=failures # never | failures | always (see below)
# COLLECTION_RUN_TAG= # free-text label stamped into run_startTool results are recorded per COLLECTION_LOG_RESULTS — a tri-state dial: never records only a content-free shape summary (type + key
names, e.g. {"_type":"object","_keys":["status","report_id"]}); failures (the default) records full (capped + redacted) result contents only for calls that
errored or whose tool declared a failure — the middle ground, since failure diagnostics are the highest-value trace data and rarely carry
table rows, and because under never a success and a tool-declared failure are indistinguishable in the log; always records result contents on every call. Arguments, goal, status, error text, and the tool-declared outcome fields are captured in
every mode. (true/false still work as aliases for always/never.)
⚠️ Privacy: when enabled, the log captures your tool inputs (e.g. the SAS code and queries you submit) and — in
failures/alwaysmodes — real result data that may include table rows, SAS listings, and PII. Redaction is heuristic (credential-shaped keys + Bearer/JWT + the Viya hostname) and does not detect PII in data values. Review the log before sharing it. The file is locked to your user (chmod 0600 on POSIX; icacls on Windows, best-effort).
Performance impact
Collection mode is designed to be cheap enough to leave on. Measured on this repo (45 registered tools, FastMCP 3.4.2):
Prompt tokens. The injected
goalfield grows thetools/listschema the model sees by roughly +2,400 input tokens (~29%) per turn. Because the tool list is stable within a session it is served from the prompt cache after the first turn (steady-state ≈ +240 tokens/turn), plus ~15–30 output tokens per call for the model to write thegoalsentence. This is the only client-visible cost and it applies only while collection mode is enabled.Per-call latency. Middleware + logging adds ≈1.4 ms per call at the shape-only default (≈5.3 ms with
COLLECTION_LOG_RESULTS=always). The JSONL write is offloaded to a worker thread so it never blocks the event loop. Against real Viya calls (typically hundreds of milliseconds to seconds) this is negligible — the live integration suite passed identically with collection mode off and on, the overhead lost in normal network variance.Disk. Roughly 0.5–0.7 KB per tool call at the shape-only default. The log rotates at
COLLECTION_MAX_LOG_BYTES(default 10 MiB, ≈16k calls) and keepsCOLLECTION_LOG_BACKUPS(default 3) rotated files, so on-disk growth is bounded.
Server Log
The server log starts with one line naming what runs: the server and FastMCP versions, the transport, and the SAS Viya endpoint. After that, every tool call logs the tool and the SAS Viya user it runs as:
Tool call: execute_sas_code (user: sasdemo)The user is the id from GET /identities/users/@currentUser, asked with the caller's own token, so it is exactly the identity Viya authorizes the call against; for a client-credentials token it is the client's id. The lookup happens once per token, not once per call, and a failed lookup logs user: unknown rather than failing the tool. On a shared HTTP deployment this is what ties a field report to the person who hit it.
HTTP Debug Trace
When a tool fails, the model's summary of the error rarely shows the request that caused it — a wrong path, a missing media type, a body of the wrong shape — and one tool call can make several requests (paging, polling a compute job, fetching its log). Set HTTP_DEBUG=true in .env to write every request the server sends to the SAS Viya APIs, and each response, to a separate file:
HTTP_DEBUG=true
# The defaults; `docker --env-file` keeps a trailing comment as part of the value, so none here.
HTTP_DEBUG_LOG_PATH=~/.sas-mcp-server/http-debug.log
# Cap per recorded body in bytes; 0 records no bodies.
HTTP_DEBUG_MAX_BODY_BYTES=4096Each exchange is two JSON lines with the same id: a request record (method, URL, headers, body) and a response record (status, elapsed_ms, headers, body). A request with no matching response failed in transit — a timeout, a refused connection, a TLS error. The trace never goes to the server log, so it is safe in stdio mode, where stdout carries the protocol.
Authorization, cookies and other credential-shaped headers, query parameters and body keys are redacted, as are inline Bearer/JWT strings. Data values are not: table rows and SAS code appear in bodies, so review the file before sharing it. Binary bodies are recorded as their size and type, bodies are capped at HTTP_DEBUG_MAX_BODY_BYTES, and the file rotates like the collection log. The server logs a warning at startup while tracing is on; it is meant for troubleshooting, not for leaving on in a shared deployment. OAuth sign-in and token-refresh calls are not traced.
Testing
The project includes two layers of tests: unit tests (fast, no credentials required) and integration tests (run against a real SAS Viya instance).
run_tests.shvs. runningpytestdirectly — pick by platform.run_tests.shis a Bash convenience wrapper (it adds the ruff + pyright gates, credential wiring, and JUnit reporting). It runs on Linux/macOS — and on Windows only under Git Bash or WSL. On Windows PowerShell orcmd, use theuv run python -m pytest …commands shown under each mode below. They are cross-platform, do the same test selection, and need no setup beyonduv sync.
Running Unit Tests
Unit tests verify tool schemas, request payloads, and internal logic without making any network calls:
./run_tests.sh # Linux/macOS (also runs ruff + pyright)
uv run python -m pytest -m "not integration" -v # any platform, incl. Windows PowerShellThis runs the unit suite and deselects the integration tests, which then show up in the
summary as e.g. 28 deselected. That is expected — those tests are not meant to run in a
unit-only pass. They only execute in the integration modes below, because they need a live
Viya instance; there is no flag that "activates" them in a not integration run.
Running Integration Tests
Integration tests call every tool against a live Viya environment. They require credentials, provided via .env or CLI arguments.
uv sync installs everything the integration suite needs, including openpyxl (used to
build the Excel upload_data fixture). It lives in the test-formats dependency group,
which [tool.uv] default-groups syncs by default — so no extra install step is required.
Full suite (unit + integration) — reads VIYA_ENDPOINT, VIYA_USERNAME, VIYA_PASSWORD from .env:
./run_tests.sh --integration # Linux/macOS
uv run python -m pytest -v # any platformPassing credentials on the command line (wrapper only):
./run_tests.sh --integration \
--endpoint https://your-viya-server.com \
--username youruser \
--password yourpasswordWith the direct pytest command, set the same three variables in .env (or export them in your shell) instead.
Integration tests only (skip unit tests):
./run_tests.sh --integration-only # Linux/macOS
uv run python -m pytest -m integration --no-cov -v # any platformThe pytest marker is
integration, notintegration-only.--integration-onlyis a flag of therun_tests.shwrapper; the underlying pytest marker is justintegration. Runningpytest -m "integration-only"matches no marker and silently deselects all tests (0 selected). Use-m integration.Why
--no-cov?pytest.inienforces a 90% coverage floor that only the full unit suite reaches. An integration-only run exercises far less code (~65%), so without--no-covpytest exits non-zero with a coverage failure even though every selected test passed.run_tests.sh --integration-onlyadds--no-covfor you; add it yourself when calling pytest directly (or use--cov-fail-under=0).
Binary upload formats. The Excel upload_data integration test generates its .xlsx
fixture with openpyxl, from the test-formats group that uv sync installs by default
(see above). If you deliberately sync without it (e.g. uv sync --no-default-groups), the
test importorskips — you'll see it as skipped, not failed. csv,
tsv, and file_path/data_format coverage needs no extra deps. Generating a
sas7bdat/sashdat fixture requires SAS itself, so those two formats are covered by
unit-level payload tests only, not live.
Every one of the 137 tools and 9 prompt templates has an integration test, enforced by the
test_every_tool_has_integration_coverage / test_every_prompt_has_integration_coverage
guards — adding a new tool or prompt without integration coverage fails the suite. The
resource-dependent tests discover real targets on the instance: score_data scores the most
recently modified MAS module (discovering a real step and its inputs), and run_ml_project
re-runs the most recently modified completed ML project. They skip only if the instance
has no such resource at all. Likewise, test_catalog_agents_workflow skips with "No
discovery agent named 'Public'" on instances where SAS Data Governance has no discovery
agent named Public configured — an expected skip, not a failure; ask a Viya admin to
configure one if you need that test to run.
In CI: the .github/workflows/integration.yml workflow runs this suite on demand
(manual dispatch, or by adding the run-integration label to a PR) using repository
secrets, and publishes the results back to the PR as a status check, a sticky comment, and
a downloadable JUnit artifact. Result files are written to reports/ (git-ignored) and are
never committed.
Locally (attach results to a PR yourself): run with --report to write the JUnit XML
and a Markdown summary into reports/ (git-ignored), then post them to a PR with the GitHub
CLI — no commit, no CI required:
./run_tests.sh --integration-only --report
gh pr comment <PR> --body-file reports/integration-summary.md # summary table as a comment
gh gist create reports/integration.xml # full XML as a linkable gistGitHub has no API/CLI to attach a binary file to a PR (drag-and-drop upload is browser-only), so the summary is posted as a comment and the raw XML is shared via a gist link or pasted in a collapsed
<details>block. To produce the canonical Actions artifact from your machine instead, trigger the workflow remotely:gh workflow run integration.yml.
Test Structure
File | Description |
| Payload assertions for all 75 Tier 0-8 tools (URL paths, JSON body, query params, headers) plus error-path coverage |
| End-to-end workflow tests against a real Viya instance |
| Tool tests for the model tools (Tiers 2, 6 and 11) against a routed fake Viya, and the SAS programs they generate |
| Unit tests for the generic Viya REST helpers in |
| Unit tests for Viya compute session and job orchestration |
| Unit tests for the HTTP auth middleware, health route, and token getter |
| Unit tests for configuration loading |
| Unit tests for |
| Unit tests for the |
| Unit tests for stdio token resolution and the device-code flow |
| Unit tests for the |
| Unit tests for prompt template rendering |
Contributing
Maintainers are accepting patches and contributions to this project. Please read CONTRIBUTING.md for details about submitting contributions to this project.
License & Attribution
Except for the the contents of the /static folder, this project is licensed under the Apache 2.0 License.
Elements in the /static folder are owned by SAS and are not released under an open source license.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.
Separate commercial licenses for SAS software (e.g., SAS Viya) are not included and are required to use these capabilities with SAS software.
As with any container image, direct and indirect dependencies are governed by their own licenses. Users of the published container image are responsible for ensuring that their use complies with all applicable licenses.
All third-party trademarks referenced belong to their respective owners and are only used here for identification and reference purposes, and not to imply any affiliation or endorsement by the trademark owners.
Third-Party Dependencies
This project requires the following dependencies.
Dependency | License |
Python | |
FastMCP | |
uvicorn | |
starlette | |
httpx |
Available Tools
137 toolsactivate_lookup_tableActivate Lookup TableADestructive
Make a lookup table version the one rules use: publish its entries to MAS and CAS.
Decisions already published to MAS use the newly active entries on
their next call; nothing needs to be published again. The previously
active version stays in use until this one is active. outcome is
active, running (still publishing after wait_seconds) or failed
(activationError says why).
republish copies the already active version to MAS and CAS again —
for a destination that lost it, such as CAS after a restart.
Inputs: lookup_table (required), version, republish, wait_seconds. Returns: object
apply_report_operationsApply Report OperationsADestructive
Apply an ordered batch of operations to a report — the authoring workhorse.
This is how you add pages, add objects (any of the ~60 VA visual, control,
and content types), set parameters, and swap data sources. operations
is the native SAS Visual Analytics operations array; the whole batch is
applied atomically (all succeed or nothing changes).
Operation keys (one per array element): addData, addPage,
addObject, updateObject, setParameterValue, updateData,
changeData, applyDataView. Call describe_report_objects for
each operation's shape (operation="addData" covers formats,
aggregations, and geography via dataItems) and each object's data
roles, and get_castable_columns to map columns onto those roles.
Layout & titles (see describe_report_objects → placement /
layout_recipes for details):
Page title — give
addPageatitle(e.g.{"addPage": {"pageName": "Overview", "title": "Sales Overview"}}); it becomes a text band at the top of that page's body. Page/report headers accept ONLY control objects — never text or visuals.Chart titles — pass
{"options": {"object": {"title": "..."}}}inside the object spec at add time (all types exceptstandardContainer, which takes no options at add time).One-batch multi-page — create pages inline with placement
{"report": {"context": "new_page", "pageName": "Trends", "pagePosition": 1}}(numeric position) and target that pageName from later operations in the same batch.Grids/columns —
relativeToObjectwithleft/right/top/bottom(geometric) orbefore/after(flow order) against an EXISTING object's name; same-batch forward references fail, so chain across calls using the names each result returns. Objects are auto-named and auto-sized; placement and dataRoles are write-once (updateObjectchanges options only).Read structure back anytime with
get_report_outline; verify visually withexport_reportpage-by-page (seeverify_hintin the result).
The tool validates every operation against the object catalog before any HTTP call (unknown/typo'd object type, non-addable object, bad data-role names or arity, disallowed object/placement keys) and reports ALL invalid operations at once. It also handles the ETag optimistic-concurrency handshake for you, retrying once transparently on a concurrent edit.
Inputs: report_id (required), operations (required), dry_run, save_as, +4 more. Returns: object
assign_glossary_termAssign Glossary TermAIdempotent
Assign a business term to a table column — the step that makes a term govern data.
Creating a term only defines a word. This attaches it to the column that
carries it, and it is what list_table_terms, list_term_assets and
the catalog's Column.term facet all read. Assigning the same term to
the same column twice is reported, not duplicated.
Inputs: column_name (required), term_id, term_name, table_name, +1 more. Returns: object
cancel_jobCancel JobADestructiveIdempotent
Cancel a running job.
Inputs: job_id (required). Returns: result
catalog_download_table_profileCatalog Download Table ProfileARead-onlyIdempotent
Download a catalog table's data dictionary and profile as CSV.
Returns the table's column metadata plus, by default, its profile (column
statistics and data-quality metrics). If the table has not been profiled yet,
this returns a recommendation to run catalog_run_adhoc_analysis (pre-filled
with the table's URI and type) instead of an empty profile.
Identify the table by either instance_id or resource_uri (give one).
Passing resource_uri lets you run search → profile → download without ever
handling an instance id: the asset is resolved by resourceId the same way
catalog_find_instance does. instance_id takes precedence if both are given.
Inputs: level, instance_id, resource_uri. Returns: object
catalog_find_instanceCatalog Find InstanceARead-onlyIdempotent
Resolve the catalog instance for a source-asset URI.
catalog_search finds assets by free text and facets, but the
profiling and download tools key off a catalog instance id. When you
already hold a resource URI — the resource_uri from a search hit, or
a CAS table path — this looks the instance up directly by resourceId
(the same filter the profiling workflow uses) and returns its id plus
the key profile attributes. Use it to tell at a glance whether the asset
has been profiled (analysisTimeStamp) and what semantic metadata it
carries (informationPrivacy, nlpTerms, nlpTags,
mostImportantFields) before calling catalog_download_table_profile.
Inputs: resource_uri (required). Returns: object
catalog_get_adhoc_analysisCatalog Get Adhoc AnalysisARead-onlyIdempotent
Get the status of an ad-hoc analysis job, and whether its profile is ready.
The job reaching a terminal status is not sufficient: the profile
attributes are written onto the asset a little later, so a download fired
the instant the job completes can come back empty. To close that gap, when
the job carries a resource this also resolves the target catalog instance
and reports profile_ready (the asset's analysisTimeStamp is
populated — the same gate catalog_download_table_profile uses) and
information_privacy (non-empty once the NLP semantic enrichment has
landed). Poll until profile_ready is true, then download.
Inputs: job_id (required). Returns: object
catalog_get_agent_historyCatalog Get Agent HistoryARead-onlyIdempotent
Get the execution history of a catalog agent's runs.
Each record reports a run's status and how much metadata it populated
(tables enumerated/added/updated/removed), so you can confirm a run started
by catalog_run_agent finished and what it changed.
Inputs: agent_id (required), limit, start. Returns: result
catalog_list_agentsCatalog List AgentsARead-onlyIdempotent
List SAS Data Governance discovery agents.
Agents crawl a data source (server/library) to discover assets and collect
their metadata into the catalog. Use catalog_run_agent to start one and
catalog_get_agent_history to see what a run produced.
Inputs: limit, start, filter_name. Returns: result
catalog_run_adhoc_analysisCatalog Run Adhoc AnalysisA
Submit an ad-hoc analysis (profiling) job for a table in the catalog.
Profiles the table — computing the data dictionary, column statistics, and
data-quality metrics that catalog_download_table_profile returns. The job
runs asynchronously and may take a while; poll catalog_get_adhoc_analysis
with the returned job id until the profile is ready.
The three NLP job parameters are enabled by default — they drive the
semantic enrichment that populates an asset's informationPrivacy,
nlpTerms, nlpTags, and mostImportantFields (the privacy and
keyword signals the catalog is most useful for). Leave them on unless you
only need a plain column profile and want the job to finish faster.
Inputs: name (required), resource_uri (required), provider, description, +4 more. Returns: object
catalog_run_agentCatalog Run AgentA
Start a catalog discovery agent run (asynchronous).
Triggers the agent to crawl its data source and populate/refresh catalog
metadata. The run is asynchronous — results are applied to the catalog in
the background; poll catalog_get_agent_history to track completion.
Note: the Catalog API can only start an agent, not stop one already running.
Inputs: agent_id (required). Returns: object
catalog_searchCatalog SearchARead-onlyIdempotent
Search the SAS Data Governance catalog for assets (tables, columns, reports, ...).
The catalog is a metadata index across the whole Viya environment, so this
finds assets without needing to know their server/library first. Each hit
includes the asset's resource_uri — the URI you can hand to the matching
tool (e.g. get_report, get_castable_data) to act on the live asset — and an
attributes map with whatever metadata the catalog holds for it (commonly
library, rowCount, columnCount, completenessPercent,
reviewStatus, informationPrivacy, and analysisTimeStamp).
The query uses the SAS catalog search grammar:
Free text matches names, with wildcards
*(0+ chars) and?(1 char):cust*.Facets constrain fields, e.g.
AssetType:Report,Name:sales,Library.name:PUBLIC,Column.informationPrivacy:Sensitive.Ranges
DateModified:[2024-01-01 TO 2024-12-31]and+to require a term. Combine freely:AssetType:"CAS Table" +Name:cust*. Usecatalog_search_helperto discover valid facet names and values.
Inputs: query (required), limit, start, indices. Returns: object
catalog_search_helperCatalog Search HelperARead-onlyIdempotent
Discover how to search the catalog: list facets, or values for one facet.
Call with no facet to list the available facets — the fields you can
constrain in a catalog_search query. Call with a facet name to get the
suggested/valid values for that facet (e.g. the asset types or review
statuses that actually exist). Use the results to build precise
catalog_search queries.
Inputs: facet, limit, query. Returns: object
copy_decisioning_assetCopy Decisioning AssetA
Copy a rule set (with its rules), decision, segmentation tree, code file, value list or lookup table.
Custom functions and function categories cannot be copied. A lookup
table's copy holds the entries of its active version (or of
revision_id, a version ID or label) and is not active itself.
Inputs: name (required), asset_id (required), asset_type (required), folder, +1 more. Returns: object
copy_reportCopy ReportADestructive
Copy a Visual Analytics report to a new report, returning the copy's id.
Useful for tailoring a report to a new audience or for the copy-and-replace
pattern — copy, then apply_report_operations with a changeData op to
point the copy at a different table. Returns
{"status": "copied", "id": ..., "name": ..., "source_report_id": ...}.
Inputs: report_id (required), name, folder, on_conflict. Returns: object
create_business_ruleCreate Business RuleA
Create a new rule inside an existing SAS Business Rules rule set.
A rule set can hold multiple rules, each evaluated per its conditional
type. Condition/action expressions must include the variable name
directly (e.g. "credit_score < 650", not just "< 650") — the
API accepts the latter as valid but generates DS2 code with a missing
left-hand operand. Boolean signature variables must be compared with
= 0/= 1 in expressions, not = false/= true.
Inputs: name (required), actions (required), conditions (required), ruleset_id (required), +2 more. Returns: object
create_business_rulesetCreate Business RulesetA
Create a new SAS Business Rules rule set in a SAS Content folder.
A rule set with no rules cannot be used in a decision flow — follow up
with create_business_rule to populate it.
The rule set is always stored in a folder. Without folder it goes to
the deployment's default folder; when there is none, the call is refused
and you should ask the user which folder to use. The result's folder
says where it was stored.
Inputs: name (required), signature (required), folder, description. Returns: object
create_code_fileCreate Code FileA
Create a SAS Intelligent Decisioning code file: DS2, Python or SQL.
Viya reads the signature from the code. DS2: a package with
method execute(...) — in_out parameters are outputs:
package "${PACKAGE_NAME}" /inline; method execute(double score, in_out varchar band); ... end; endpackage;. Python: def execute(score): with 'Output: band' as the first statement and
the outputs returned. SQL: {?:name:type} marks an input and
{:name:type} an output column; the result rows also come back as a
data grid.
Python cannot state types in its code, so give signature with the
dataType of every input and output, or they stay unknown; for DS2
it adds descriptions and lengths. The result's status and
errorMessage say whether the code parsed.
Inputs: code (required), name (required), code_type (required), folder, +2 more. Returns: object
create_custom_functionCreate Custom FunctionA
Create a DS2 custom function that rule expressions can call, after checking that it compiles.
The code is one DS2 method: method risk_band(double score) returns varchar(10); ... return 'LOW'; end;. Its name is the function's name.
A rule then uses it in an expression, e.g. an assignment
risk_band(credit_score). A new function takes a few seconds to be
visible to validate_decision_expression.
Inputs: code (required), category (required), description. Returns: object
create_decision_flowCreate Decision FlowA
Create a SAS Intelligent Decisioning flow: rule sets, segmentation trees, code files, models, sub-decisions, assignments, conditions and branches.
Give the flow as steps (every step kind, wired by name) or, as
before, rule_set_steps (rule sets only, wired by hand). A flow that
sets defaults, scores a model, branches on its score and checks the
result::
steps = [
{"type": "assignment", "name": "Defaults",
"assignments": {"offer": "NONE", "credit_limit": 0}},
{"type": "model", "id": "<model repository id>"},
{"type": "branch", "branch_type": "range", "variable": "P_BAD1", "cases": [
{"label": "Low risk", "max": 0.1999, "steps": [
{"type": "assignment", "assignments": {"offer": "GOLD", "credit_limit": 10000}}]},
{"label": "Medium risk", "min": 0.2, "max": 0.4999, "steps": [
{"type": "rule_set", "id": "<rule set id>"}]}],
"default": [{"type": "assignment", "assignments": {"offer": "DECLINE"}}]},
{"type": "condition", "expression": "offer = 'GOLD'",
"on_true": [{"type": "code_file", "id": "<code file id>"}], "on_false": []},
]Steps nest: a branch case, a branch default and either side of a condition hold steps of any kind, branches and conditions included.
Assignment —
assignmentsmaps a decision variable to a constant, written plainly ("GOLD",10000): the service quotes strings itself and evaluates nothing, so"a + b"is stored as that text. Compute values in a rule set or code file. The variable must be insignature;namelabels the step.Model —
idof a model in the model repository (list_registered_models, Tier 6). Its inputs map to same-named decision variables; its outputs (e.g.P_BAD1,I_BAD) are added as decision variables unlesssignaturehas them, a class label as a string.mappingsrenames:{"model variable": "decision variable"}.Branch —
variable(on the branch, or per case) andcases, checked in order; the first match runs, elsedefault.rangecases takeminand/ormax(leave one out for an open end) and compare inclusively,>= minand<= max; cases must not share a value, so end the lower case just below the next (max 0.1999next tomin 0.2).equalscases take onevalue;likecases apatternwith%and_wildcards.Condition — a DS2
expressionover decision variables, e.g.score >= 630 and band = 'A'; check it with validate_decision_expression first.Rule set, segmentation tree, code file, sub-decision —
id, optionalrevisionandmappings. Segmentation trees, code files, value lists and custom functions are created with the Tier 10 (Decisioning Advanced) tools; list_decisioning_assets finds existing ones.
The decision is always stored in a SAS Content folder. Without
folder it goes to the deployment's default folder; when there is
none, the call is refused and you should ask the user which folder to
use. The result's folder says where it was stored.
Inputs: name (required), signature (required), steps, folder, +3 more. Returns: object
create_folderCreate FolderAIdempotent
Create a SAS Content folder, including any missing folders above it.
Where it is created:
a path from the top,
/Public/Content/Risk, is created there;My Folder/Riskis created in the user's own My Folder;a relative path,
Risk/2026, is created under the deployment's default folder (MCP_DEFAULT_FOLDER). Without that setting a relative path is refused: ask the user for the full path.
A folder that already exists is returned unchanged (status
exists), so calling twice is safe. The user's SAS Viya permissions
decide where they may create folders; top-level folders such as
Public are made by administrators. For SAS Content only: model projects
live in model repositories (see create_model_project).
Inputs: path (required). Returns: object
create_glossary_termCreate Glossary TermA
Create a business term in the SAS Business Glossary.
attributes is keyed by the attribute labels from
get_glossary_term_type — call that first, because a term type can
make attributes mandatory and a term missing one is rejected. Pass each
value in its natural Python form and it is converted to the one spelling
the glossary accepts:
boolean —
True/False(the strings"true"/"false"are rejected by Viya; that conversion happens here)multi-select — a list, e.g.
["Retail", "Wholesale"]date —
"2026-09-04"date-time —
"2026-09-04T13:41:24Z"; a bare date or a numeric offset is normalised to UTC rather than rejectedtime —
"15:41:28Z"; seconds and theZare required, and a numeric offset is converted to UTC rather than dropped
Values are validated before the call, so a mistake comes back naming the attribute and what it expected, instead of as an opaque HTTP 400.
Terms are published by default. The underlying API defaults to
creating a draft, which nobody but its author can see; that is almost
never what a caller asking to "create a term" means, so this publishes
unless publish is set false. A draft is promoted afterwards with
update_glossary_term(publish=true), and is visible to
list_glossary_terms only under include_drafts.
A term's name must be unique among its siblings (case-insensitively) and differ from its parent's; a clash is rejected, not merged.
Inputs: name (required), term_type (required), label, publish, +4 more. Returns: object
create_glossary_term_typeCreate Glossary Term TypeA
Create a term type — the template that fixes what a term must carry.
A term type declares the custom attributes every term of that type holds, and which are mandatory. Without this tool a deployment's types can only be created in the SAS UI, so a glossary could be read and populated through MCP but never designed through it.
Each attribute is {"label": ..., "type": ...} plus, optionally,
required, allowed_values, default and description:
single-line,multi-line— free textsingle-select,multi-select— needallowed_valuesboolean,date,date-time,time
The attribute identifiers the API demands are generated here, since it will not mint them itself and rejects the omission with a message that names neither the attribute nor the real problem.
Inputs: name (required), label, attributes, description, +1 more. Returns: object
create_lookup_tableCreate Lookup TableA
Create a SAS Intelligent Decisioning lookup table: keys and the value stored for each.
A rule uses it with a condition {"type": "lookup", "term": {...}, "lookup": "<name or ID>"} (is the variable's value a key?) or an action
{"type": "lookupValue", "term": {...}, "expression": "<key expression>", "lookup": "<name or ID>"} (assign the key's value).
Rules only see an active version. With activate the table is
published to MAS and CAS right away (usually seconds); otherwise call
activate_lookup_table once the entries are final.
Keys are text up to 256 characters, values up to 512; numbers are stored as text. Keys must be unique and values not empty — an empty value behaves like a missing key.
Inputs: name (required), entries (required), folder, activate, +4 more. Returns: object
create_ml_projectCreate Ml ProjectA
Create a new AutoML pipeline automation project from a CAS table.
The training table must already be loaded into CAS memory at global
scope. This tool verifies that first and returns an actionable error
otherwise (use promote_table_to_memory to load + promote a source
table, and list_source_tables to find one). The data-table URI is
built from server_id/caslib_name/table_name.
Inputs: table_name (required), caslib_name (required), project_name (required), target_variable (required), +5 more. Returns: object
create_model_projectCreate Model ProjectAIdempotent
Create a SAS Model Manager project to hold models.
Projects live in a model repository, not in SAS Content. A project of
that name already in the repository is returned instead of a second one
(status exists). register_model also creates the project
it names when it does not exist, so this is needed only to prepare one.
Inputs: name (required), folder, function, repository, +4 more. Returns: object
create_performance_definitionCreate Performance DefinitionADestructiveIdempotent
Define how a project's models are monitored over time (a performance definition).
The data comes as one CAS table per period in data_caslib, named
<data_prefix>_<n>_<label>: CREDIT_1_Q1, CREDIT_2_Q2, ... Each
holds the model's inputs and the actual target. With score_data
(the default) Model Manager scores them itself; otherwise they must
already hold the model's outputs. Results go to the
ModelPerformanceData caslib, and run_performance_definition
computes them.
The project needs its target fields and a champion first:
set_project_champion sets both. A project has one performance
definition: when it has one already, that one is returned, and
replace changes it to these settings instead (it keeps its ID).
Inputs: project_id (required), data_caslib (required), data_prefix (required), name, +8 more. Returns: object
create_reportCreate ReportADestructive
Create a Visual Analytics report and return its id for further edits.
Creates an empty report shell, or — if you pass operations — builds
the whole report in one atomic call (bind data, add pages, add objects).
Building at creation avoids leaving an empty report behind if a later
edit fails. Returns {"status": "created", "id": ..., "name": ...}
plus a created summary whose object names/labels are what follow-up
placement and exports target; feed the id to apply_report_operations
to keep editing. Note: VA prepends an empty default "Page 1" before any
pages your operations add, so verify page-by-page with export_report
(see the result's verify_hint) rather than a whole-report export.
Inputs: name (required), folder, operations, on_conflict. Returns: object
create_segmentation_treeCreate Segmentation TreeA
Create a SAS Intelligent Decisioning segmentation tree.
A node tests one variable; its valueNodes are checked in order and
the first match wins, then goes to next (another node) or to an
outcomeName. A value is a value, several separated by ;
("A;B"), a comparison (">=630"), a range with v
("600<=v<630"), or "Other" for everything else, missing values
included. Example::
node = {"variable": "score", "valueNodes": [
{"value": ">=630", "outcome": "low_risk"},
{"value": "Other", "outcome": "high_risk"}]}
outcomes = [{"name": "low_risk", "assign": {"band": "LOW"}},
{"name": "high_risk", "assign": {"band": "HIGH"}}]An outcome assigns with assign (variable to value) or runs DS2
statements with code. To build a large tree from a strategy table,
use create_segmentation_tree_from_table.
Inputs: name (required), node (required), signature (required), folder, +5 more. Returns: object
create_segmentation_tree_from_tableCreate Segmentation Tree From TableA
Build one segmentation tree from a strategy table: one row per branch, a column per decision key.
This is how a FICO-style strategy export (TRIAD, Blaze) becomes a SAS
Intelligent Decisioning tree. Decision keys are tested in the order of
key_columns; a key whose values do not differ within a subtree is
not tested there. Each leaf leads to an outcome that assigns the
row's outcome_columns.
With split="lower_bound" a key's value is the lower bound of a
range, as such exports write it: sibling values 0, 600, 630 become
>= 630, 600 to < 630 and, for the lowest, Other (missing values
included). With split="exact" each distinct value is its own branch.
The table comes from exactly one of rows (inline, small tables),
file_path (a CSV the server reads, gated by
ALLOW_LOCAL_FILE_UPLOAD) or caslib_name + table_name (a CAS
table — load an Excel sheet with upload_data first). Repeated column
names in a CSV get _2, _3.
The result reports what was built — leaves, split nodes, outcomes, and
rows whose path is identical but whose outcome differs (conflicts)
— not the tree itself, which can be hundreds of kilobytes.
Inputs: name (required), key_columns (required), outcome_columns (required), rows, +11 more. Returns: object
create_value_listCreate Value ListA
Create a value list: the values (or ranges) a variable is compared with.
Segmentation tree variables and rule conditions offer a value list's
entries. A numeric entry may be a range written with v:
"v>=630", "600<=v<630", "v<600".
Inputs: name (required), entries (required), folder, data_type, +1 more. Returns: object
delete_business_ruleDelete Business RuleADestructiveIdempotent
Permanently delete a rule from a SAS Business Rules rule set.
Inputs: rule_id (required), ruleset_id (required). Returns: result
delete_business_rulesetDelete Business RulesetADestructiveIdempotent
Permanently delete a SAS Business Rules rule set.
Only call this once the rule set is confirmed unused by any decision flow — deleting a rule set still referenced by a decision fails.
Inputs: ruleset_id (required). Returns: result
delete_decision_flowDelete Decision FlowADestructiveIdempotent
Permanently delete a SAS Intelligent Decisioning flow.
Inputs: decision_id (required). Returns: result
delete_decisioning_assetDelete Decisioning AssetADestructiveIdempotent
Permanently delete a piece of decisioning content and all its revisions.
Something still in use — a rule set or code file a decision references, a category that still holds functions — is refused by Viya. A lookup table that rule sets use is refused here, naming them: Viya would delete it and leave those rules invalid.
Inputs: asset_id (required), asset_type (required). Returns: object
delete_glossary_termDelete Glossary TermADestructiveIdempotent
Permanently delete a business term.
The term goes, and with it every assignment to a column that referenced
it — the data keeps its columns but loses the documented meaning. Check
list_term_assets first: a term with assigned assets is in use.
There is no cascade. A term that has children cannot be deleted at
all: the glossary refuses with Cannot delete a term/draft with existing children. Delete the subtree leaf-first — list a term's
children with list_glossary_terms(parent_id=...) — or re-parent them
with update_glossary_term before deleting this one.
Inputs: term_id (required). Returns: object
delete_glossary_term_typeDelete Glossary Term TypeADestructiveIdempotent
Delete a term type.
Refuses while terms still use the type, because deleting it takes their
attribute definitions with it. Check with list_glossary_terms
(term_type=) and move or delete those terms first — or pass
force if you have already decided.
Inputs: term_type_id (required), force. Returns: object
delete_kpi_alert_ruleDelete Kpi Alert RuleADestructiveIdempotent
Delete one of a project's KPI alert rules (get_project_kpis lists them).
Inputs: project_id (required), alert_rule_id (required). Returns: object
delete_reportDelete ReportADestructiveIdempotent
Delete a Visual Analytics report and its content.
There is no per-object undo in the report API, so deleting and rebuilding
(or copying first) is how you discard an unwanted report. Returns
{"status": "deleted", "report_id": ...} (or not_found /
delete_failed).
Inputs: report_id (required). Returns: object
describe_analytic_storeDescribe Analytic StoreAIdempotent
Describe an analytic store (a model saved in CAS): its inputs, outputs and algorithm.
Runs PROC ASTORE DESCRIBE. Use it before register_model to see
which variables the model expects and produces, and so which target
and event to register it with.
Inputs: table_name (required), caslib_name (required). Returns: object
describe_report_objectsDescribe Report ObjectsARead-onlyIdempotent
Discover what a Visual Analytics report can contain — operations and objects.
Call this to learn how to build a report before calling
apply_report_operations. It reads a bundled catalog (no network), so
it is the cheap way to look up an object's data roles instead of guessing.
Inputs: category, operation, object_type. Returns: object
download_fileDownload FileARead-onlyIdempotent
Download file content from the Viya Files Service.
Inputs: file_id (required). Returns: result
drop_castableDrop CastableADestructiveIdempotent
Drop a table from CAS memory, keeping its source file.
Frees the memory a loaded table takes; promote_table_to_memory
loads it again from its source. Nothing on disk is deleted. A table
with no source file in its caslib exists only in memory, so dropping
it would lose its data: such a table is refused unless
allow_unsaved is true. Save it first with save_castable, or
ask the user before dropping it. A table that is not loaded is left
as it is.
Inputs: table_name (required), caslib_name (required), server_id, allow_unsaved. Returns: object
execute_sas_codeExecute Sas CodeADestructive
Executes the provided SAS code in the Viya environment and returns information about the completed Job. This will create a job definition for the SAS code, execute it, and then retrieve the results.
IMPORTANT — state persists between calls: the code runs in a reusable
compute session that is kept warm and shared across calls (per user),
so SAS state — WORK tables, macro variables, and assigned librefs —
survives between successive execute_sas_code calls. A re-run can
therefore see leftovers from earlier calls (e.g. a check that counts
results twice). Pass fresh_session=True (or call
reset_compute_session) when the code must start from a clean slate.
Tip: to reach CAS data, prefer libname casuser cas; (or a targeted
caslib statement) over caslib _all_ assign; — on tenants with
many caslibs the latter floods the log with assignment NOTEs.
Inputs: sas_code (required), html_results, fresh_session. Returns: object
export_reportExport ReportARead-onlyIdempotent
Export a Visual Analytics report (or specific report objects) in any format the VA service exposes, via its synchronous export endpoints.
Formats (export_format):
package— full report bundle as a.zip(source files, query results, and rendered content); whole report or selected objects.pdf— rendered PDF; whole report or selected objects. Pass rendering overrides (e.g.orientation,paperSize,margin,includeCoverPage) viaoptions.png/svg— image of the report or a single object;image_sizeis required, e.g."1200px,800px".csv/tsv/xlsx— the data behind a single report object; exactly one object label is required.summary— the report's text summary.
Inputs: report_id (required), export_format (required), options, image_size, +1 more.
find_folderFind FolderARead-onlyIdempotent
Look up a SAS Content folder and return its ID, URI, name and full path.
Use it to confirm a folder the user named before storing something
there, or to turn a path into the folder URI that upload_file and
the deployment's MCP_DEFAULT_FOLDER setting take. The tools that
create rule sets and decisions accept a path directly, so they do not
need this first.
Inputs: folder (required). Returns: object
get_business_ruleGet Business RuleARead-onlyIdempotent
Fetch a single rule's definition from a SAS Business Rules rule set.
Inputs: rule_id (required), ruleset_id (required). Returns: object
get_business_rulesetGet Business RulesetARead-onlyIdempotent
Fetch a single SAS Business Rules rule set by ID.
Inputs: ruleset_id (required). Returns: object
get_castable_columnsGet Castable ColumnsARead-onlyIdempotent
Get column metadata for a CAS table (names, types, labels, formats).
A missing table returns a structured not_found with the two usual
causes (unloaded source table vs session-scoped table) instead of a raw
HTTP error.
Inputs: server_id (required), table_name (required), caslib_name (required), limit. Returns: result
get_castable_dataGet Castable DataBRead-onlyIdempotent
Fetch rows from a CAS table with column names.
Inputs: server_id (required), table_name (required), caslib_name (required), limit, +1 more. Returns: object
get_castable_infoGet Castable InfoARead-onlyIdempotent
Get metadata for a CAS table (row count, column count, size, etc.).
Inputs: server_id (required), table_name (required), caslib_name (required). Returns: object
get_compute_table_dataGet Compute Table DataARead-onlyIdempotent
Fetch rows from a table in a SAS library, with column names.
The compute-tier counterpart of get_castable_data: a plain page of
rows from libref.table as the session sees it, read through the
compute session's data API rather than by running SQL. Values arrive
formatted the way SAS displays them (dates as text, numbers with their
format applied), which is what a person browsing a table expects; use
query_data with target='compute' when you need raw numerics,
a WHERE clause, or a join.
Runs in the reusable per-user compute session for the context, so
WORK tables from earlier execute_sas_code calls are visible.
Inputs: table_name (required), library_name (required), compute_context_name (required), limit, +1 more. Returns: object
get_decision_flowGet Decision FlowARead-onlyIdempotent
Fetch the current state of a SAS Intelligent Decisioning flow.
Inputs: decision_id (required). Returns: object
get_decision_flow_codeGet Decision Flow CodeARead-onlyIdempotent
Retrieve the generated DS2 execution code for a decision flow.
Inputs: decision_id (required). Returns: result
get_decision_flow_revisionGet Decision Flow RevisionARead-onlyIdempotent
Fetch the content of a specific locked decision revision.
Inputs: decision_id (required), revision_id (required). Returns: object
get_decisioning_assetGet Decisioning AssetARead-onlyIdempotent
Fetch one piece of decisioning content, or one of its revisions, with the folder it is in.
A rule set comes with its rules, a code file with its code, a value
list with the entries of its newest version, a lookup table with its
versions, the entries of its active one (get_lookup_table pages and
filters them) and the rule sets that use it. Content larger than
150,000 characters — a big segmentation tree — is summarised (counts,
root variable) instead of returned whole; summary_only asks for the
summary of anything.
Inputs: asset_id (required), asset_type (required), revision_id, summary_only. Returns: object
get_decisioning_asset_codeGet Decisioning Asset CodeBRead-onlyIdempotent
The DS2 code Viya generates for a rule set, decision or segmentation tree, or a code file's source.
Inputs: asset_id (required), asset_type (required), revision_id. Returns: result
get_glossary_termGet Glossary TermARead-onlyIdempotent
Get one business term in full, with its custom attributes named rather than hashed.
The raw API returns attributes keyed by attribute-definition UUID,
which is unreadable on its own. This resolves each key to the label the
glossary UI shows and drops the ones left empty, so what comes back is
the term as a person would read it. attribute_ids is the raw map,
unfiltered — so an attribute the term leaves unset is absent from
attributes but present as "" there. The two disagree by design:
one says what the term holds, the other what was stored.
Also returns catalog_entity_id — the other id this term has, the
one asset relationships point at.
Inputs: term_id (required). Returns: object
get_glossary_term_typeGet Glossary Term TypeARead-onlyIdempotent
Get a term type and the attribute contract its terms must satisfy.
Call this before creating or updating a term: it names every custom
attribute, its data type, whether it is required, the exact values a
single- or multi-select accepts, and value_format — the one spelling
Viya takes for that type, which the API itself documents nowhere.
create_glossary_term takes attributes keyed by the label shown
here, so this is also the vocabulary to write in.
Inputs: term_type_id (required). Returns: object
get_job_logGet Job LogARead-onlyIdempotent
Retrieve the log of a completed job.
Inputs: job_id (required). Returns: result
get_job_statusGet Job StatusARead-onlyIdempotent
Check the status of a submitted job.
Inputs: job_id (required). Returns: object
get_lookup_tableGet Lookup TableARead-onlyIdempotent
Read a lookup table: its versions, one version's entries and the rule sets that use it.
active_version is the version rules use now. A version's status
is developing, production (active, or formerly active) or activating;
activationStatus failed with activationError means its publish
failed. used_by lists the rule sets that reference the table.
Inputs: lookup_table (required), limit, start, version, +1 more. Returns: object
get_mas_module_step_signatureGet Mas Module Step SignatureARead-onlyIdempotent
Fetch a MAS module step's input/output variable signature.
Call before score_data to know the exact variable names, types,
and order to pass as inputs, and what outputs to expect.
Inputs: module_id (required), step_id. Returns: object
get_modelGet ModelARead-onlyIdempotent
Describe a registered model: project, version, target, variables and files.
Use it before scoring, publishing or monitoring a model, to see its
input variables (what a scoring table must hold), its target and event
probability variable, and whether it is the project's champion
(role).
Inputs: model_id (required). Returns: object
get_project_kpisGet Project KpisARead-onlyIdempotent
Read how a project's models are monitored: KPIs, KPI alert rules, alerts and performance definitions.
kpis are the latest values from the performance runs, each with a
name (_AUC_, _MISC_, _F1_, _ASE_, ...; devIndex
once per variable for drift), a value and a kpiCategory.
alert_rules are the project's KPI alert rules
(set_kpi_alert_rule), and alerts checks the champion — or
model_id — against each: breached is Model Manager's own
verdict on the latest KPI. performance_definitions are what
run_performance_definition runs.
Inputs: project_id (required), limit, model_id. Returns: object
get_reportGet ReportARead-onlyIdempotent
Get a Visual Analytics report's metadata and definition.
Inputs: report_id (required). Returns: object
get_report_outlineGet Report OutlineARead-onlyIdempotent
Read a report's structure: pages → objects with the handles other tools need.
Reduces the stored report definition to a compact outline —
per page its internal name and label, per object its name (ve*),
label, type, and any text content. Use it to edit an existing report,
to recover object names after an apply, or to check what a batch
actually produced:
object
name→ the target forrelativeToObject/containerplacement andupdateObject;object
label→ whatexport_reportreport_objectstakes;page
label→ thepageplacement target.
Returns {"status": "ok", "pages": [...], "hint": ...} (or
not_found / outline_failed).
Inputs: report_id (required). Returns: object
get_score_executionGet Score ExecutionBRead-onlyIdempotent
Report a score execution: its state, its output table, and why it failed if it did.
Inputs: execution_id (required), rows. Returns: object
import_glossary_termsImport Glossary TermsADestructive
Create many business terms, and their hierarchy, in one call.
Building a hierarchy one term at a time means a call per term and a wait between levels, because a child needs the parent's id from the previous response. This uses the glossary's own bulk import instead: one request for the whole tree, with parents resolved by name rather than by id, so nothing has to be threaded through.
Give each row a name and, for a child, a parent — the name of
another row in the same batch, or the path of a term that already exists
(levels separated by a backslash). Rows may be given in any order; they
are sorted so every parent is created before its children.
Attribute values take the same forms as create_glossary_term —
True/False for a boolean, a list for a multi-select — and are
validated here, per term type, before anything is sent. So are the term
type's required attributes: a row missing one fails inside the job
with a message naming only the field, so the batch is refused here
instead, before any of it is committed.
The import runs as a job and reports rows individually. A row can
fail while the rest succeed, so the result carries created,
failed and a failures list naming each bad row and why. Treat a
non-empty failures as a partial import: the successful rows are
already committed.
The result names the term each row became. terms carries
{name, path, term_id, existed} per row, so the next step — assigning
an asset, re-parenting, reading one back — needs no lookup. This costs
one filtered request per 40 distinct names, not one per term.
Two things the import does that a per-term create does not:
A row is written whole. With
update_existingthe term at that path is replaced, so an attribute the row omits is reset — not left as it was. Without it the existing term is left alone. Either way the job counts the row as successful, socreatedcounts rows the job accepted;newis the count of terms that did not exist before, withalready_existedthe rest andexistedsaying which is which per row.Omitted attributes take the term type's default, on new rows as well as replaced ones — the same as creating a term through the API.
Inputs: terms (required), dry_run, term_type, timeout_seconds, +1 more. Returns: object
list_business_rulesList Business RulesARead-onlyIdempotent
List all rules inside a SAS Business Rules rule set.
Inputs: ruleset_id (required), limit. Returns: result
list_business_ruleset_revisionsList Business Ruleset RevisionsARead-onlyIdempotent
List all locked revisions of a rule set.
Inputs: ruleset_id (required), limit. Returns: result
list_business_rulesetsList Business RulesetsARead-onlyIdempotent
List SAS Business Rules rule sets, optionally filtered by name substring.
Inputs: limit, filter_name. Returns: result
list_caslibsList CaslibsARead-onlyIdempotent
List CAS libraries (caslibs) available on a CAS server.
Inputs: server_id (required), limit. Returns: result
list_cas_serversList Cas ServersARead-onlyIdempotent
List available CAS servers on the Viya environment.
Inputs: no named parameters. Returns: result
list_castablesList CastablesCRead-onlyIdempotent
List tables in a CAS library.
Inputs: server_id (required), caslib_name (required), limit. Returns: result
list_compute_columnsList Compute ColumnsARead-onlyIdempotent
List the columns of a table in a SAS library within a compute context.
Runs in the reusable per-user compute session for the context.
Inputs: table_name (required), library_name (required), compute_context_name (required), limit, +2 more. Returns: result
list_compute_contextsList Compute ContextsBRead-onlyIdempotent
List available compute contexts on the Viya environment.
Inputs: limit, start, filter_name. Returns: result
list_compute_librariesList Compute LibrariesARead-onlyIdempotent
List the SAS libraries (librefs) assigned in a compute context.
Runs in the reusable per-user compute session for the context, so it
also sees libraries created by prior execute_sas_code calls.
Inputs: compute_context_name (required), limit, start, filter_name. Returns: result
list_compute_tablesList Compute TablesARead-onlyIdempotent
List the tables in a SAS library within a compute context.
These are SAS/Compute tables (e.g. WORK or an assigned libref), distinct from in-memory CAS tables (see list_castables). Runs in the reusable per-user compute session for the context.
Inputs: library_name (required), compute_context_name (required), limit, start, +1 more. Returns: result
list_decision_flow_revisionsList Decision Flow RevisionsARead-onlyIdempotent
List all locked revisions of a decision flow.
Inputs: decision_id (required), limit. Returns: result
list_decision_flowsList Decision FlowsARead-onlyIdempotent
List SAS Intelligent Decisioning flows, optionally filtered by name substring.
Inputs: limit, filter_name. Returns: result
list_decisioning_asset_revisionsList Decisioning Asset RevisionsARead-onlyIdempotent
List the revisions of a rule set, decision, segmentation tree or code file, newest first.
The newest revision is the working one; every other one is locked.
Inputs: asset_id (required), asset_type (required), limit. Returns: result
list_decisioning_assetsList Decisioning AssetsARead-onlyIdempotent
List SAS Intelligent Decisioning content of one kind, optionally filtered by name.
Inputs: asset_type (required), limit, filter_name. Returns: result
list_filesList FilesARead-onlyIdempotent
List files in the Viya Files Service.
Inputs: limit, filter_name. Returns: result
list_glossary_termsList Glossary TermsARead-onlyIdempotent
List glossary terms by structure — term type, parent, or name fragment.
The counterpart to search_glossary_terms: exact filters instead of
ranked text. Use it to walk the hierarchy (parent_id returns a term's
direct children, which is the authoritative parent/child relationship),
to inventory one term type, or to page the whole dictionary with no
arguments at all.
Inputs: limit, start, parent_id, term_type, +4 more. Returns: object
list_glossary_term_typesList Glossary Term TypesARead-onlyIdempotent
List the term types defined in the SAS Business Glossary.
A term type is the template a term is created from: it fixes which
custom attributes the term carries and which of them are mandatory. Every
term belongs to exactly one, and the choice is immutable after creation —
so pick the type before calling create_glossary_term, then read its
attribute contract with get_glossary_term_type.
usage_count is how many terms already use the type, which is the
quickest way to tell a deployment's working vocabulary from types that
were created once and abandoned.
Inputs: limit, start. Returns: object
list_jobsList JobsARead-onlyIdempotent
List recent jobs from the Job Execution service.
Inputs: limit. Returns: result
list_mas_modulesList Mas ModulesARead-onlyIdempotent
List published scoring models and decisions (MAS modules).
Inputs: limit. Returns: result
list_ml_projectsList Ml ProjectsBRead-onlyIdempotent
List AutoML pipeline automation projects.
Inputs: limit. Returns: result
list_model_projectsList Model ProjectsBRead-onlyIdempotent
List SAS Model Manager projects, most recently changed first.
Inputs: limit, repository, name_filter. Returns: result
list_model_repositoriesList Model RepositoriesARead-onlyIdempotent
List the SAS Model Manager repositories (where model projects live).
default marks the one new projects and registrations use when a call
names none (the deployment's MCP_DEFAULT_MODEL_REPOSITORY).
Inputs: no named parameters. Returns: result
list_model_versionsList Model VersionsBRead-onlyIdempotent
List a registered model's versions, the current one first.
Inputs: model_id (required). Returns: object
list_published_modelsList Published ModelsARead-onlyIdempotent
List models published to destinations (MAS, CAS, containers, Git, ...).
Each entry names its destination, its published name, its state and
the registered model it came from (modelId). Use it to find the
published copy that validate_published_model checks, or to see
where a model is already deployed.
Inputs: limit, name_filter, destination_name. Returns: result
list_publishing_destinationsList Publishing DestinationsBRead-onlyIdempotent
List available publishing destinations.
Inputs: limit, start, filter_name. Returns: result
list_registered_modelsList Registered ModelsBRead-onlyIdempotent
List models in the Model Repository.
Inputs: limit. Returns: result
list_reportsList ReportsBRead-onlyIdempotent
List Visual Analytics reports.
Inputs: limit, filter_name. Returns: result
list_source_tablesList Source TablesARead-onlyIdempotent
List source tables that are NOT yet loaded into memory in a CAS library.
These are the candidates for promote_table_to_memory — tables that
exist on the caslib's data source but are not in CAS memory yet.
Inputs: server_id (required), caslib_name (required), limit. Returns: result
list_table_termsList Table TermsARead-onlyIdempotent
List the business terms assigned to a table's columns.
The reverse of list_term_assets, and the fastest way to judge whether
a table is governed: it reports each column's term together with the
term's own definition, so a caller can read what a cryptically named
column actually holds.
Terms come from glossaryTermAsset relationships, so a column with no
term here has genuinely never been assigned one — the catalog does not
guess from column names.
Inputs: table_name, max_columns, resource_uri, assigned_only. Returns: object
list_term_assetsList Term AssetsARead-onlyIdempotent
List the data assets a business term is attached to — the columns that mean it.
The authoritative answer to "where is this term actually used?", read
from the glossaryTermAsset relationships rather than inferred from
names. Each entry names the column and the table it belongs to.
An empty result means the term is assigned to nothing, which is not
the same as no matching column existing — assign_glossary_term is
what creates the link. For a looser, name-based sweep, catalog_search
accepts the Column.term:"<term name>" facet on the datasets
index, which returns matching tables without resolving columns.
Inputs: limit, start, term_id, term_name. Returns: object
lock_business_ruleset_revisionLock Business Ruleset RevisionA
Lock the current state of a rule set as an immutable revision.
Decision steps reference a specific rule set revision (versionId), not the live working copy, so a revision must exist before wiring a rule set into a decision flow — call again after editing rules if a decision needs to pick up the changes.
Viya locks the revision that was current and opens the next one: the
result describes that new working revision, as before, and
locked_revision the frozen one — use its id as the versionId
for a reference that later edits cannot change.
The revision-creation request replaces the rule set's full content
from the body sent, so this fetches the rule set with its rules
included (application/vnd.sas.business.rule.set.integral+json)
and resends them — omitting them would wipe the live rule set's rules,
not just the new revision.
Inputs: ruleset_id (required), revision_type. Returns: object
lock_decision_flow_revisionLock Decision Flow RevisionA
Lock the current state of a decision flow as an immutable revision.
Call after a successful create/update to freeze the approved state as
a point-in-time snapshot referenceable by publish_decision_flow.
Viya locks the revision that was current and opens the next one: the
result describes that new working revision, as before, and
locked_revision the frozen one.
Inputs: decision_id (required). Returns: object
lock_decisioning_asset_revisionLock Decisioning Asset RevisionA
Freeze the current state of a rule set, decision, segmentation tree or code file as a locked revision.
Viya locks the revision that was current and opens the next one for
editing (1.0 is locked, 1.1 is open). locked_revision is the frozen
state: reference it from a decision step or publish it. Later edits go
to working_revision and do not change what was locked.
Inputs: asset_id (required), asset_type (required), revision_type. Returns: object
promote_table_to_memoryPromote Table To MemoryAIdempotent
Load a source table into CAS memory at global scope (visible to all sessions).
Loads the table from its caslib data source and promotes it to global
scope via the casManagement updateTableState API. Idempotent: if the
table is already loaded in global scope it is left untouched. Use
list_source_tables to discover unloaded tables that can be promoted.
Inputs: server_id (required), table_name (required), caslib_name (required). Returns: object
publish_decision_flowPublish Decision FlowA
Publish a locked decision revision to a Micro Analytic Score (MAS) destination.
Required before score_data can execute the decision — MAS runs
published modules, not decision flows directly. Requires the DS2 code
generation service to be healthy for this decision's rule sets; an
error mentioning rule set code generation is an environment-level
issue, not a bad payload.
Publishing is asynchronous and the resulting MAS module ID is
server-generated — it is NOT publish_name. This polls the
publish job (properties.masModules[0].jobUri) until it reaches a
terminal state and returns the real moduleId alongside the
publish record, so the result is directly usable with
get_mas_module_step_signature/score_data without a separate
lookup via list_mas_modules.
The code is generated for MAS, as SAS Intelligent Decisioning does when
it publishes, so lookup tables are read from MAS. Unlike a module the
Intelligent Decisioning UI publishes, whose inputs end in an underscore
(credit_score_), the module's inputs keep the decision's variable
names.
Inputs: decision_id (required), revision_id (required), publish_name (required), poll_timeout, +1 more. Returns: object
publish_ml_champion_modelPublish Ml Champion ModelBDestructive
Publish the champion model from an AutoML pipeline automation project to a destination.
Inputs: project_id (required), destination_name. Returns: object
publish_modelPublish ModelADestructive
Publish a registered model to a destination: MAS, CAS, a container registry, Git, ...
Any model in the Model Repository can be published, whatever made it.
With dry_run the tool only reports what it would do: the
destination and its type, the published name, and whether a published
model of that name is already there. A published model of the same
name is not replaced unless replace is true. Publishing runs in the
background; list_published_models shows its state and
validate_published_model checks the published copy.
Inputs: model_id (required), dry_run, replace, publish_name, +2 more. Returns: object
query_dataQuery DataA
Run a FedSQL SELECT against CAS or compute data and return the rows.
One SQL surface over both storage tiers, so exploring a caslib table and a SAS library table use the same tool and the same dialect. The query runs in the reusable compute session; nothing is persisted — the result is materialised into session scratch, read back, and dropped.
Pick the tier with target — it selects the namespace, and the two
cannot be mixed in one statement (a caslib table and a libref table
cannot be joined; stage one side first with execute_sas_code):
target='cas'(default) — qualify ascaslib.table(e.g.Public.HMEQ); see list_caslibs / list_castables.target='compute'— qualify aslibref.table(e.g.WORK.SALES); see list_compute_libraries / list_compute_tables. Concatenated librefs — several directories under one name, which is what SASHELP and MAPS are — are invisible to FedSQL, because its BASE driver maps one schema to one directory. Copy such a table into WORK first (data work.cars; set sashelp.cars; run;) and queryWORK.CARS.
Dialect notes (FedSQL, not PROC SQL): joins (inner/left/right/full/
cross), subqueries, UNION, GROUP BY/HAVING/ORDER BY, and scalar functions
work. There is no WITH/CTE — use a derived table (select ...) "t"
— and no MERGE; express a merge as a join (a full join with COALESCE
gives upsert semantics). Double-quote identifiers that are reserved words
or contain spaces; SAS name literals ('x'n) are not FedSQL.
Row capping is done by this tool, not by your SQL: any LIMIT you write is
ignored in favour of limit (a malformed LIMIT is silently discarded by
CAS and would return the whole table). Add ORDER BY for stable paging.
Inputs: query (required), limit, start, target, +2 more. Returns: object
register_ml_champion_modelRegister Ml Champion ModelB
Register the champion model from an AutoML pipeline automation project to the Model Repository.
Inputs: project_id (required). Returns: object
register_modelRegister ModelADestructive
Register a SAS model in SAS Model Manager with PROC REGISTERMODEL.
Takes either an analytic store in CAS (astore_caslib +
astore_table, as written by savestate rstore=) or DATA step
score code (score_code). Not Python or DS2 models. The procedure
stores the model's variables, properties and score code, and with
assessment its fit statistics, ROC and lift. It runs in a compute
session of its own and takes 5–30 seconds.
The project is project_id, or the project named project in the
repository (created there when missing, in project_folder).
A model with the same name already in the project is refused
unless replace is true. Replacing deletes that model and creates
one with a new ID, which loses its score tests, publish history and
monitoring: ask the user before passing replace.
Inputs: name (required), modeler, project, replace, +15 more. Returns: object
reset_compute_sessionReset Compute SessionADestructiveIdempotent
Reset (delete) the cached compute session for a compute context.
The server keeps one reusable SAS compute session per user and compute
context so repeat calls skip the slow session spin-up; SAS state (WORK
tables, macro variables, assigned librefs) therefore persists across
execute_sas_code and list_compute_* calls. Call this to discard
that state — the next compute tool call transparently creates a fresh
session.
Inputs: compute_context_name. Returns: object
run_ml_projectRun Ml ProjectC
Run an AutoML pipeline automation project.
Inputs: project_id (required). Returns: object
run_performance_definitionRun Performance DefinitionA
Run a performance definition: score and assess each period table, then calculate the KPIs.
Name the definition, or the project when it has just one. The run
goes on in the background. With wait_seconds the tool waits up to
that long (at most 600); when the run has finished it has Model
Manager calculate the project's KPIs, as Model Manager's own
monitoring workflow does, and reports the KPI alert rules the
champion breaks. Otherwise call again with wait_seconds, or read
get_project_kpis later. Runs over two small periods took from
half a minute to two minutes on SAS Viya 2026.10.
Inputs: project_id, wait_seconds, performance_definition_id. Returns: object
save_castableSave CastableADestructiveIdempotent
Save an in-memory CAS table to a file (or database table) in a caslib.
A table loaded into CAS memory is lost when it is dropped or the CAS
server restarts unless it is saved. This writes it to the caslib's
data source, so promote_table_to_memory can load it again later.
An existing file is not overwritten unless replace is true.
Inputs: table_name (required), caslib_name (required), replace, server_id, +3 more. Returns: object
score_dataScore DataA
Score data against a published model or decision (MAS module).
A decision published from the SAS Intelligent Decisioning UI names its
inputs with a trailing underscore (credit_score_); the plain names
are accepted and mapped, and the result's inputs_renamed says so.
(publish_decision_flow keeps the plain names.)
Inputs: step_id (required), module_id (required), input_data (required). Returns: object
score_tableScore TableADestructive
Score a whole CAS table with a registered model; the result is a new CAS table.
Runs the model straight from the Model Repository, so it need not be
published first. Scoring runs in the background: this returns the
score execution at once, and get_score_execution reports when it
has finished and where the scored table is. The score definition
stays in the model's project, as one made in Model Manager would.
Inputs: model_id (required), table_name (required), caslib_name (required), output_table, +1 more. Returns: object
search_glossary_termsSearch Glossary TermsARead-onlyIdempotent
Free-text search of the business glossary — the way in when you know a word, not an id.
Runs against the SAS Data Governance catalog's terms index, so it is ranked
and matches definitions as well as names, unlike list_glossary_terms'
exact structural filters. Supports the catalog grammar: wildcards
(rev*), field constraints (Name:revenue, Status:Published)
and + to require a word.
Each hit carries both identifiers — term_id for every other
glossary tool, catalog_entity_id for catalog relationships — plus
assigned_asset_count, so you can tell whether a term is actually in
use before spending a call on list_term_assets. A term with a count
of 0 exists in the dictionary and is attached to no data.
Inputs: query (required), limit, start, include_attributes. Returns: object
set_kpi_alert_ruleSet Kpi Alert RuleADestructiveIdempotent
Set a KPI alert rule on a model project: alert when a monitoring KPI crosses a threshold.
Model Manager checks the project's models against its rules whenever
their KPIs are calculated (run_performance_definition) and lists
them as the project's KPI rules. kpi is one of:
accuracy:
AUC,misclassification,TPR,FPR,F1,ASE,RASE,R-squared,global accuracy, cumulative lift_Cumlift5_to_Cumlift30_, or the KPI namesget_project_kpislists;drift:
devIndex(the deviation index) of each variable invariables, input or output — one rule per variable;fairness:
EqualOpportunity,DemographicParity,PredictiveParity,EqualAccuracyorEqualizedOddsfor the sensitive variable invariables.
operator is greaterThan (alert above the threshold, as for
misclassification or drift) or lessThan (alert below it, as for
AUC). A rule for the same KPI, variable and direction is updated, not
duplicated; alert_rule_id updates a given rule, its direction too.
The result says whether the champion breaks the rule now.
Inputs: kpi (required), operator (required), threshold (required), project_id (required), +5 more. Returns: object
set_project_championSet Project ChampionADestructiveIdempotent
Make a model its project's champion, preparing the project as Model Manager's UI does.
The champion is the model a project publishes and monitors. Model Manager refuses a champion until the project has its target fields and its variables, which PROC REGISTERMODEL does not set, so this first copies the model's target, event and event probability variable to the project where they are missing, and adds the model's input and output variables the project lacks. Fields already set are kept.
Inputs: model_id (required), project_id (required). Returns: object
submit_batch_jobSubmit Batch JobADestructive
Submit a SAS job for asynchronous execution via the Job Execution service.
Inputs: sas_code (required), job_name. Returns: object
test_score_modelTest Score ModelA
Score a few rows with a registered model and return the scored rows.
Model Manager's own score test: it takes the first rows rows of
the table, scores them with the model in the "SAS Model Manager
compute context", waits, and returns them with the model's output
columns (for example P_BAD1 and I_BAD). Use it to check that a
model runs before publishing or monitoring it. Nothing is left behind:
the scratch tables and the score definition are removed. It takes
about 15 seconds plus a compute session start.
The table needs the model's input variables (get_model lists
them). For a whole table use score_table.
Inputs: model_id (required), table_name (required), caslib_name (required), rows, +1 more. Returns: object
unassign_glossary_termUnassign Glossary TermADestructiveIdempotent
Remove a business term's assignment from a table column.
Deletes only the link: the term and the column both survive. Use
delete_glossary_term to remove the term from the dictionary itself.
Inputs: column_name (required), term_id, term_name, table_name, +1 more. Returns: object
update_business_ruleUpdate Business RuleCDestructiveIdempotent
Update an existing rule inside a SAS Business Rules rule set.
Inputs: name (required), actions (required), rule_id (required), conditions (required), +3 more. Returns: object
update_business_rulesetUpdate Business RulesetADestructiveIdempotent
Update an existing SAS Business Rules rule set's name/description/signature.
Changing the signature can invalidate existing rules that reference
removed variables — check with get_business_ruleset first if unsure.
The rule set stays in its folder. One that is in no folder (created
before folders were required) is filed into folder, or the default
folder. The result's folder says where the rule set is.
Inputs: name (required), signature (required), ruleset_id (required), folder, +1 more. Returns: object
update_code_fileUpdate Code FileADestructiveIdempotent
Change a code file's working revision: its code, name, description or signature types.
New code makes Viya read the signature again. Lock a revision first (lock_decisioning_asset_revision) to keep the current state.
Inputs: code_file_id (required), code, name, folder, +2 more. Returns: object
update_custom_functionUpdate Custom FunctionADestructiveIdempotent
Change a custom function's code, description or category; new code is checked to compile first.
Every rule set that calls the function uses the new code from its next code generation.
Inputs: function_id (required), code, category, description. Returns: object
update_decision_flowUpdate Decision FlowADestructiveIdempotent
Update an existing SAS Intelligent Decisioning flow.
Pass ALL steps (existing + new), as steps or rule_set_steps —
the full flow is replaced on update, it is not a partial patch.
The decision stays in its folder. One that is in no folder (created
before folders were required) is filed into folder, or the default
folder. The result's folder says where the decision is.
Inputs: name (required), signature (required), decision_id (required), steps, +4 more. Returns: object
update_glossary_termUpdate Glossary TermADestructiveIdempotent
Update a business term's text, parent or custom attributes — and publish a draft.
The glossary API replaces the whole term on update, so this reads the
current one first and merges your changes into it: omitting an argument
leaves that field alone rather than blanking it. attributes merges
the same way, per attribute — pass only the ones you are changing, and
set one to "" to clear it. A boolean is the exception: the
glossary has no empty boolean and rejects "", so set it to
True/False rather than trying to clear it.
Because the whole term is rewritten, every attribute the type marks required must hold a value — including ones made required after this term was created. That is checked before the call, and reported by name.
A term's type cannot be changed after creation. Its parent can:
pass parent_id to move it, or "" to make it a root term.
A draft is a different resource. A term left unpublished by
create_glossary_term(publish=false) can be read and deleted at the
ordinary path, but not written there — the service answers a plain
PUT on a draft with a 404. This routes the write to the draft
instead, so editing one works; and publish then promotes it to a
published term, which nothing else here could do. Publishing a term that
is already published is reported, not attempted: there is no draft to
promote and the service answers that with a 404 too.
Inputs: term_id (required), name, label, publish, +4 more. Returns: object
update_glossary_term_typeUpdate Glossary Term TypeADestructiveIdempotent
Change a term type: rename it, or add, edit and remove its attributes.
Attributes are matched to the existing ones by label, and an edit keeps that attribute's identifier — which matters more than it looks, because every term's stored values are filed under it. An attribute the caller does not mention is left alone; a label that does not exist yet is added.
To rename one, give its attribute_id alongside the new
label. Matching by label alone cannot express a rename: the new
label matches nothing, so the attribute is added afresh under a new
identifier and every term's value stays behind under the old one, no
longer readable as that attribute. get_glossary_term_type returns
the id of each.
Making an attribute required applies to terms created afterwards
and to every later edit of the ones already there: an update rewrites
the whole term, so older terms must be given a value for it before they
can be saved again. update_glossary_term reports that by name.
Inputs: term_type_id (required), name, label, attributes, +3 more. Returns: object
update_lookup_tableUpdate Lookup TableADestructive
Change a lookup table's entries, column labels, name or description.
Entry changes go to the newest version while it is still being
developed. An active version is never changed: a new version is
started from it, with its entries, and the changes go there. Rules
keep using the active version until the new one is activated — pass
activate to do that in the same call.
set_entries adds keys and overwrites the values of existing ones;
remove_keys deletes keys (keys that are not there are reported in
not_found); replace_entries replaces every entry instead.
Inputs: lookup_table (required), name, folder, activate, +7 more. Returns: object
update_segmentation_treeUpdate Segmentation TreeADestructiveIdempotent
Change a segmentation tree's working revision: only the parts given are replaced.
node replaces the whole node structure and outcomes the whole
outcome list. The tree stays in its folder; one in no folder is filed
into folder or the default folder.
Inputs: tree_id (required), name, node, folder, +6 more. Returns: object
update_value_list_entriesUpdate Value List EntriesADestructiveIdempotent
Replace the entries of a value list's newest version.
A version already in production is left alone: a new version holds the entries instead.
Inputs: entries (required), value_list_id (required). Returns: object
upload_dataUpload DataA
Upload a data file into a CAS table — read by the server, not the model.
Provide the data by reference through exactly one of:
file_path— the server reads the file off its own disk (in stdio mode that's your machine). Disable withALLOW_LOCAL_FILE_UPLOAD=false.url— the server fetches it over HTTP.
Either way the bytes are read server-side and never pass through the calling
model's context window. Sources larger than MAX_UPLOAD_BYTES (default
100 MiB — SAS Viya's own default file-upload limit) are refused. To create a
small table you are building inline (no file or URL), use the
upload_inline_data tool instead.
The casManagement uploadTable endpoint only accepts an uploaded file (multipart
form-data) and has no URL parameter, so url is fetched and sent on as the
multipart file part.
Formats. Per the uploadTable API: csv, xls, xlsx (single sheet), sas7bdat,
sashdat; tsv is csv with a tab delimiter. parquet is not accepted and is
rejected up front with guidance (load via a path-based caslib +
promote_table_to_memory, or convert to csv/sas7bdat). The format is auto-detected
from the file_path/url extension; pass data_format to override (needed
for URLs with no clean suffix).
Inputs: server_id (required), table_name (required), caslib_name (required), url, +4 more. Returns: object
upload_fileUpload FileA
Upload a file to the Viya Files Service, optionally into a Content folder.
Provide the file content through exactly one of:
content— inline text (the original behaviour; text files only).file_path— a path the server reads directly from its own disk (in stdio mode that's your machine). Handles binary files (xlsx, zip, images) untouched. Disable withALLOW_LOCAL_FILE_UPLOAD=false.url— an HTTP(S) URL the server fetches the file from. Also binary-safe.
file_path and url sources larger than MAX_UPLOAD_BYTES (default
100 MiB — SAS Viya's own default file-upload limit) are refused.
parent_folder_uri files the upload into a Content folder (e.g.
/folders/folders/{folderId}) — the location %include/filesrvc
ingestion and other folder-scoped consumers need. Without it the file
lands unfiled under the caller's user context.
Inputs: file_name (required), url, content, file_path, +2 more. Returns: object
upload_inline_dataUpload Inline DataA
Create a small CAS table from inline delimited text passed as a string.
Use this only for tiny, hand-built tables — a lookup/mapping table the model
constructs on the fly, or a quick test table — because the whole payload travels
through the model's context as a tool argument. For anything larger, or any file
you already have, use upload_data (file_path/url), which reads the bytes
server-side instead.
Text formats only: csv (default) or tsv (tab-separated). For binary
formats (Excel, sas7bdat, sashdat) use upload_data.
Inputs: data (required), server_id (required), table_name (required), caslib_name (required), +2 more. Returns: object
validate_custom_functionValidate Custom FunctionAIdempotent
Compile a DS2 custom function without saving it, and return its errors.
Inputs: code (required), category. Returns: object
validate_decision_expressionValidate Decision ExpressionAIdempotent
Check that a DS2 expression compiles: a rule condition or action, a branch or a condition step.
The expression may use the variables in signature, DS2 functions
and custom functions. Returns valid and the compiler's error and
warning lines. A variable the signature does not declare is a warning
(DS2 creates it), not an error.
Inputs: expression (required), signature. Returns: object
validate_published_modelValidate Published ModelA
Check a published model by scoring a few rows with the published copy.
Model Manager's publish validation: the first rows rows of the
table are scored in the destination itself (MAS, CAS, ...), and the
scored rows come back. Compare them with test_score_model on the
registered model to confirm the copy behaves the same. Name the copy
by published_model_id (see list_published_models), or by
model_id and destination_name.
Inputs: table_name (required), caslib_name (required), rows, model_id, +3 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 137 tools
Many tools have distinct, detailed descriptions, but the 137-tool surface spans many SAS domains and includes overlapping generic versus domain-specific operations (e.g. get_business_ruleset vs get_decisioning_asset, list_business_rulesets vs list_decisioning_assets, score_data vs score_table vs test_score_model vs validate_published_model). An agent faces real boundary ambiguity and misselection risk despite the documentation.
Names are overwhelmingly snake_case with recognizable verb_noun structure and consistent domain prefixes such as catalog_, list_, get_, create_, update_, delete_, lock_, and publish_. Minor deviations like list_castables, find_folder, and score_data, plus mixed generic/domain-specific prefixes, keep it from being perfectly uniform.
At 137 tools, the server is far beyond a well-scoped 3-15 tool surface and imposes a large selection burden on an agent. Even if many tools earn their place across separate SAS platform areas, the count is an extreme mismatch for a single coherent MCP server.
The surface covers a broad range of SAS Viya operations across CAS, compute, files, reports, catalog, glossary, business rules, decisioning, models, ML, and jobs, with lifecycle operations in many areas. There are minor gaps such as file/model deletion and some CAS administration operations, but these appear workable via alternate tools or execute_sas_code.
Maintenance
Related MCP Connectors
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Query, browse, and automate OmegaAI workspaces from any MCP client. Streamable HTTP with OAuth 2.0.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables secure cloud-based execution of code across 14+ programming languages within a sandboxed environment. It supports file management, standard input/output handling, and automatic generation of visual artifacts like plots and charts.MIT
- AlicenseNot gradedqualityBmaintenanceEnables secure remote command execution and bidirectional file transfers on SSH servers through the Model Context Protocol. It features robust security controls including command whitelisting, credential isolation, and support for multiple SSH connection profiles.1,657 npm1,061ISC
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI to execute RPA applications and workflows through the Model Context Protocol, supporting both local and cloud modes.1MIT
- AlicenseNot gradedqualityDmaintenanceExecutes Python code with safety constraints and manages Python packages through the Model Context Protocol.3MIT