A minimal, fully MCP-compliant server and client setup for exploring and validating session-based tool invocation workflows using the Model Context Protocol (MCP).
- Toy Stateful MCP Server: Implements a minimal MCP server with session handling
- Test Tools: Includes
imagine
andisLessThan
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
- Node.js 18+
- Python 3.8+ (for integration tests)
- npm or yarn
- Clone the repository
- Install Node.js dependencies:
npm install
- Install Python dependencies for integration tests:
pip install -r test/integration/requirements.txt
- Create a
.env.test
file in the project root with the following content:PORT=3088
- Start the development server:
npm run dev
npm test
# Run all integration tests
npm run itest
# Or run a specific test
cd test/integration
python test_initialize.py
src/
- Source codeserver/
- MCP server implementationtools/
- Tool definitions
client/
- Test client implementation
test/
- Test filesintegration/
- Python-based integration tests
scripts/
- Build and utility scripts
Picks a random number between the specified lower and upper bounds and stores it in the session.
Parameters:
lower
: Lower bound (inclusive)upper
: Upper bound (inclusive)
Checks if a number is less than the previously imagined number in the current session.
Parameters:
number
: Number to compare against the imagined number
Health check endpoint that returns server status.
Main MCP protocol endpoint for handling MCP-compliant requests.
PORT
: Port number the server will listen on (default: 3000)NODE_ENV
: Environment mode (e.g., 'development', 'production')
ISC