mcp-server-samples
Verified Safeby 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
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-imageEnvironment 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
kStock-mcp-server
This server provides an MCP (Micro-Capability Protocol) interface to interact with the Korean Investment API, enabling functionalities like fetching stock prices, account information, financial data, and executing stock buy/sell orders.
mcp-java-demo
A demo implementation of an MCP (Model Context Protocol) server for handling WebSocket communication, message dispatching, and executing registered tools.
ormcp-docs
Provides documentation, examples, and potentially client-side tools for a Minecraft Coder Pack (MCP) or Minecraft protocol-related development framework.
Basic_Mcp_Server
A Model Context Protocol (MCP) server providing basic utilities like arithmetic, conversational prompts, and Google Calendar integration for AI agent consumption.