Skip to main content
Glama
mcp-commands
by PuemMTH

mcp-commands

MCP server สำหรับติดตามการใช้งาน AI commands

เก็บข้อมูลว่าใช้ command อะไรบ้าง เมื่อไหร่ และบริบทใดบ้าง โดยใช้ PostgreSQL เป็น storage

Architecture

Private Server (Docker Compose)
├── mcp-commands-db      ← PostgreSQL 16
└── mcp-commands-server  ← SSE mode, port 8432

Claude Code (ทุก machine)
└── url: "http://your-server:8432/sse"   ← ไม่ต้อง install อะไรเพิ่ม

ไม่ต้องแยก server กับ client — codebase เดียวรองรับทั้งสองโหมดผ่าน MCP_TRANSPORT


Related MCP server: PostgreSQL MCP Server

Option A: Central Server (แนะนำ)

Deploy บน private server

git clone https://github.com/PuemMTH/mcp-commands
cd mcp-commands
cp .env.example .env          # แก้ POSTGRES_PASSWORD
docker compose up -d

เพิ่มใน Claude Code (~/.claude.json) — ทุก machine

{
  "mcpServers": {
    "mcp-commands": {
      "url": "http://your-server:8432/sse"
    }
  }
}

ข้อมูลทุก session เก็บรวมใน Postgres เดียวกัน


Option B: รัน Local ด้วย uvx

สำหรับคนที่อยากรัน instance ของตัวเองแบบ stdio (ต้องมี PostgreSQL อยู่แล้ว)

# ตั้ง DATABASE_URL ให้ชี้ไป Postgres ของตัวเอง
DATABASE_URL=postgresql://user:pass@localhost:5432/mcp_commands \
  uvx --from git+https://github.com/PuemMTH/mcp-commands mcp-commands

เพิ่มใน Claude Code (~/.claude.json):

{
  "mcpServers": {
    "mcp-commands": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/PuemMTH/mcp-commands", "mcp-commands"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@localhost:5432/mcp_commands"
      }
    }
  }
}

MCP Tools

Tool

คำอธิบาย

log_command_tool

บันทึก command ที่ใช้งาน

get_history_tool

ดูประวัติการใช้งาน

get_stats_tool

สถิติสรุปการใช้งาน

search_commands_tool

ค้นหา command ในประวัติ

delete_command_tool

ลบ record ด้วย id

ตัวอย่างการใช้งาน

log_command_tool(command="/recap",         category="session",  context="morning standup")
log_command_tool(command="/commit",        category="git")
log_command_tool(command="deep-research",  category="research", context="MCP protocol study")

get_history_tool(limit=10)
get_stats_tool()
search_commands_tool(query="git")

Environment Variables

Variable

Default

คำอธิบาย

DATABASE_URL

postgresql://mcp_commands:mcp_commands@localhost:5432/mcp_commands

PostgreSQL DSN

MCP_TRANSPORT

stdio

stdio หรือ sse

MCP_PORT

8432

Port สำหรับ SSE mode

Categories แนะนำ

Category

คำอธิบาย

git

git related commands

session

session management

research

research tools

oracle

oracle commands

code

coding tools

skill

Claude Code skills

Available Tools

5 tools
delete_command_toolC
Delete a command-usage record by its id.

Args:
    row_id: The id field from history records

Inputs: row_id (required). Returns: result

get_history_toolA
Get recent command-usage history.

Args:
    limit:    Max rows to return (default 20)
    command:  Filter by command name (partial match)
    category: Filter by category (exact match)

Inputs: limit, command, category. Returns: result

get_stats_toolA
Get command usage statistics.

Args:
    top_n: How many top items to show per category (default 10)

Returns JSON with:
- total usage count
- top commands ranked by usage
- top categories ranked by usage
- daily counts for the last 7 days

Inputs: top_n. Returns: result

log_command_toolA
Log one AI command usage.

Args:
    command:  The command name, e.g. '/commit', '/recap', 'deep-research'
    category: Optional group, e.g. 'git', 'research', 'oracle', 'session'
    context:  Optional free-text note about where/why it was used

Inputs: command (required), category, context. Returns: result

search_commands_toolB
Search command history by keyword.

Searches across command name, category, and context fields.

Args:
    query: Search keyword
    limit: Max results (default 20)

Inputs: query (required), limit. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a distinct purpose with no overlap: delete_command_tool removes records, get_history_tool retrieves recent history, get_stats_tool provides aggregated statistics, log_command_tool logs new usage, and search_commands_tool searches across fields. The descriptions clearly differentiate their functions, making misselection unlikely.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (e.g., delete_command_tool, get_history_tool, log_command_tool). The naming is uniform throughout, using snake_case and clear action-object combinations, which aids predictability and readability.

    Tool Count5/5

    With 5 tools, the server is well-scoped for managing command-usage history, covering logging, retrieval, deletion, search, and statistics. Each tool earns its place without being too sparse or bloated, fitting typical MCP server ranges.

    Completeness4/5

    The tool set provides comprehensive coverage for the command-usage domain, including create (log), read (get_history, get_stats, search), and delete operations. A minor gap is the lack of an update tool for modifying existing records, but agents can work around this by deleting and re-logging if needed.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI assistants to interact with PostgreSQL databases by executing SQL queries and inspecting database schemas. It provides tools for standardized database exploration and management through the Model Context Protocol.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that enables AI assistants to create and manage persistent SQLite databases through natural language without requiring SQL knowledge. It allows users to propose schemas, store records, and perform complex queries across multiple databases for structured data tracking.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server that automatically logs AI coding assistant activities such as command executions and code generation, saving them as JSON files for later search and analysis.
      3
      25
      MIT