[Question] Serve as remote/sse MCP-server
Hi, is it possible to serve Claude Code as a remote (sse) MCP server and, if so, are there any resources explaining how to achieve this?
https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-code-as-an-mcp-server
https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-code-as-an-mcp-server
yes i found that, but its only for local clients as far as i understand
Ah, I understand now. I'm pretty sure Claude Code supports only stdio transport for communication. However, you might be able to achieve what you're looking for by using a proxy like https://github.com/sparfenyuk/mcp-proxy. This could potentially bridge the stdio communication to a remote SSE server.
Thanks, I'll take a look into that!
Is it planned to integrate this into claude code?
I have no idea, I'm just regular Claude Code user, just like you. Let's wait for team response.
I got it to work (within my local Wi-Fi network, for now) using the tool suggested by @mateuszmazurek, thanks again!
Here's how I did it:
- On both client and server, I did the base setup per the docs of the suggested tool https://github.com/sparfenyuk/mcp-proxy:
1.1 installed
uvpython package manager (different package managers can be used too) 1.2 ranuv tool install mcp-proxy - On the server (in my case, my desktop pc), I started mcp-proxy in stdio-to-SSE mode for claude code MCP server:
mcp-proxy --port=8080 --host=0.0.0.0 -- claude mcp serve - On the client (in my case, Claude Desktop client on my notebook, in the same Wi-Fi), I added the following JSON MCP server-config for running mcp-proxy in SSE-to-stdio mode: (replace IP-address with your server's address)
{
"mcpServers": {
"claude-code-mcp": {
"command": "mcp-proxy",
"args": ["http://192.168.2.123:8080/sse"]
}
}
}
hint: make sure to run the mcp-proxy on the server before running the client with the mcp-proxy, or it will fail to connect
(leaving this open since the above is not an official solution)
What tools are exposed directly from claude code? I see the examples just showing LS, View, Read, but does it include Agent or similar which allows it to chain together multiples tools similar to when you call claude -p or use the Agent tool?
If just the individual tools directly I am not sure how powerful it would be just yet. But curious to learn about your experience. Thanks for sharing!
@michael-hedgineer
Can you share more about how you'd expect this to work? Would you just expect it to launch a server on some port that you specify?
https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-code-as-an-mcp-server
the doc link seems to have moved to -- https://docs.anthropic.com/en/docs/claude-code/mcp#use-claude-code-as-an-mcp-server
btw when I run claude mcp server it does nothing and just hangs
@pchalasani The claude mcp serve command is launching the stdio MCP server. You'll want to launch that from your MCP client, not directly from your terminal.
Not planned at this time.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.