Skip to content

mcp : add initial MCP server example (wip) #3321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danbev
Copy link
Collaborator

@danbev danbev commented Jul 12, 2025

This commit adds an suggestion for an Model Context Protocol (MCP) server implementation.

There is a simple command line demo which uses the stdio transport protcol (there is no http transport at this point) and its usage is described in the examples readme. The readme also contains an example of configuring Claude.ai Desktop to use this MCP server and to transcribe (please see the Claude.ai Desktop integration section for further details and screen shots).

The motivation for this was mainly that I wanted to learn more about MCP and trying to integrate whisper.cpp was a good way of learning. I'm not sure if this is something that we want to persue further, but I'd be happy to do so if there is interest. There are missing features of the protocol and also adding http transport (which should hopefully only be a matter of implementing a mcp::Transport for http).


This does not currently work on windows, and I've only tested on mac thus far.

This commit adds an suggestion for an Model Context Protocol (MCP) server
implementation.

There is a simple command line demo which uses the stdio transport
protcol (there is no http transport at this point) and its usage is
described in the [examples readme](examples/mcp/README.md).
The readme also contains an example of configuring Claude.ai Desktop to use
this MCP server and to transcribe (please see the
[Claude.ai Desktop integration section](examples/mcp/README.md#claudeai-desktop-integration)
for further details and screen shots).

The motivation for this was mainly that I wanted to learn more about MCP
and trying to integrate whisper.cpp was a good way of learning. I'm not
sure if this is something that we want to persue further, but I'd be
happy to do so if there is interest. There are missing features of the
protocol and also adding http transport (which should hopefully only be a
matter of implementing a mcp::Transport for http).
@ggerganov
Copy link
Member

Wouldn't it be much simpler if the MCP logic is implemented in some high-level language like Python and it would just send HTTP requests to whisper-server?

Implementing MCP in C++ seems like a big complication for almost no benefit. Still, if we decide to implement it, it should not deal with any specific whisper.cpp logic (like loading models, creating contexts, etc). It should just accept requests, forward them to whisper-server and return results.

@danbev
Copy link
Collaborator Author

danbev commented Jul 14, 2025

Wouldn't it be much simpler if the MCP logic is implemented in some high-level language like Python and it would just send HTTP requests to whisper-server?

The use case I had in mind was a constrained resource where making remote HTTP request might not be possible and the alternative of running a local HTTP server might not be desirable/possible. In these case, if this is in fact a valid use case, having a stdio transport might be nice and makes the usage very simple.

It should just accept requests, forward them to whisper-server and return results.

I agree, this is what I had in mind for the HTTP transport though I realize now that it will require some refactoring as I've only focused on the stdio transport protocol.

I do feel that having the alternative of a stdio transport could be nice to have. It seems to enable simple usage as there would not be a need to run whisper-server locally (if users are concerned with privacy and not willing to use a remove whisper-server).

But with that said, I'm still somewhat in vacation mode and this was mostly a personal interest to read up on MCP while having some extra time, and I wanted to see if this would be something worth pursuing (with maintainability and all that taking into consideration), so I'm also happy to close/park without further work as well 👍

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