mcp-server-template
Secure MCP server template in TypeScript and Python, safe by default.
What it is
Secure MCP server template in TypeScript and Python: a starting point for a Model Context Protocol server that is safe by default. Both reference implementations ship the same four read-only tools and the same controls: strict input validation, file access bounded to allowlisted directories, network access bounded to allowlisted hosts with SSRF protection, structured logs that redact secrets, a health tool, stdio transport by default, and an optional streamable HTTP transport that is bound to 127.0.0.1, requires a bearer token, rate-limits clients and caps request bodies. Tests, Dockerfiles with digest-pinned bases and non-root users, CI with Semgrep, gitleaks and CodeQL, and SBOMs on release are included.
Install
cd typescript
npm ci && npm run build && npm test
MCP_ALLOWED_DIRS=$PWD/../docs node dist/index.js # stdio server exposing one directory
From the README; see the full README for every option.
Links
Releases
More in MCP tooling
- dev-mcp-servers: Ten small MCP servers for everyday development and security checks.
- mcp-tools-lint: Lint MCP tool schemas and annotations before clients reject them.
- mcp-auth-doctor: Diagnose OAuth discovery problems on remote MCP servers.
- mcp-egress: Record every host an MCP server contacts, per tool, and fail CI on new ones.
- claude-mcp-allow: Least-privilege Claude Code permission rules for MCP tools, generated from their annotations.
- agentdojo-mcp: Run the AgentDojo benchmark's user and injection tasks against a real MCP server's tools.
- garak-mcp-probes: Run garak against your own MCP servers, with detectors for denied tool calls, leaked canaries and runaway step counts.
- mcp-rc-check: MCP specification migration checker for the 2026-07-28 revision: flags removed, changed and deprecated constructs and writes a patch for mechanical fixes.
Topics: agent-security, ai-agents, ai-security, audit-log, devsecops, docker, fastmcp, github-actions, hacktoberfest, llm-security, mcp, mcp-server, model-context-protocol, python, sbom, security-automation, ssrf, template, template-repository, typescript