MCP Stateful Example

by stevemadere

132 downloads
Not rated
GitHub

About

A simple stateful mcp server example. Clone and modify to make any stateful mcp server.

Details

Author
stevemadere
Downloads
132
Categories
Other

- Implements a minimal MCP server with session handling
- Includes imagine and isLessThan test tools
- Python‑based integration tests for validating server behavior
- 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:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Stateful Example
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install Node.js dependencies with npm install and Python dependencies for integration tests with pip install -r test/integration/requirements.txt. Create a .env.test file with PORT=3088, then start the development server with npm run dev.

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"
        ]
    }
}

MCP Stateful Example

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

```bash
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.