Back to Home
Azure-Samples icon

mcp-container-ts

Verified Safe

by Azure-Samples

Overview

An MCP server providing secure, role-based access to external tools (like a TODO list) for Large Language Models via Streamable HTTP, with built-in observability.

Installation

Run Command
npm run dev

Environment Variables

  • NODE_ENV
  • DEBUG
  • APPLICATIONINSIGHTS_CONNECTION_STRING
  • JWT_SECRET
  • JWT_AUDIENCE
  • JWT_ISSUER
  • JWT_EXPIRY
  • JWT_TOKEN
  • PORT
  • ALLOWED_ORIGINS
  • API_KEYS

Security Notes

The server implements robust JWT-based authentication and role-based access control (RBAC) to secure API endpoints and tools. It uses `helmet` for common security headers and `express-rate-limit` to mitigate brute-force attacks. OpenTelemetry is integrated for detailed logging and tracing, which aids in security monitoring. The primary concern is that the `validationMiddleware` for JSON-RPC request body validation is commented out by default in `src/server-middlewares.ts`, potentially allowing malformed requests to bypass initial structural validation. While individual tool handlers use Zod for argument validation, a top-level JSON-RPC validation layer would enhance overall robustness. The `generate-token.ts` script explicitly warns about its demo nature and advises against using generated `.env` tokens directly in production.

Similar Servers

Stats

Interest Score45
Security Score8
Cost ClassLow
Stars40
Forks34
Last Update2025-12-04

Tags

modelcontextprotocolmcp-servertypescriptrbacopentelemetry