MCP Stateful Example
About
A simple stateful mcp server example. Clone and modify to make any stateful mcp server.
Explore
- Toy Stateful MCP Server: Implements a minimal MCP server with session handling
- Test Tools: Includes imagine and isLessThan tools for testing session state
- Integration Tests: Python-based tests for validating server behavior and session persistence
- Health Check: Built-in /health endpoint for monitoring server status
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
MCP Stateful ExampleCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
- Node.js 18+
- Python 3.8+ (for integration tests)
- npm or yarn
- PORT: Port number the server will listen on (default: 3000)
- NODE_ENV: Environment mode (e.g., 'development', 'production')
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mcp stateful example": {
"mcp-stateful-example": {
"command": "python",
"args": [
"test_initialize.py"
]
}
}
}
}
McpServers
{
"mcp-stateful-example": {
"command": "python",
"args": [
"test_initialize.py"
]
}
}
A minimal, fully MCP-compliant server and client setup for exploring and validating session-based tool invocation workflows using the Model Context Protocol (MCP).
Features
- Toy Stateful MCP Server: Implements a minimal MCP server with session handling
- Test Tools: Includes imagine and isLessThan tools for testing session state
- Integration Tests: Python-based tests for validating server behavior and session persistence
- Health Check: Built-in /health endpoint for monitoring server status
Prerequisites
- Node.js 18+
- Python 3.8+ (for integration tests)
- npm or yarn
Getting Started
1. Clone the repository
2. Install Node.js dependencies:
npm install
3. Install Python dependencies for integration tests:
pip install -r test/integration/requirements.txt
4. Create a
.env.test file in the project root with the following content: PORT=3088
5. Start the development server:
npm run dev
Running Tests
Unit Tests
npm test
Integration Tests
```bashSign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



