Skip to content

feat: add MCP server and local command history#408

Open
harshal-swe wants to merge 1 commit intoOpenWhispr:mainfrom
harshal-swe:main
Open

feat: add MCP server and local command history#408
harshal-swe wants to merge 1 commit intoOpenWhispr:mainfrom
harshal-swe:main

Conversation

@harshal-swe
Copy link

Summary

Adds Model Context Protocol (MCP) server support and a local verbal command history system to OpenWhispr, enabling AI tools like Claude Code to interact with the app programmatically.

MCP Server (src/mcp/server.js)

  • Standalone stdio-based MCP server compatible with Claude Code and other MCP clients
  • 8 tools exposed: get_status, transcribe_audio, start_dictation, stop_dictation, get_transcriptions, get_command_history, search_commands, get_command_stats
  • Secure HTTP bridge (src/helpers/mcpBridge.js) running on localhost with token-based auth
  • Bridge auto-starts with the Electron app (Phase 2 deferred init), writes port/token to userData for discovery
  • Works across macOS, Windows, and Linux with platform-aware path discovery

Local Command History

  • New command_log SQLite table that auto-logs every dictation with metadata (timestamp, duration, model, provider, status, source)
  • Auto-logging hook in db-save-transcription IPC handler — zero manual intervention required
  • 7 new database methods: saveCommandLog, getCommandHistory, searchCommandHistory, getCommandStats, deleteCommandLog, clearCommandHistory, exportCommandHistory
  • 7 IPC handlers + preload bridge entries following existing patterns

Command History UI (src/components/CommandHistory.tsx)

  • Full-page panel in Control Panel with sidebar navigation entry
  • Search, filter by status/provider/source, stats summary bar
  • Date-grouped list with expand/collapse, copy, delete, export (JSON/CSV)
  • i18n translations for all 10 supported languages

Configuration

After installing, add to Claude Code MCP settings:

{
  "mcpServers": {
    "openwhispr": {
      "command": "node",
      "args": ["/path/to/openwhispr/src/mcp/server.js"]
    }
  }
}

New dependencies: @modelcontextprotocol/sdk ^1.12.1, zod ^3.24.0

Test plan

  • MCP server initializes and lists all 8 tools via tools/list
  • get_status returns app status, model, provider when app is running
  • MCP bridge starts on app launch, port/token files written to userData
  • Token-based auth rejects unauthorized requests
  • Graceful error when app is not running ("please start OpenWhispr")
  • command_log table created on first run with proper indexes
  • Auto-logging hook fires on every successful transcription
  • Command History UI renders in Control Panel sidebar
  • Built and tested macOS arm64 app end-to-end
  • Test on Windows and Linux
  • Test cloud transcription providers trigger auto-logging

- Add stdio-based MCP server with tools: get_status, transcribe_audio,
  start/stop_dictation, get_transcriptions, get_command_history,
  search_commands, get_command_stats
- Add MCP HTTP bridge with token-based auth for secure communication
- Add command_log SQLite table that auto-logs every dictation with metadata
- Add CommandHistory UI panel with search, filters, stats, export (JSON/CSV)
- Add IPC handlers and preload bridge for command history operations
- Add i18n translations for command history in all 10 supported languages
@gabrielste1n
Copy link
Collaborator

@harshal-swe thanks for the contribution, im curious, how are you currently using this?

@harshal-swe
Copy link
Author

harshal-swe commented Mar 11, 2026

@harshal-swe thanks for the contribution, im curious, how are you currently using this?

I am using openwhispr in meetings or to record my thought and then using some other mcp like clickup to create tickets or add comments using claude code.

Feels like this mcp would give me my privacy as the data is local and at the same time i can use data i want to go to right place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants