Skip to main content
Glama
Sharan-cypto

learning-mcp-server

by Sharan-cypto
README.md
# learning-mcp-server

A minimal MCP server (three toy tools: `add`, `echo`, `current_time`) meant purely
for learning how MCP servers deploy and run on SAP BTP's Cloud Foundry trial
environment. No auth, no SAP backend calls — just get something running end to end.

## Step 1 — Get a trial account

1. Go to https://www.sap.com/products/technology-platform/trial.html and sign up
   (SAP account required; free, no time-limited data beyond the 90-day trial window).
2. After signup you land in the **SAP BTP cockpit** with a subaccount and a
   Cloud Foundry space already created for you.

Keep in mind while you're learning: the trial account is for personal, non-production
exploration only, resets after 90 days (or 30 days of inactivity), and has no SLA.
That's all fine for this purpose.

## Step 2 — Enable Cloud Foundry environment

1. In the cockpit, open your **subaccount** → **Cloud Foundry Environment**.
2. If it's not already enabled, click **Enable Cloud Foundry**, choose the
   **free/trial plan**, keep defaults, and create it.
3. Note the **API Endpoint** shown here (something like
   `https://api.cf.us10-001.hana.ondemand.com`) — you'll need it to log in.
4. A default space (usually called `dev`) is created automatically.

## Step 3 — Install the Cloud Foundry CLI

Install `cf` from https://github.com/cloudfoundry/cli#installers-and-compressed-binaries
(or via your package manager, e.g. `brew install cloudfoundry/tap/cf-cli` on macOS).

Verify:
```bash
cf --version
```

## Step 4 — Log in

Trial accounts authenticate via SSO passcode rather than username/password:
```bash
cf login -a <API-ENDPOINT-FROM-STEP-2> --sso
```
This prints a URL — open it in your browser, copy the one-time passcode shown there,
and paste it back into the terminal prompt. Then select your org and the `dev` space
when prompted (or run `cf target -o <your-org> -s dev` afterward).

## Step 5 — Deploy the server

From this project folder:
```bash
cf push
```

`cf push` reads `manifest.yml`, uploads the code, builds it with the Python buildpack,
and starts it. When it finishes, it prints a route — something like:
```
routes: learning-mcp-server-<random>.cfapps.us10-001.hana.ondemand.com
```
That's your server's public HTTPS URL. Your MCP endpoint is at `<that-url>/mcp`.

**Important for learning purposes only:** this deployment has no authentication —
anyone with the URL could call it. That's acceptable for a throwaway trial-account
experiment, but never deploy an unauthenticated server like this with real data or
real SAP system access behind it.

## Step 6 — Test it

The easiest way to poke at it directly is the official MCP Inspector:
```bash
npx @modelcontextprotocol/inspector
```
This opens a local web UI. Choose **Streamable HTTP** as the transport, paste in
`https://<your-route>/mcp`, connect, and you should see the three tools
(`add`, `echo`, `current_time`) listed — click one to try it.

## Step 7 — Connect it to Claude Desktop (optional)

Claude Desktop's config expects a local command, but remote Streamable HTTP servers
can be bridged in via `mcp-remote`:
```json
{
  "mcpServers": {
    "learning-server": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://<your-route>/mcp"]
    }
  }
}
```
Restart Claude Desktop and ask it to add two numbers or echo some text.

## Useful commands while learning

```bash
cf logs learning-mcp-server --recent   # see recent logs (crash cause etc.)
cf logs learning-mcp-server            # tail live logs
cf apps                                 # list deployed apps and their routes/state
cf restart learning-mcp-server          # restart after config changes
cf delete learning-mcp-server           # tear it down, free up memory quota
```

## Where to go from here

Once this deploys and responds correctly:
1. Add a tool that calls a real SAP API (e.g. a public S/4HANA sandbox OData
   service, no auth needed to start).
2. Then introduce a **BTP Destination** instead of a hardcoded URL.
3. Then add authentication (SAP Cloud Identity Services / XSUAA) in front of the
   server, following the security pattern from the earlier architecture discussion.

Each of those is a small, isolated next step — happy to scaffold any of them when
you're ready.