MCP.so
ログイン

MCP Stateful Example

@stevemadere

基本情報

カテゴリ

その他

トランスポート

stdio

作者

stevemadere

MCP Stateful Example について

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

#mcp#mcp-server#stateful-server

MCP Stateful Example の設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

{
  "mcpServers": {
    "mcp-stateful-example": {
      "command": "python",
      "args": [
        "test_initialize.py"
      ]
    }
  }
}

MCP Stateful Example のツール

ツール一覧はまだありません

この掲載には表示できるツール一覧がまだありません。サーバーにツールがないという意味ではありません。対応機能はプロジェクトのドキュメントをご確認ください。

ツールは README から自動的に抽出されます。メンテナーは ## Tools という見出しの下に記載することで、このタブに反映できます。

概要

What is 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.

How to use MCP Stateful Example?

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.

Key features of MCP Stateful Example

  • 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

Use cases of MCP Stateful Example

  • Learning how session state works in MCP tool invocations
  • Testing and validating MCP client‑server communication
  • Prototyping stateful tool workflows before building production servers

よくある質問

1

What tools are available?

Two tools: `imagine` picks a random number between specified bounds and stores it in the session; `isLessThan` checks if a number is less than the previously imagined number in the current session.

2

What are the prerequisites?

Node.js 18+, Python 3.8+ for integration tests, and npm or yarn.

3

How do I run integration tests?

Use `npm run itest` from the project root, or run a specific test by navigating to `test/integration` and executing `python test_initialize.py`.

4

What environment variables are used?

`PORT` (default: 3000) for the server port, and `NODE_ENV` for the environment mode (e.g., 'development' or 'production').

5

Does the server have a health check?

Yes, a `GET /health` endpoint returns server status.

コメント

「その他」の他のコンテンツ