production-deployment

production-deployment is an agent for Claude Code from Matt-Dionis/claude-code-configs. It costs 62 tokens per session (7,276 once invoked), scanned A, original, MIT.

A guide for deploying MCP servers over HTTPS in a production environment. It focuses on a stack including PostgreSQL, Neon, Drizzle ORM, pgvector, validation, authentication, monitoring, and scaling.

In plain words
What is it for?
Planning containers, gateways, load balancing, databases, caching, authentication, rate limiting, monitoring, logs, and multiple MCP-server instances.
Why use it?
It addresses the operational work involved in making an MCP server available reliably and securely beyond a local computer.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

Not installable on its own: it runs a file from its repository that does not travel with it. Clone the repository, or install whatever ships that file. The line is CMD node dist/healthcheck.js || exit 1.

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for production-deployment

README.md
[![agentmods](https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/production-deployment.svg)](https://agentmods.dev/agents/matt-dionis/claude-code-configs/production-deployment)
Your own site
<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/production-deployment"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/production-deployment.svg" alt="Measured on agentmods" height="20"></a>
Per session 62 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 7,276 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00062 $0.07276
Opus 5 $0.00031 $0.03638
Sonnet 5 $0.00012 $0.01455
Haiku 4.5 $0.00006 $0.00728

Measured 6d ago against content hash 409ae8a4c975, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

production-deployment scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -f https://mcp.companions.example.com/health || exit 1
configurations/mcp-servers/memory-mcp-server/.claude/agents/production-deployment.md · 1,157 lines

How it starts

The opening of the file, as written. The whole thing — 1,157 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert in deploying production MCP servers with the following stack:

  • PostgreSQL 17 on Neon with @neondatabase/serverless v1.0.1
  • Drizzle ORM v0.44.4 with drizzle-kit v0.31.4
  • pgvector v0.8.0 for semantic search
  • Zod v4.0.17 for validation
  • HTTPS transport with StreamableHTTP

Production Architecture

System Architecture Overview

graph TB
    subgraph "Client Layer"
        C1[AI Companion Client 1]
        C2[AI Companion Client 2]
        CN[AI Companion Client N]
    end
    
    subgraph "API Gateway"
        AG[Nginx/Traefik]
        RL[Rate Limiter]
        AUTH[Auth Service]
    end
    
    subgraph "Application Layer"
        LB[Load Balancer]
        MCP1[MCP Server 1]
        MCP2[MCP Server 2]
        MCPN[MCP Server N]
    end
    
    subgraph "Data Layer"
        REDIS[(Redis Cache)]
        NEON[(Neon PostgreSQL)]
        S3[(S3 Storage)]
    end
    
    subgraph "Observability"
        PROM[Prometheus]
        GRAF[Grafana]
        LOGS[Loki/ELK]
    end
    
    C1 & C2 & CN --> AG
    AG --> LB
    LB --> MCP1 & MCP2 & MCPN
    MCP1 & MCP2 & MCPN --> REDIS
    MCP1 & MCP2 & MCPN --> NEON
    MCP1 & MCP2 & MCPN --> S3
    MCP1 & MCP2 & MCPN --> PROM
    MCP1 & MCP2 & MCPN --> LOGS

HTTPS Server Implementation

Production Express Server

// src/server.ts
import express from "express";
import https from "https";
import fs from "fs";
import helmet from "helmet";
import cors from "cors";
import compression from "compression";
import rateLimit from "express-rate-limit";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { CompanionSessionManager } from "./services/companionSessionManager";
import { AuthMiddleware } from "./middleware/auth";
import { MetricsMiddleware } from "./middleware/metrics";
import { LoggingMiddleware } from "./middleware/logging";

const app = express();

// Security middleware
app.use(helmet({
  contentSecurityPolicy: {
    directives: {
      defaultSrc: ["'self'"],
      scriptSrc: ["'self'", "'unsafe-inline'"],
      styleSrc: ["'self'", "'unsafe-inline'"],
      imgSrc: ["'self'", "data:", "https:"],
    },
  },
  hsts: {
    maxAge: 31536000,
    includeSubDomains: true,
    preload: true,
  },
}));

// CORS configuration for companion clients
app.use(cors({
  origin: process.env.ALLOWED_ORIGINS?.split(",") || ["https://companions.example.com"],
  credentials: true,
  methods: ["GET", "POST", "DELETE", "OPTIONS"],
  allowedHeaders: ["Content-Type", "Authorization", "mcp-session-id"],
  exposedHeaders: ["Mcp-Session-Id"],
}));

// Compression
app.use(compression());

// Body parsing
app.use(express.json({ limit: "10mb" }));
app.use(express.urlencoded({ extended: true, limit: "10mb" }));

// Rate limiting
const limiter = rateLimit({
  windowMs: 60 * 1000, // 1 minute
  max: 100, // Limit each IP to 100 requests per minute
  standardHeaders: true,
  legacyHeaders: false,
  handler: (req, res) => {
    res.status(429).json({
      error: "Too many requests",
      retryAfter: req.rateLimit.resetTime,
    });
  },
});
app.use("/mcp", limiter);

// Custom middleware
app.use(LoggingMiddleware);
app.use(MetricsMiddleware);
app.use("/mcp", AuthMiddleware);

// Health checks
app.get("/health", (req, res) => {
  res.json({ status: "healthy", timestamp: new Date().toISOString() });
});

app.get("/ready", async (req, res) => {
  try {
    // Check database connection
    await checkDatabaseHealth();
    // Check Redis connection
    await checkRedisHealth();
    
    res.json({ status: "ready" });
  } catch (error) {
    res.status(503).json({ status: "not ready", error: error.message });
  }
});

// MCP endpoints
const sessionManager = new CompanionSessionManager();

app.post("/mcp", async (req, res) => {
  try {
    const sessionId = req.headers["mcp-session-id"] as string;
    
    if (sessionId) {
      const session = await sessionManager.getSession(sessionId);
      if (session) {
        await session.transport.handleRequest(req, res, req.body);
        return;
      }
    }
    
    // New session initialization
    if (isInitializeRequest(req.body)) {
      const companionId = req.headers["x-companion-id"] as string;
      const userId = req.user?.id; // From auth middleware
      
      if (!companionId) {
        return res.status(400).json({
          jsonrpc: "2.0",
          error: { code: -32000, message: "Companion ID required" },
          id: null,
        });
      }
      
      const newSessionId = await sessionManager.createSession({
        companionId,
        userId,
        metadata: {
          ip: req.ip,
          userAgent: req.headers["user-agent"],
        },
      });
      
      const session = await sessionManager.getSession(newSessionId);
      await session!.transport.handleRequest(req, res, req.body);
    } else {
      res.status(400).json({
        jsonrpc: "2.0",
        error: { code: -32000, message: "Invalid request" },
        id: null,
      });
    }
  } catch (error) {
    console.error("MCP request error:", error);
    res.status(500).json({
      jsonrpc: "2.0",
      error: { code: -32603, message: "Internal server error" },
      id: null,
    });
  }
});

// SSE endpoint for notifications
app.get("/mcp", async (req, res) => {
  const sessionId = req.headers["mcp-session-id"] as string;
  
  if (!sessionId) {
    return res.status(400).send("Session ID required");
  }
  
  const session = await sessionManager.getSession(sessionId);
  if (!session) {
    return res.status(404).send("Session not found");
  }
  
  // Set SSE headers
  res.setHeader("Content-Type", "text/event-stream");
  res.setHeader("Cache-Control", "no-cache");
  res.setHeader("Connection", "keep-alive");
  res.setHeader("X-Accel-Buffering", "no");
  
  await session.transport.handleRequest(req, res);
});

// Start HTTPS server
const httpsOptions = {
  key: fs.readFileSync(process.env.SSL_KEY_PATH || "/certs/key.pem"),
  cert: fs.readFileSync(process.env.SSL_CERT_PATH || "/certs/cert.pem"),
};

const server = https.createServer(httpsOptions, app);

const PORT = process.env.PORT || 443;
server.listen(PORT, () => {
  console.log(`MCP server running on https://localhost:${PORT}`);
});

// Graceful shutdown
process.on("SIGTERM", async () => {
  console.log("SIGTERM received, shutting down gracefully");
  
  server.close(() => {
    console.log("HTTP server closed");
  });
  
  await sessionManager.shutdown();
  process.exit(0);
});

Read the full file on GitHub · 1,157 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 1,157 lines · 62 tokens per session scan A 409ae8a4c975

Subscribe to this mod's changes

production-deployment is an agent published in the GitHub repository Matt-Dionis/claude-code-configs (625 stars, last pushed 1y ago), licensed MIT. It adds 62 tokens to every session and 7,276 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories