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

Why We Ditched Python for TypeScript (and Survived OAuth) in Our AI Agent MCP Server

Hey Devs! I’m Jesse, solo-building Portal One: an AI Agent Command Center to help you orchestrate, automate, and securely manage your AI agents. One of the biggest undertakings so far? Building a production-ready Model Context Protocol (…

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

Hey Devs!



I’m Jesse, solo-building Portal One: an AI Agent Command Center to help you orchestrate, automate, and securely manage your AI agents.



One of the biggest undertakings so far? Building a production-ready Model Context Protocol (MCP) server—the backbone that connects user agents to a growing ecosystem of tools and services.



Let’s just say there were some “battle scars” along the way. Here are three of the most valuable (and painful) lessons that shaped our architecture:









1. OAuth 2.0: No Shortcuts in Security



Early on, I was tempted to use simple API keys or JWTs for agent authorization—until I realized the complexity of permissions, multi-tenancy, and external integrations. Security had to be non-negotiable.



Why OAuth 2.0?




  • Industry standard, widely supported

  • Granular scopes for fine-grained permissions

  • Auditable and future-proof



Oh yeah, and it's also part of the MCP Specification.



Key lesson:


Implementing OAuth correctly is hard. Expect lots of trial and error with flows, token introspection, and permission logic.







2. The Big Pivot: Python → TypeScript



I started with Python for the prototype—it’s fast for AI, but when it came to production, I hit walls:




  • Type safety issues slowed refactoring

  • Async/concurrency model didn’t fit my needs

  • Wanted a unified language for backend and integrations



Switching to TypeScript/Node.js instantly paid off:




  • Strong typing = fewer runtime bugs

  • First-class async/await model

  • Huge ecosystem



More importantly though, the official MCP TypeScript SDK had just added support for the two things I needed: authInfo available in the tool context (use the OAuth token to enable authorization), and the Proxy for using the OAuth authorization server (instead of combining the authorization server with the MCP resource server).



Painful truth:


Rewrites are tough, but sometimes necessary for long-term velocity. However, the second time creating something usually results in a better and more thought out implementation.







3. Zod: Data Validation That Won’t Let You Down



With so many tools and unpredictable agent payloads, validating data was a nightmare—until I discovered Zod.





Example:




import { z } from 'zod';

const AgentEvent = z.object({
agentId: z.string().uuid(),
tool: z.string(),
payload: z.record(z.unknown()),
timestamp: z.coerce.date(),
});

type AgentEvent = z.infer<typeof AgentEvent>;

// Usage:
const parsed = AgentEvent.parse(incomingEvent);






Tip:


Use Zod schemas everywhere: API endpoints, tool integrations, LLM outputs. It's baked into the MCP TypeScript SDK already so you will be using it whether you like it or not.





The following code snippet is the function we use to authorize the token to allow access to resources in the users workspaces.




// Access to the `authInfo` property injected into the request
// by the MCP SDK middleware enables multi-tenancy and authorization.
export function withWorkspaceAccess<T extends z.ZodTypeAny>(
db: Firestore,
inputSchema: T,
handler: (
args: z.infer<T>,
req: RequestHandlerExtra<ServerRequest, ServerNotification>,
userId: string,
) => Promise<CallToolResult>,
) {
return async (
args: z.infer<T>,
req: RequestHandlerExtra<ServerRequest, ServerNotification>,
) => {
const userId = req.authInfo?.extra?.user_id as string;
if (!userId) throw new Error('No user ID found in token.');
const hasAccess = await checkWorkspaceAccess(db, userId, args.workspace_id);
if (!hasAccess)
throw new Error('You do not have access to this workspace.');
return handler(args, req, userId);
};
}






This short snippet is great at demonstrating each of the "Battle Scars" outlined above. You can check out the GitHub repo as well to see the full example code.






Want More “Battle Scars”?



This is just a taste!


I wrote up a full deep dive—architecture, more code, and the gnarly bits—on the Portal One blog. Check it out!






What’s the hardest lesson you’ve learned building agent backends, APIs, or scalable integrations?


Drop your “battle scars” in the comments—let’s trade notes and help each other out!

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - Why We Ditched Python for TypeScript (and Survived OAuth) in Our AI Agent MCP Server
id: 4cbce7cf-6234-4ae4-9e22-09cb05182cd5
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 = "Why We Ditched Python for Type" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("Why We Ditched Python for TypeScript and")
| 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: "*Why We Ditched Python for TypeScript and*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "Why We Ditched Python for TypeScript and"
| 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 Why We Ditched Python for TypeScript (an.... 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 Why We Ditched Python for TypeScript (and Survived OAuth) in Our AI Agent MCP Server

Thematisch verwandte Begriffe: Ditched, Python, TypeScript, Survived · 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