Execute SAS code and query Compute, CAS, and model APIs on SAS Viya via OAuth 2.0.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
A Model Context Protocol (MCP) server for executing SAS code, training AutoML projects, scoring models and so much more for SAS Viya environments.
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:
Required
Optional
NOTE: 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.
Edit .env and set
Option A: HTTP mode (pre-run the server, connect from MCP client)
The 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:
Both 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:
Or build locally from source:
Available 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 of main (unreleased, for testing)sha-<short> β pinned to a specific commitProgrammatic 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:
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.
| 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 sas-viya CLI or sas-mcp-login | 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 sas-viya CLI) | 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 Secret; users authenticate themselves |
| MCP client config | Point client to http://localhost:8134/mcp | Client runs uv run app-stdio | Point client to http://host:8134/mcp | Point client to https://<viya-host>/mcp |
Quick guidance:
sas-viya auth loginCode or uv run sas-mcp-login, then your MCP client manages the server lifecycle.app-stdio), not as an HTTP server, so it authenticates from your ~/.sas token cache β which has to be mounted into the container at /app/.sas.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 (SAS Intelligent Decisioning) |
| 8 | Workbench (Execute Code Only) |
| 9 | Business Glossary (SAS Data Governance) |
Set MCP_READ_ONLY=true to expose only tools that neither change server-side state nor cause server-side work β 50 of the 91 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:
The definition is strict: a tool qualifies only if it can neither write nor start work. Beyond the obvious create/update/delete tools, that withholds:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/sas-viya)<a href="https://allmcps.com/mcp/sas-viya"><img src="https://allmcps.com/api/badge/sas-viya?style=directory" alt="SAS Viya on AllMCPs" /></a>