home / mcp / mcp chat mcp server
Provides an in-memory, room-based chat using MCP to enable human-to-human messaging through tool calls and long-polling wait_for_message.
Configuration
View docs{
"mcpServers": {
"hbd-mcp-chat": {
"url": "http://localhost:8000/mcp"
}
}
}You can run an MCP-based chat server that lets two humans exchange messages through the MCP transport. This setup uses a simple in-memory, room-based approach with long-polling to deliver messages, enabling a straightforward chat experience powered by MCP clients.
Connect to the chat server from an MCP client to begin chatting. Run the server, then use the MCP-enabled client to join or create a chat room and exchange messages. The flow relies on long-polling to wait for new messages, so the recipient’s message appears when it arrives, without requiring a constant WebSocket connection.
Typical usage involves two separate client sessions that join the same chat room. Each participant sends a message, and the other participant receives it through the wait-for-message mechanism. This creates a simple, real-time-feeling chat across MCP clients.
Prerequisites you need before installing this MCP chat server:
- Python 3.11 or newer
- uv package manager
Follow these steps to install and run the server:
# Terminal 1
uv sync
uv run fastmcp run mcp_chat/server.py --transport http
```
```
# Terminals 2 & 3
claude mcp add --transport http mcp-chat -s project -- http://localhost:8000/mcp
claude
```
The command in Terminal 1 starts the MCP chat server with HTTP transport. The two Claude Code sessions in Terminals 2 and 3 connect to the server using the provided URL and set up a shared chat space.Key functions you will use in the chat server are:
- join_room to create or join a chat room
- send_message to send a message to the room
- wait_for_message to wait for incoming messages (this call blocks until a message arrives)
- leave_chat to exit the room
Create or join a chat room to start or participate in a conversation.
Send a message to the current chat room.
Wait for incoming messages; this call blocks until a message is delivered.
Leave the current chat room to end or exit the chat session.