Chatlog MCP Server
Enables users to analyze, search, and export chat logs from various platforms through tools for managing chatrooms, contacts, and sessions. It supports advanced filtering by time, keyword, and sender to provide detailed message analytics via MCP-compatible clients.
README
Chatlog MCP Server
A Model Context Protocol (MCP) server for analyzing chat logs from various platforms. This server provides convenient access to chat data through MCP-compatible clients like Claude Code.
β¨ Features
- π 4 Core Tools: List chatrooms, contacts, sessions, and chatlogs
- π Advanced Analytics: Message statistics, active members, keyword analysis
- π Flexible Search: Time range, keyword, and sender filtering
- π Data Export: JSON, Text, and CSV formats
- π Multi-Client Support: Claude Code, Cursor, VS Code, and more
- π οΈ Easy Installation: pip install and go
π¦ Installation
Option 1: Install from PyPI (Recommended)
pip install chatlog-mcp-server
Option 2: Install from Source
git clone https://github.com/anthropics/chatlog-mcp-server.git
cd chatlog-mcp-server
pip install -e .
Option 3: Install with Development Dependencies
pip install -e ".[dev]"
π Quick Start
1. Install the Package
pip install chatlog-mcp-server
2. Configure MCP Client
Create a mcp-servers.json file:
{
"mcpServers": {
"chatlog": {
"command": "chatlog-mcp",
"args": [],
"env": {
"PYTHONIOENCODING": "utf-8"
}
}
}
}
3. Start Using
In Claude Code, simply say:
Use the chatlog tool to list chatrooms
π οΈ Configuration
Environment Variables
You can configure the server using environment variables:
| Variable | Description | Default |
|---|---|---|
CHATLOG_API_URL |
HTTP API server URL | http://127.0.0.1:5030 |
CHATLOG_LOG_LEVEL |
Logging level | info |
Command Line Options
chatlog-mcp --help
Options:
--api-url URL: Set custom API URL--log-level LEVEL: Set logging level (debug, info, warning, error)--version: Show version and exit
Example Configuration
{
"mcpServers": {
"chatlog": {
"command": "chatlog-mcp",
"args": ["--api-url", "http://localhost:5030", "--log-level", "debug"],
"env": {
"PYTHONIOENCODING": "utf-8"
}
}
}
}
π Tools
The Chatlog MCP Server provides 4 core tools:
1. list_chatrooms
Get a list of chatrooms with optional keyword search.
Parameters:
keyword(optional): Search keywordformat(optional): Output format (json/text)
Example:
Use chatlog to list chatrooms with keyword "AI"
2. list_contacts
Get a list of contacts with optional keyword search.
Parameters:
keyword(optional): Search keywordformat(optional): Output format (json/text)
Example:
Use chatlog to list contacts with keyword "John"
3. get_recent_sessions
Get a list of recent sessions.
Parameters:
format(optional): Output format (json/text)
Example:
Use chatlog to get recent sessions
4. get_chatlog
Get chat logs for a specific time range and chatroom.
Parameters:
time(required): Time range (e.g., "2026-01-13" or "2026-01-10~2026-01-13")talker(required): Chatroom or contact IDsender(optional): Filter by senderkeyword(optional): Search keywordlimit(optional): Limit number of resultsoffset(optional): Offset for paginationformat(optional): Output format (json/text/csv)
Example:
Use chatlog to get chatlogs with these parameters:
{
"time": "2026-01-13",
"talker": "123456789@chatroom",
"format": "json"
}
π Use Cases
Case 1: Analyze Chatroom Activity
# Get chat logs for the last 7 days
curl "http://127.0.0.1:5030/api/v1/chatlog?time=2026-01-07~2026-01-13&talker=44156635321@chatroom&format=json"
Case 2: Search for Specific Keywords
# Find messages containing "AI"
curl "http://127.0.0.1:5030/api/v1/chatlog?time=2026-01-13&talker=44156635321@chatroom&keyword=AI&format=json"
Case 3: Get Top Active Members
# Export data and analyze with Python
curl "http://127.0.0.1:5030/api/v1/chatlog?time=2026-01-10~2026-01-13&talker=44156635321@chatroom&format=json" > chatlog.json
Then use the provided analysis scripts:
python -m chatlog_mcp.examples.analyze chatlog.json
π§ Development
Setup Development Environment
git clone https://github.com/anthropics/chatlog-mcp-server.git
cd chatlog-mcp-server
pip install -e ".[dev]"
Run Tests
pytest
Code Formatting
black chatlog_mcp/
flake8 chatlog_mcp/
mypy chatlog_mcp/
π Examples
See the examples/ directory for:
- Sample configurations
- Analysis scripts
- Data export examples
- Integration guides
π€ Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
pytest - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
π Requirements
- Python 3.10 or higher
- HTTP API server running on specified URL
- MCP-compatible client (Claude Code, Cursor, etc.)
π Troubleshooting
Common Issues
Issue: "Unknown skill: chatlog"
- Ensure the MCP server is running
- Check that the configuration is correct
- Verify the command path is accessible
Issue: "Connection refused"
- Ensure the HTTP API server is running
- Check the API URL in configuration
- Verify network connectivity
Issue: Chinese characters not displaying correctly
- Ensure
PYTHONIOENCODING=utf-8is set - Use UTF-8 encoding for all files
- Check terminal encoding settings
For more help, see TROUBLESHOOTING.md or open an issue.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Model Context Protocol for the amazing protocol
- Claude Code for the MCP client
- Anthropic for the support
π Support
- π§ Email: support@anthropic.com
- π Issues: GitHub Issues
- π Docs: Full Documentation
πΊοΈ Roadmap
- [ ] Add support for more chat platforms
- [ ] Real-time message streaming
- [ ] Advanced analytics and visualization
- [ ] Webhook support
- [ ] Plugin system for custom analysis
- [ ] RESTful API for external integrations
Made with β€οΈ by the Claude Code team
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.