Back to Home
pradhyu icon

mcp-server-samples

Verified Safe

by pradhyu

Overview

Provides sample implementations for a Minimal Chat Protocol (MCP) server, either via FastAPI for HTTP or stdio for subprocess communication, using LangChain with OpenAI-compatible APIs.

Installation

Run Command
echo '{"messages":[{"role":"user","content":"Say hi from dockerized stdio."}]}' | docker run -i --rm -e OPENAI_API_KEY="$OPENAI_API_KEY" -e OPENAI_API_BASE="$OPENAI_API_BASE" mcp-stdio-image

Environment Variables

  • OPENAI_API_KEY
  • OPENAI_API_BASE

Security Notes

The code itself avoids dangerous patterns like `eval` or hardcoded secrets. It relies on environment variables for API keys, which the READMEs correctly advise against for production in favor of secrets management. The FastAPI version exposes a standard HTTP port. The stdio version communicates via stdin/stdout, which is generally safer for isolated process communication. Production hardening (like multi-stage builds, healthchecks, robust framing) is recommended but not handled by the sample code.

Similar Servers

Stats

Interest Score0
Security Score8
Cost ClassMedium
Avg Tokens50
Stars0
Forks0
Last Update2025-11-25

Tags

MCPLangChainFastAPIDockerOpenAI-compatible