Cpi Mcp Server — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Cpi Mcp Server (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A Python-based MCP server and optional AI agent for connecting to SAP Cloud Integration / SAP CPI.
This project exposes SAP CPI APIs as MCP tools so an MCP-compatible client or AI agent can inspect CPI metadata, runtime artifacts, integration packages, message processing logs, and failed messages.
The server connects to SAP CPI using OAuth client credentials and exposes CPI operations through the Model Context Protocol, or MCP.
An AI client can connect to this MCP server and use the available tools to answer questions such as:
User / AI Client / MCP Inspector
|
| MCP over Streamable HTTP
v
Python MCP Server
|
| HTTPS + OAuth client credentials
v
SAP Cloud Integration / SAP CPI APIsOptional AI agent flow:
User Question
|
v
agent.py
|
| LLM tool-calling
v
MCP Server
|
v
SAP CPI APIsFastMCPAccept: application/jsoncpi-mcp-server/
├── server.py
├── agent.py
├── requirements.txt
├── .env.example
├── .gitignore
└── README.mdInstall these before running the project:
Clone the repository:
git clone https://github.com/jacksnh/CPI-MCP-SERVER.git
cd CPI-MCP-SERVERCreate a Python virtual environment:
python -m venv .venvActivate the virtual environment on Windows PowerShell:
.\.venv\Scripts\Activate.ps1If PowerShell blocks activation, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen activate again:
.\.venv\Scripts\Activate.ps1Install dependencies:
python -m pip install -r requirements.txtIf requirements.txt is not available yet, install manually:
python -m pip install "mcp[cli]" httpx python-dotenvCreate a .env file in the project root.
You can copy .env.example:
copy .env.example .envThen edit .env:
notepad .\.envExample .env:
CPI_BASE_URL=https://your-cpi-host
CPI_TOKEN_URL=https://your-token-host/oauth/token
CPI_CLIENT_ID=your-client-id
CPI_CLIENT_SECRET=your-client-secret
OPENROUTER_API_KEY=your-openrouter-api-key
OPENROUTER_MODEL=openai/gpt-4o-mini
MCP_SERVER_URL=http://127.0.0.1:8000/mcpImportant: do not commit .env to GitHub.
Start the server:
python server.pyExpected output:
Starting SAP CPI MCP Server on http://127.0.0.1:8000/mcp
Uvicorn running on http://127.0.0.1:8000Keep this terminal open while using MCP Inspector or the AI agent.
The MCP server URL is:
http://127.0.0.1:8000/mcpInstall Node.js LTS if npx is not available.
Start MCP Inspector in a second terminal:
npx -y @modelcontextprotocol/inspectorOpen the URL printed by Inspector in the terminal. It usually looks like:
http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=...Use these settings in MCP Inspector:
Transport Type: Streamable HTTP
URL: http://127.0.0.1:8000/mcp
Connection Type: Via ProxyClick Connect.
Start by running the health_check tool.
The server can expose tools such as:
| Tool | Purpose |
|---|---|
health_check | Checks whether the MCP server is running. |
get_cpi_metadata | Retrieves CPI OData service metadata. |
list_message_processing_logs | Lists recent CPI message processing logs. |
search_failed_messages | Searches recent failed CPI messages. |
get_message_processing_log | Gets one message processing log by message GUID. |
list_integration_runtime_artifacts | Lists deployed CPI runtime artifacts. |
get_integration_runtime_artifact | Gets one runtime artifact by ID. |
list_integration_packages | Lists CPI integration packages. |
Example tool input for logs:
{
"top": 5
}Make sure the MCP server is already running in one terminal:
python server.pyOpen a second terminal and run:
python agent.pyExample prompts:
Run a health check.
Show me the latest 5 CPI message processing logs and summarize them.
Find the latest 5 failed CPI messages and explain likely root causes.
List deployed CPI runtime artifacts.The agent connects to the MCP server, discovers available tools, calls the relevant tool, and summarizes the result.
Activate virtual environment:
.\.venv\Scripts\Activate.ps1Run MCP server:
python server.pyRun AI agent:
python agent.pyRun MCP Inspector:
npx -y @modelcontextprotocol/inspectorCheck if port 8000 is listening:
netstat -ano | findstr :8000Check installed Python packages:
python -m pip listECONNREFUSED 127.0.0.1:8000The MCP server is not running.
Start it in a separate terminal:
python server.pyWait for:
Uvicorn running on http://127.0.0.1:8000npx is not recognizedNode.js is not installed or is not on the Windows PATH.
Install Node.js LTS, then reopen VS Code or PowerShell and verify:
node -v
npm -v
npx -vNot Acceptable: Client must accept text/event-streamThis is normal if you test /mcp with Invoke-WebRequest or a browser directly.
The /mcp endpoint expects an MCP client, such as MCP Inspector.
KeyError: CPI_BASE_URLThe .env file is missing, not saved, or not being loaded.
Check that .env is in the same folder as server.py and contains:
CPI_BASE_URL=https://your-cpi-host501 Not ImplementedThe CPI tenant may not support the endpoint being called, or the endpoint may differ for your tenant type.
Run:
get_cpi_metadataThen check which OData entity sets are available.
401 UnauthorizedPossible causes:
CPI_CLIENT_IDCPI_CLIENT_SECRETCPI_TOKEN_URL403 ForbiddenThe OAuth client exists but does not have the required CPI API roles.
Check SAP BTP role collections and service key permissions.
404 Not FoundPossible causes:
CPI_BASE_URLNever commit secrets to GitHub.
Do not commit:
.env
.venv/Recommended .gitignore:
.env
.venv/
__pycache__/
*.pyc
node_modules/
.vscode/
.DS_StoreIf credentials were ever shown in screenshots, logs, chat messages, or committed to GitHub, rotate them immediately.
For production use:
.envInitialize Git:
git initAdd remote:
git remote add origin https://github.com/jacksnh/CPI-MCP-SERVER.gitIf remote already exists:
git remote set-url origin https://github.com/jacksnh/CPI-MCP-SERVER.gitAdd files:
git add .Commit:
git commit -m "Add SAP CPI MCP server and AI agent"Push:
git branch -M main
git push -u origin mainNo license has been added yet. Add a license before sharing or reusing this project publicly.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.