Query Counter MCP Server
Logs LLM interactions to local CSV or Markdown files with automatic categorization for detailed tracking. It provides an interactive HTML dashboard to visualize query volume, model usage, and category distribution.
README
Query Counter MCP Server
An MCP (Model Context Protocol) server that logs all your LLM queries to a local file and provides interactive analytics. Track your interactions with Claude, ChatGPT, Gemini, and other models with detailed categorization and visualizations.
Features
- Dual Format Logging: CSV (default) or Markdown format
- Interactive Dashboard: Beautiful HTML analytics dashboard with charts and KPIs
- Category Tracking: Organize queries by type (coding, research, debugging, etc.)
- Rich Analytics: Track query volume, model usage, category distribution, and trends
- Configurable: Custom log file location and format
- MCP Compatible: Works with Claude Desktop and other MCP clients
Installation
- Clone the repository:
git clone https://github.com/bjulius/QueryCounterMCP.git
cd QueryCounterMCP
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"query-counter": {
"command": "node",
"args": [
"/path/to/your/QueryCounterMCP/build/index.js"
]
}
}
}
Replace /path/to/your/QueryCounterMCP/ with the actual path where you cloned the repository.
Example paths:
- macOS:
"/Users/yourname/projects/QueryCounterMCP/build/index.js" - Windows:
"C:\\Users\\YourName\\Projects\\QueryCounterMCP\\build\\index.js"
Environment Variables
Customize the logging behavior:
{
"mcpServers": {
"query-counter": {
"command": "node",
"args": [
"/path/to/your/QueryCounterMCP/build/index.js"
],
"env": {
"QUERY_LOG_FORMAT": "csv",
"QUERY_LOG_PATH": "/path/to/your/custom/log.csv"
}
}
}
}
Available Options:
QUERY_LOG_FORMAT:"csv"(default) or"md"for MarkdownQUERY_LOG_PATH: Custom path for the log file
Usage
Logging Queries
The MCP server automatically logs queries made through Claude Desktop. The AI (Claude) determines the appropriate category based on the conversation context.
Example interaction:
User: Help me debug a React component that's not rendering properly
Claude: [Uses the log_query tool automatically]
- model: "Claude Sonnet 4.5"
- query_summary: "Help me debug a React component"
- category: "debugging" [AI selected]
Tool Parameters:
model(required): The LLM model name (selected by AI)query_summary(required): Brief description of the query (generated by AI)category(optional): Query category (automatically selected by AI based on query type)
Viewing the Dashboard
Use the show_dashboard tool to generate and view analytics:
Please show me the dashboard
This will:
- Generate an interactive HTML dashboard from your query data
- Automatically open it in your default browser
- Display real-time analytics and visualizations
Dashboard Features
The interactive dashboard includes:
KPI Cards
- Total Queries Today: Number of queries logged today (highlighted)
- Average Queries Per Day: Mean queries across all days
- Total Number of Categories: Unique categories used
- Max Queries in a Day: Your highest query volume day
Visualizations
- Categories by Percent: Horizontal bar chart showing category distribution
- Models by Percent: Horizontal bar chart of AI model usage
- Total Queries by Day: Daily query volume over time
Design
- Clean, modern interface with responsive layout
- Interactive charts powered by Chart.js
- Data labels on all visualizations for easy reading
- Personalized with your name in the subtitle
Query Categories
The AI automatically selects the most appropriate category for each query. These categories help organize and analyze your query patterns:
Development & Code
coding- Writing, debugging, or explaining coderefactoring- Code improvements, restructuring, optimizationtesting- Writing or running tests, test analysisdebugging- Troubleshooting errors, investigating issues
Analysis & Research
data-analysis- Analyzing data, visualizations, statisticsresearch- Information lookup, documentation searches, learning
Project Management
documentation- Writing/updating docs, README files, commentsconfiguration- Settings, setup, tool configuration, environment
Interaction
clarification- Follow-up questions, asking for detailsselection- Short confirmations, choosing optionsnavigation- UI commands, viewing files, moving aroundconversation- General chat, greetings, feedback
Log File Format
By default, queries are logged to QueryTrackMCP.csv in CSV format:
timestamp,date,model,category,query_summary
2025-10-15T18:20:37.516Z,10/15/2025 2:20:37 PM,Claude Sonnet 4.5,debugging,Help me debug a React component
2025-10-15T18:22:15.342Z,10/15/2025 2:22:15 PM,Claude Sonnet 4.5,coding,Create a user authentication function
2025-10-15T18:25:43.891Z,10/15/2025 2:25:43 PM,Claude Sonnet 4.5,data-analysis,Analyze sales data trends
CSV Format Benefits:
- ✅ Easy to import into Excel, Google Sheets, or Pandas
- ✅ Efficient for data analysis and reporting
- ✅ Compact file size
- ✅ Perfect for generating the interactive dashboard
- ✅ Can be opened and edited in any spreadsheet application
Alternative: Markdown Format
To use Markdown format instead, set QUERY_LOG_FORMAT=md in your environment variables. This creates a QueryTrackMCP.md file:
# LLM Query Log
This file tracks all queries made to various LLM models.
---
## 10/15/2025, 2:20:37 PM
- **Model**: Claude Sonnet 4.5
- **Category**: debugging
- **Query**: Help me debug a React component
- **Timestamp**: 2025-10-15T18:20:37.516Z
---
Markdown Format Benefits:
- ✅ Human-readable format
- ✅ Easy to browse in text editors
- ✅ Great for documentation and version control
Available Tools
log_query
Logs an LLM query to the tracking file.
Parameters:
model(string, required): LLM model namequery_summary(string, required): Brief query descriptioncategory(string, optional): Query category
show_dashboard
Generates and displays an interactive HTML analytics dashboard.
Parameters: None
Output: Opens query-dashboard.html in your default browser with:
- 4 KPI cards with key metrics
- 3 interactive charts (categories, models, daily trends)
- Real-time data from your CSV log file
Development
# Install dependencies
npm install
# Build the project
npm run build
# Watch for changes during development
npm run watch
# Build and run
npm run dev
File Structure
QueryCounterMCP/
├── src/
│ └── index.ts # Main MCP server code
├── build/
│ └── index.js # Compiled JavaScript
├── QueryTrackMCP.csv # Query log (CSV format)
├── query-dashboard.html # Generated analytics dashboard
├── CLAUDE.md # Instructions for Claude Code
└── README.md # This file
Tips
- Use categories consistently for better analytics
- Run the dashboard regularly to track your query patterns
- Set up automatic logging by integrating with your workflow
- Export CSV data for custom analysis in Excel or Python
- Customize the format based on your needs (CSV for analysis, MD for documentation)
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。