- Home
- MCP servers
- MCP Middleware
MCP Middleware
- python
0
GitHub Stars
python
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can run a Python-based MCP server that maintains per-session memory for conversations and uses API keys to initialize session-specific language models. It also includes a client to verify session continuity across multiple requests, making it easy to build interactive, multi-server experiences with secure, per-session context.
How to use
Start the MCP server and then run the client to test session continuity. The server listens at http://127.0.0.1:8000/mcp and uses per-session memory to preserve conversation history. You’ll supply your API key to initialize session-specific capabilities and interact using the client to see memory persist across requests.
How to install
Follow these steps to set up in a local environment. Prerequisites include Python 3.10 or newer and a Google Gemini API Key. You will clone the project, install dependencies, configure environment variables, and then run both the server and the client.
git clone https://example.com/tapanbhavsar/mcp_middleware.git
cd mcp_middleware
# Install dependencies
pip install -r requirements.txt
# Create and configure environment
cp .env.example .env
# Edit `.env` to add your Google Gemini API key, e.g. Google API Key:
# GOOGLE_API_KEY=YOUR_API_KEY
# Start the MCP server
python server.py
# In a new terminal, start the client to test interaction
python client.py
Additional notes
Prerequisites are required before starting. Ensure you have Python 3.10+ installed and a valid Google Gemini API key. The server will run by default on http://127.0.0.1:8000/mcp. The client demonstrates how the server maintains separate memory per session by tracking a session_id on the server.
Configuration and security
Environment configuration is done by creating a .env file from the example and supplying your Google Gemini API key. The server relies on per-session memory, so your session history stays isolated from other users. Keep your API key secure and do not share your environment file publicly.
Usage example
Start the server, then run the client in a separate terminal. In the client, you can set your name in one input and later ask for it to verify the memory is preserved across requests.