Conversation
Greptile SummaryRefactored MCP implementation from TCP-based stdio bridge to direct HTTP-based FastAPI server/client architecture. The new approach simplifies the integration with Claude Code by removing the intermediate bridge layer and using HTTP JSON-RPC directly. Major Changes:
Issues Found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Claude as Claude Code
participant Client as McpClient
participant Server as McpServer
participant Skills as Robot Skills
Note over Claude,Skills: Initialization Phase
Claude->>Server: HTTP POST /mcp (initialize)
Server-->>Claude: Server capabilities & info
Claude->>Server: HTTP POST /mcp (tools/list)
Server->>Skills: get_skills()
Skills-->>Server: List of SkillInfo
Server-->>Claude: Available tools with schemas
Note over Claude,Skills: Tool Execution Phase
Claude->>Client: Human input message
Client->>Client: Queue message
Client->>Client: LangChain agent processes
Client->>Server: HTTP POST /mcp (tools/call)
Server->>Skills: RPC call to skill
Skills-->>Server: Result or None
Server-->>Client: JSON-RPC result
Client->>Client: Append to history
Client->>Claude: Publish agent message
Note over Client,Skills: Image Handling
Skills-->>Server: Result with agent_encode()
Server-->>Client: Content with image data
Client->>Client: Add UUID, append to history
Client->>Claude: Tool response + image message
Last reviewed commit: 2fdf0cb |
|
@paul-nechifor should we just fork openclaw? Theyve build a lot of robust MCP and hosted gateway infra, runs on all architectures, etc |
2fdf0cb to
df8c8fc
Compare
I don't think we need to fork openclaw, we just want to connect it to our MCP server. And we'll want to publish a SKILL.md file to ClawHub so openclaw knows how to use our server. |
df8c8fc to
a28712f
Compare
|
|
||
| return self._mcp_request("tools/list") | ||
|
|
||
| def _mcp_tool_to_langchain(self, mcp_tool: dict[str, Any]) -> StructuredTool: |
There was a problem hiding this comment.
I'm missing a lot of typing with dict[str, Any] everywhere which makes it harder to review
idk how solid/long term you intend for this code to be - I think type guards and typing for actual messages received/sent are super helpful for protocol implementations like these, can work on it in follow ups
| } | ||
|
|
||
| def _start_server(self, port: int = 9990) -> None: | ||
| config = uvicorn.Config(app, host="0.0.0.0", port=port, log_level="info") |
There was a problem hiding this comment.
proly want this as Configurable, and could be a security issue to have 0.0.0.0 by default
| self._http_client = httpx.Client(timeout=120.0) | ||
| self._seq_ids = SequentialIds() | ||
|
|
||
| def __reduce__(self) -> Any: |
There was a problem hiding this comment.
what is the situation in which this gets pickled?
| import uuid | ||
|
|
||
| import httpx | ||
| from langchain.agents import create_agent |
There was a problem hiding this comment.
just a comment, too bad langchain doesn't have it's own mcp_client and loop out of the box ha? I hoped you won't need to write much of this
| content=[ | ||
| { | ||
| "type": "text", | ||
| "text": f"This is the artefact for the '{func_name}' tool with UUID:={uuid_}.", |
There was a problem hiding this comment.
slight concern over using uuids for association, in terms of hallucinations and matching of uuids by the agnet, we might want a simple integer counter, or time_from_start for ids? not sure since we don't have evals yet to prove this
leshy
left a comment
There was a problem hiding this comment.
non contraversial, just a few comments, I will test on actual robot later today or worst case tomorrow
Problem
We need to move towards greater support for MCP.
Closes DIM-533
https://linear.app/dimensional/issue/DIM-533/add-mcp-client-and-server
Solution
Agent. It has been efectivelly split betweenMcpClientandMcpServer.@skillfunctions as MCP tools./human_inputso it can be used through thehumanclilikeAgentcan.Next tasks:
Breaking Changes
None
How to Test
Run
...instead of
unitree-go2-agenticand interact with it the same way throughhumancli:start exploring, stop, move forward 2 meters, etc.