claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Question] Serve as remote/sse MCP-server

Open simon-ami opened this issue 6 months ago • 11 comments

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?

simon-ami avatar Jun 08 '25 11:06 simon-ami

https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-code-as-an-mcp-server

mateuszmazurek avatar Jun 08 '25 11:06 mateuszmazurek

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

simon-ami avatar Jun 08 '25 12:06 simon-ami

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.

mateuszmazurek avatar Jun 08 '25 13:06 mateuszmazurek

Thanks, I'll take a look into that!

Is it planned to integrate this into claude code?

simon-ami avatar Jun 08 '25 13:06 simon-ami

I have no idea, I'm just regular Claude Code user, just like you. Let's wait for team response.

mateuszmazurek avatar Jun 08 '25 13:06 mateuszmazurek

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:

  1. 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 uv python package manager (different package managers can be used too) 1.2 ran uv tool install mcp-proxy
  2. 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
  3. 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)

simon-ami avatar Jun 08 '25 21:06 simon-ami

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 avatar Jun 08 '25 22:06 michael-hedgineer

@michael-hedgineer

Image

mateuszmazurek avatar Jun 09 '25 07:06 mateuszmazurek

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?

ashwin-ant avatar Jun 12 '25 23:06 ashwin-ant

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 avatar Jun 13 '25 17:06 pchalasani

@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.

ashwin-ant avatar Jun 13 '25 18:06 ashwin-ant

Not planned at this time.

ashwin-ant avatar Aug 22 '25 19:08 ashwin-ant

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.

github-actions[bot] avatar Aug 31 '25 14:08 github-actions[bot]