Sandbox
@Elkhn/mcp-playground

Streamlit MCP chat starter with LangChain and Docker

This repo gives you a working chat UI for talking to LLMs and calling MCP tools from the same interface. The client can connect to multiple MCP servers, show available tools in the sidebar, and stream tool calls back into the chat.

46 starsβ€’18 forksβ€’Pythonβ€’Updated 6mo ago
Who it's for

Builders who want to prototype an MCP-enabled chat app with a visual interface.

What it delivers

You can spin up a chat app that routes requests to MCP tools instead of wiring that plumbing yourself.

What it does

Multi-server MCP support

Registers multiple MCP servers and auto-detects their available tools.

Streamlit chat interface

Provides chat history, sidebar controls, and live tool execution output.

Provider-agnostic model support

Works with OpenAI, Bedrock, Anthropic, Google Gemini, and Groq through one LangChain interface.

Dynamic model override

Lets you swap the default model ID from the UI without changing code.

Dynamic server management

Lets you add and remove MCP servers from the sidebar during a session.

LangGraph ReAct agent

Uses `create_react_agent` to decide when to call tools and how to reason across them.

Docker-first setup

Ships separate Dockerfiles for the client and servers plus one `docker-compose.yaml`.

How to get it

  1. 1Run
    git clone https://github.com/your-org/mcp-playground.git
    cd mcp-playground
    docker compose up --build

README

MCP Playground πŸ› οΈπŸŒ©οΈ

A Streamlit-based playground that lets you chat with large language models and seamlessly plug in external Multi-Server Command Protocol (MCP) tools. Spin up multiple FastMCP servers (Weather & Currency) alongside a Streamlit client, all orchestrated with Docker Compose. The client is provider-agnostic (OpenAI β€’ Amazon Bedrock β€’ Anthropic β€’ Google Gemini β€’ Groq) thanks to LangChain + LangGraph. Built with uv for lightning-fast dependency installation.

πŸ“– Learn More

Want a deep dive into how it all works? Check out the detailed walkthrough in this Medium article: https://medium.com/@elkhan.alizada/your-own-ai-agent-playground-build-it-with-streamlit-langgraph-and-docker-4caeb6fe0ac4


πŸ–₯οΈπŸ”Œ Main Interface – Connected View

Interface


πŸ—οΈ Architecture

Architecture


✨ Key Features

FeatureDescription
πŸ”Œ Multi-Server MCPRegister any number of MCP servers; the agent auto-detects available tools & routes calls.
πŸ–₯️ Streamlit Chat UIRich chat experience with history, sidebar controls and live tool execution output.
🧩 Provider-AgnosticOne LangChain interface for OpenAI, Bedrock, Anthropic, Google, Groq. Switch on the fly.
🎯 Dynamic Model SelectionOverride default models with custom model IDs directly from the UI.
βž• Dynamic MCP Server ManagementAdd/remove MCP servers on-the-fly through the UI without editing config files.
πŸ€– React Agent via LangGraphcreate_react_agent enables dynamic tool selection and reasoning.
🐳 Docker-FirstSeparate Dockerfiles for client & each server + a single docker-compose.yaml.
πŸ“¦ ExtensibleDrop-in new MCP servers or providers without touching UI code.

πŸ“‚ Project Layout

mcp-playground/
β”œβ”€ docker-compose.yaml          # One-command orchestration
β”œβ”€ client/                      # Streamlit UI
β”‚  β”œβ”€ app.py                    # Main entry-point
β”‚  β”œβ”€ config.py                 # Typed settings & defaults
β”‚  β”œβ”€ servers_config.json       # MCP endpoint catalogue
β”‚  β”œβ”€ ui_components/            # Streamlit widgets
β”‚  └─ ...
└─ servers/
   β”œβ”€ server1/                  # Weather Service MCP
   β”‚  └─ main.py
   └─ server2/                  # Currency Exchange MCP
      └─ main.py

πŸš€ Quick Start

1 Β· Prerequisites

  • Docker β‰₯ 24 & Docker Compose
  • At least one LLM provider key (e.g. OPENAI_API_KEY) or AWS creds for Bedrock.

2 Β· Clone & Run

git clone https://github.com/your-org/mcp-playground.git
cd mcp-playground
docker compose up --build

⚑ Fast Builds with uv: All services use uv for dependency management, providing significantly faster Docker builds compared to traditional pip. Dependencies are cached and only reinstalled when pyproject.toml changes.

ServiceURLDefault Port
Streamlit Clienthttp://localhost:85018501
Weather MCPhttp://localhost:80008000
Currency MCPhttp://localhost:80018001

βš™οΈ Configuration

Default Settings

All runtime settings are concentrated in client/config.py and environment variables.

VariablePurpose
MODEL_IDProvider selector (OpenAI, Bedrock, Anthropic, Google, Groq).
TEMPERATURESampling temperature (sidebar slider).
MAX_TOKENSToken limit (sidebar).

