Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

How to Secure Your MCP Server's API Keys (With Working Demo)

The Problem Every MCP Developer Ignores You build an MCP server. It needs a GitHub token. Maybe an OpenAI key. Where do they go? { "mcpServers": { "my-server": { "command": "node", "args": ["server.js"], "env":…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




The Problem Every MCP Developer Ignores



You build an MCP server. It needs a GitHub token. Maybe an OpenAI key. Where do they go?




{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["server.js"],
"env": {
"GITHUB_TOKEN": "ghp_XXXXXXXXXXXX",
"OPENAI_API_KEY": "sk-XXXXXXXXXXXX"
}
}
}
}






Plaintext. In a JSON file. On disk. Possibly committed to git.



This is how most MCP servers handle secrets today. And it's a ticking time bomb.






A Better Way: Encrypted Vault + Runtime Decryption



I built a demo MCP server that does it differently. Instead of reading secrets from env vars, it pulls them from Janee — an encrypted vault designed for MCP servers.



The flow:




Claude Desktop → MCP Protocol → Your Server → Janee Vault → API Call
↑
AES-256-GCM encrypted
Decrypted only at runtime






No plaintext secrets on disk. Ever.






Try It Yourself (5 minutes)






git clone https://github.com/lucamorettibuilds/janee-mcp-demo
cd janee-mcp-demo
npm install

# Set up the encrypted vault
npx janee init # Creates encrypted vault
npx janee add github # Stores your GitHub token (encrypted)
npx janee add openai # Stores your OpenAI key (encrypted)

# Run it
export JANEE_MASTER_PASSWORD="your-password"
npm start






The server exposes three MCP tools:





  • github_create_issue — creates GitHub issues using vault credentials


  • openai_complete — calls OpenAI using vault credentials


  • list_secrets — shows what's in the vault (names only, never values)






How the Code Works



The secret sauce is a tiny integration layer (src/secrets.js):




import { execSync } from "child_process";

export async function getSecret(service, field) {
try {
const result = execSync(
`npx janee get ${service} ${field} 2>/dev/null`,
{ encoding: "utf-8", env: { ...process.env } }
).trim();
return result || null;
} catch {
return null;
}
}






Then in your MCP tool handler, instead of process.env.GITHUB_TOKEN:




const token = await getSecret("github", "token");






That's it. The secret is decrypted from the vault at runtime, used for the API call, and never persisted in memory longer than needed.






Claude Desktop Config






{
"mcpServers": {
"janee-demo": {
"command": "node",
"args": ["/path/to/janee-mcp-demo/src/server.js"],
"env": {
"JANEE_MASTER_PASSWORD": "your-master-password"
}
}
}
}






Notice: one password protects all your API keys. No more scatter-shot env vars.






Why Not Just Use .env Files?






































.env files Janee vault
Storage Plaintext AES-256-GCM encrypted
Access control None Session-based with TTL
Rotation Manual find-and-replace
janee add service (overwrites)
Audit None Built-in logging
Git safety Needs .gitignore discipline Vault file is safe to commit





Adding Your Own Services



The demo ships with GitHub and OpenAI, but you can add anything:




npx janee add stripe
npx janee add anthropic
npx janee add postgres






Then use getSecret("stripe", "api_key") in your tool handler.






Get the Code





If you're building MCP servers, give your secrets the respect they deserve. ⭐ Janee if it's useful.

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Vulnerability Remediation & Verification
1 Warnungen
title: Detect Exploitation - How to Secure Your MCP Server's API Keys (With Working Demo)
id: 44849614-8ea3-4532-a378-7723f094439e
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-25
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-25"
        description = "YARA Signature for "
    strings:
        $str = "How to Secure Your MCP Server\'" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("How to Secure Your MCP Servers API Keys ")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*How to Secure Your MCP Servers API Keys *"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "How to Secure Your MCP Servers API Keys "
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How to Secure Your MCP Server's API Keys.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Secure Your MCP Server's API Keys (With Working Demo)

Thematisch verwandte Begriffe: Secure, Your, Servers, Keys · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-63208 | Zammad is a web based open source helpdesk/customer support system. Prio…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag