BookmarkSubscribeRSS Feed

Connecting Claude Code CLI to SAS Viya with the SAS MCP Server

Started 2 hours ago by
Modified 2 hours ago by
Views 41

The SAS MCP Server (Model Context Protocol) connects AI coding assistants, such as GitHub Copilot, Claude Code CLI, Gemini CLI, your choice, directly to your SAS Viya environment. Ask, run, iterate.

 

By the end of this post, Claude Code CLI will be talking directly to your SAS Viya environment through 26 live SAS MCP tools.

 

 

What you need

 

Paid

 

  • A Claude.ai Pro subscription: Claude Code CLI is included. Pro ($20/mo) works. Check anthropic.com/pricing for current plan details. Disclosure: A Claude.ai Pro or Max subscription is a technical requirement for Claude Code CLI; it's not available on the free tier. SAS has no affiliation with Anthropic; the subscription is simply the price of admission for this particular setup. If you prefer a free or API-key-based alternative, Claude Code CLI also supports Anthropic Console access, or consider GitHub Copilot or Gemini CLI instead.
  • SAS Viya: a running SAS Viya environment with sufficient permissions to configure SAS Logon Manager, register a client, etc. I used SAS Viya stable version 2026.03 for the content of this post.

 

Free

 

  • Node.js: required by Claude Code CLI
  • VS Code + Git Bash (or any Bash-compatible terminal)
  • uv: a fast Python package manager (written in Rust, by Astral). It installs Python itself, so you do not need Python pre-installed separately.

 

 

Steps

 

Video Walkthrough

 

(view in My Videos)

 

The written steps below mirror the video exactly.

 

1. Install Node.js

 

Go to nodejs.org and download the LTS version. Run the installer and keep all defaults. When done, fully restart VS Code.

 

Verify the install by opening a terminal and running:

 

node --version
npm --version

 

 

2. Install Claude Code CLI

 

npm install -g @anthropic-ai/claude-code

 

Do not use sudo. Close and reopen your terminal when done, then confirm with claude --version.

 

 

3. Log in to Claude

 

Type claude to launch. On first run you'll be prompted to log in. Three options are available:

 

  • Claude.ai — for Pro subscribers (that's us). Opens a browser for OAuth authorization.
  • Anthropic Console — for pay-as-you-go API key users.
  • Claude for Work — for Team or Enterprise accounts with centralized billing and SSO.

 

Select Claude.ai, authorize in the browser window that opens, then return to the terminal. You're in.

 

Test it with a quick prompt: how well do you know SAS programming

 

 

4. Set up the SAS Viya MCP Server

 

Follow steps 1–9 from the Connecting GitHub Copilot to SAS Viya with the SAS MCP Server post on SAS Communities. This covers cloning the open-source sas-mcp-server repo, configuring your Viya credentials, and starting the server using uv sync (uv handles the Python environment automatically — no separate Python install needed). The server runs locally at http://localhost:8134/mcp  by default.

 

 

5. Connect Claude Code CLI to the SAS MCP Server

 

With the SAS MCP server running, register it:

 

# Add the server
claude mcp add --transport http sas-execution-mcp http://localhost:8134/mcp

# Verify it was added
claude mcp list
# → sas-execution-mcp: http://localhost:8134/mcp (HTTP) - ! Needs authentication

 

Now authenticate with SAS Viya. Inside Claude Code CLI, select sas-execution-mcp → Authenticate. A browser window opens with an Application Access Request — allow it and sign in with your Viya credentials. Back in the terminal you should see:

 

✔ connected   Authentication successful. Connected to sas-execution-mcp.

 

 

6. Start using SAS tools

 

Navigate to MCP → SAS Execution MCP to see the full list of available tools, each calling SAS Viya REST APIs directly. Or just ask:

 

list the available SAS MCP tools

 

To run SAS code, use natural language:

 

Run a SAS program that fetches three records from sashelp.cars.

 

Claude Code CLI will generate the code and ask for confirmation before executing. Press Yes and the results come back directly in your terminal.

 

 

What You've Built

 

Claude Code CLI can now call live SAS Viya tools directly from your terminal. The setup is a one-time cost. What comes after is the interesting part.

 

A future post and video will show working from Claude Code CLI with the SAS MCP server: code execution, CAS discovery, job management, VA reports, model scoring. That's where it gets good.

 

BT_SAS_MCP_Server_from_Claude_Code_CLI_explain_data.png

Select this image to see a larger version.
Mobile users: To view the image, select the "Full" version at the bottom of the page.

 

 

Acknowledgements

 

Acknowledging David Weik, Reza Soleimani, Eric Qi, Kevin Scott, Bryan Behrenshausen, and Harry Keen for their excellent work.

 

 

Additional Resources

 

 

 

Further Viewing

 

Watch on YouTube: Empower Your AI Agents With Analytics and Decisioning Expertise With SAS MCP Server SAS Users · Apr 14, 2026

 

A broader look at the SAS MCP Server concept: what it means to give AI agents real analytical tools, what SAS exposes through MCP, and use cases where embedding advanced analytics into an agent workflow adds genuine value. Good context before or after the hands-on setup above.

 

 

For further guidance, reach out for assistance.

 

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
2 hours ago
Updated by:

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags