MCP servers based on the Model Context Protocol (MCP) from Anthropic is one of the popular additions to the agentic-ai world.
The brilliance of MCP is its simplicity. Since its introduction in November 2024 its adoption has been nothing short of amazing. You can find many of them listed here.
SAS developers create models using products like Model Studio and by writing custom SAS code that takes macro variables as input. Typically this is followed by developing some UI for the end users to access these models. The MCP server approach provides a nice alternative to deliver these models to the user.
Terminology:
In the rest of this article, "model" refers to all of these:
This article describes the viya-scoring-mcp-server to score models described above. The source code is this repository It is provided under the Apache-2.0 license.
This diagram shows the flow from a user prompt to the final response.
The MCP server has the following tools for scoring.
Follow these basic steps
Issue this command from any shell on your desktop
npx @sassoftware/mcp-serverjs@latest
Make sure that you have a node version >=22
Similar methodologies can be used with other MCP enabled copilots.
Go to the vscode settings and search for MCP. Then select Model Server Context Protocol. Edit its config json
Add the following to the list of MCP servers
{
"viya-scoring-mcp-server": {
"type": "http",
"url": "http://localhost:8080/mcp"
}
}
The name can be anything you like.
This MCP server cli works similar to SAS supplied sas-viya cli commands. Use the following command to create the necessary token and refresh token. You need to do this once every 90 days or whenever the refresh token expires.
sas-viya profile init
sas-viya auth loginCode
Use the copilot prompt area to issue prompts. Here are some sample prompts
list models
sho
This demo server is "stateless" - it does not cache any values, including any Viya sessions the tools might have created.
In a production system the designer has to make decisions on what needs to be cached and the implications of such caching.
The implication of this design choice is felt most when the tool needs to create a compute session - the requests will take longer than when the compute session is cached.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.