sas-score-mcp-serverjs
This MCP server enables natural language scoring with SAS Viya, allowing users to execute prebuilt SAS code, models, and job definitions seamlessly.
README
sas-score-mcp-serverjs
A Model Context Protocol (MCP) Server for Scoring with SAS Viya. See wiki for the capabilities of the server.
Major changes in release 1.0.0
-
Authentication: Oauth flow is now supported.
- Note that for Claude the mcp server must be remote. (ex: as a Azure Client App, Azure Container App etc...).
-
Agent - can be deployed as an agent
-
Docker image: ghcr.io/sassoftware/sas-score-mcp-serverjs
Overview
This MCP server is designed for scoring with SAS Viya.
Note: scoring refers to executing any code that takes some input and returns results.
Some examples are:
- models created with SAS solutions like Model Studio, Intelligent Decisioning etc...
- user written SAS program
- SAS Studio Flow
- job Definitions
- jobs using SAS Studio or other interfaces
Start the mcp server
If using stdio transport, most of the mcp clients will start the server automatically. But for http transport, the mcp server must be started.
If running locally
npx @sassoftware/sas-score-mcp-serverjs@latest
The mcp is also available as a docker image. Add or remove the env variables as needed.
docker run -p 8080:8080 --name sasscore -e VIYA_SERVER=<yourviyaserver> -e AUTHFLOW=oauth ghcr.io/sassoftware/sas-score-mcp-serverjs:latest
Capabilities
The tools can be grouped into these categories
- Scoring with MAS models, job, jobdef and scr
- Viewing and querying tables
Supporting tools can be grouped into these categories
- Listing of MAS models, job, jobdef , tables
- Describing MAS models, job, jobdef, scr and tables
Target Audience
This MCP server was developed for two types of SAS users.
SAS users
SAS users who want to use natural language("chat") to execute prebuilt SAS code and models. See this quick reference for details.
MCP tool developers
SAS developers who want to extend the capabilities of the server with their own tools. See the guide for details.
Transport Protocol supported
- http
- stdio
Configuration Variables
Typically these are set either in the .env file or as environment variables or as command line options(if using npx). You will need only a subset of these for the different [transport,authentication] schemes
Required Options
- VIYA_SERVER= <url for Viya server>.
Options with defaults
These can be customized
-
AUTHFLOW=oauth|oauthclient|bearer|sascli|token|password
- Authentication method. Default is oauth
-
CLIENTID=vscodemcp
- Clientid for oauth and oauthclient AUTHFlOW. Must be PKCE clientid.
-
MCPTYPE=http|stdio
- The transport protocol for the mcp server.
-
MCPHOST=http://localhost:8080
- URL of the mcp server. If using remote mcp server, set this to remote MCP server
-
PROFILE=~/.sas
- profile name used by sas-cli to store the tokens
-
PORT=8080
- set it to what fits your environment.
-
CASSERVER=cas-shared-default
- Set to a valid cas server
-
COMPUTECONTEXT="SAS Job Execution compute context"
- Use one that is appropriate
Clientid specifications
If using remote mcp server, change the url in redirect to the remote url
{
client_id: 'vscodemcp',
scope: [ 'openid' ],
resource_ids: [ 'none' ],
autoapprove: true,
authorized_grant_types: [ 'authorization_code' ],
access_token_validity: 86400,
allowpublic: true,
redirect_uri: [ 'http://localhost:8080/callback' ]
}
OauthClient Flow. Clientid with redirect appropriate for the client. Some examples are shown below. Note that the explicit port used by github copilot is not guaranteed.
- github copilot: http://127.0.0.1:33418/
- claude: https://claude.ai/api/mcp/auth_callback,https://claude.ai/api/auth/callback
Agent and skills
The mcp server can be deployed as an agent in github copilot The configuration files for claude can be installed locally. You have to move the files to the appriopiate place.
To download the skills to your environment issue this command:
npx @sassoftware/sas-score-mcp-serverjs --skills github|claude
The skills and related files will be written to .github or .claude
Configure the mcp client for localhost
The mcp configuration for oauth flow. For remote mcp, change the url to the remote url
"sasmcp": {
"type": "http",
"url": "http://localhost:8080/mcp"
"oauth: {
"type": "oauth2",
"clientId: "vscodemcp"
}
}
For bearer authflow.
"sasmcp": {
"type": "http",
"url": "http://localhost:8080/mcp`,
"headers" {
"Authorization": "bearer <tokenstring>"
}
}
For stdio scenario
"sas-mcp-server": {
"type: "stdio"
"command": "npx",
"args": [
"-y",
"@sassoftware/sas-score-mcp-serverjs@1.0.0"
-v "<your viya url>"
-m "stdio"
--profile "dtl"
-a "sascli"
]
}
Notes
The mcp server caches information for each mcp session id(user).
However, cas and compute sessions are not cached in this release(TBD). The implication of this design choice is felt most when the tool needs is creating compute session * the requests will take longer than when the compute session is cached.
Other Useful Tips
mkcert
Install
- Visit this site
- Download the proper version
- rename the file as mkcert (with proper exetension for your os)
- move it to a directory that is in the PATH value
To create a self-signed certificate for localhost:
mkcert -install
The install also stores local root Certificate Authority (CA) on the system.
For windows the location is AppData/Local\mkcert.
Now go to the location where you want to store the certificates. Then create the certificates:
mkcert localhost 127:0.0.1 ::1
One last step for windows nodejs users.
Add this to the environment variable NODE_EXTRA_CA_CERTS:
NODE_EXTRA_CA_CERTS=c:\Users\<your_username>\AppData\Local\mkcert\rootCA.pem
License
This project is licensed under the Apache License 2.0. See LICENSE.
The container image published from this repository also includes third-party software, each component under its own license:
- The npm dependencies that ship with this project, along with their respective licenses, are listed in LICENSES.json.
- The container is built from the 25-alpine base image; license texts for its included software ship inside the image itself. License information for each Alpine package is available at pkgs.alpinelinux.org.
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.
Additional Resources
- Documentation on modelcontextprotocol(mcp)
- mcp sdk
- restaf
- mkcert
- SAS tokens
- Also see https://communities.sas.com for articles on using mcp servers with SAS Viya
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。