Default Model IDs:

MODEL_OPTIONS = {
    'OpenAI': 'gpt-4o',
    'Antropic': 'claude-3-5-sonnet-20240620',
    'Google': 'gemini-2.0-flash-001',
    'Bedrock': 'us.anthropic.claude-sonnet-4-5-20250929-v1:0',
    'Groq': 'meta-llama/llama-4-scout-17b-16e-instruct'
}

🎯 Dynamic Model Override

You can override the default model for any provider directly in the UI:

  1. Select your provider from the dropdown
  2. See the default model displayed
  3. Enter a custom model ID in the "🎯 Custom Model" field
  4. Leave empty to use the default

Examples:

  • OpenAI: Override gpt-4o with o1 for reasoning tasks or gpt-4o-mini for cost efficiency
  • Anthropic: Use claude-opus-4.6 or claude-sonnet-4.6 for latest models
  • Google: Try gemini-2.0-flash-exp or gemini-exp-1206 for experimental features
  • Bedrock: Use us.anthropic.claude-opus-4-6-v1 for Opus 4.6 or us.anthropic.claude-sonnet-4-6 for Sonnet 4.6
  • Groq: Try different Llama models like llama-3.3-70b-versatile

βž• Dynamic MCP Server Management

Add custom MCP servers without editing servers_config.json:

  1. Click "βž• Add MCP Server" expander in the sidebar
  2. Fill in the server details:
    • Server Name: Unique identifier (e.g., MyCustomServer)
    • Server URL: Full endpoint URL (e.g., http://localhost:8002/sse)
    • Transport Type: sse or http
    • Timeout: Connection timeout in seconds (default: 600)
    • SSE Read Timeout: SSE-specific timeout (default: 900)
    • Headers (optional): JSON object with custom headers
      {"Authorization": "Bearer token"}
      
  3. Click "Add Server" to add multiple servers
  4. Servers persist in your session until removed

Server Sources:

  • πŸ“„ From Config: Static servers from servers_config.json (cannot be removed via UI)
  • πŸ“ User Added: Dynamic servers added through UI (can be removed with πŸ—‘οΈ button)

MCP endpoints can also be statically defined in servers_config.json for persistent configuration.


πŸ’¬ Using the Playground

  1. Select Provider Β· Pick your LLM in the sidebar and paste the corresponding credentials.
  2. Customize Model (Optional) Β· Override the default model ID with any model from your provider.
  3. Add MCP Servers (Optional) Β· Add custom MCP servers through the UI or use the default servers.
  4. Connect MCP Servers Β· Click connect; available tools appear in the MCP Tools list.
  5. Chat Β· Type a question.
    • If connected, the React agent decides whether to call an MCP tool (e.g. get_current_weather).
    • Otherwise it falls back to plain LLM chat.
  6. Inspect Tool Calls Β· Tool invocations are streamed back as YAML blocks with inputs & outputs.

Try: "What will the weather be in Baku tomorrow and how much is 100 USD in AZN?"


πŸ› οΈ Included MCP Servers

Weather Service :8000

mcp = FastMCP("Weather Service", host="0.0.0.0", port=8000)

@mcp.tool()
async def get_current_weather(location: str) -> dict: ...

@mcp.tool()
async def get_forecast(location: str, days: int = 3) -> dict: ...

Currency Exchange :8001

mcp = FastMCP("Currency Exchange", host="0.0.0.0", port=8001)

@mcp.tool()
async def get_currency_rates(date: str = None) -> dict: ...

@mcp.tool()
async def convert_currency(amount: float, from_currency: str, to_currency: str, date: str = None) -> dict: ...

πŸ™ Acknowledgements


Files in the repo

Repository payloadβ€’6 top-level entries
  • assets
  • client
  • servers
  • .gitignore
  • docker-compose.yaml
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More templates

CopilotKit/
OpenBot

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

4.6k
Donchitos/
Claude-Code-Game-Studios

Turn Claude Code into a full game dev studio β€” 49 AI agents, 72 workflow skills, and a complete coordination system mirroring real studio hierarchy.

25k

A self-organizing Obsidian vault that gives AI coding agents persistent memory. Claude Code, Codex CLI, Gemini CLI.

4.6k
idavidov13/
agentic-playwright

Production-grade Playwright + TypeScript Scaffold for Agentic Testing. Harness for all major AI coding agents baked in.

163
gavishap/
omnia-vault

Omnia Vault - the all-in-one project brain: an Obsidian LLM wiki, Graphify code graphs, a living plan that triages new videos against itself, and a Claude Code ⇄ Codex relay. Everything your project knows, in one clonable vault.

60

🎬 TαΊ‘o video "so sΓ‘nh kiαΊΏn thα»©c" ngαΊ―n tα»± Δ‘α»™ng β€” HyperFrames + AI voice, 1 template nhiều chα»§ đề.

169