modelcontextprotocol / modelcontextprotocol/python-sdk
Add conveniences for MCP proxy pattern
Open
Nobody has claimed this yet.
enhancement
needs decision
P1
v2
- Dominant language
- Python
- Stars
- 24.3k
- Forks
- 4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 31
Description
TypeScript example, but should also be portable to our Python SDK:
export function mcpProxy({
transportToClient,
transportToServer,
onerror,
}: {
transportToClient: Transport;
transportToServer: Transport;
onerror: (error: Error) => void;
}) {
transportToClient.onmessage = (message) => {
transportToServer.send(message).catch(onerror);
};
transportToServer.onmessage = (message) => {
transportToClient.send(message).catch(onerror);
};
transportToClient.onclose = () => {
transportToServer.close().catch(onerror);
};
transportToServer.onclose = () => {
transportToClient.close().catch(onerror);
};
transportToClient.onerror = onerror;
transportToServer.onerror = onerror;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Python SDK's transport abstractions and the client or server entry points where a proxy could be exposed, then compare them with the TypeScript example in the issue. Done should provide equivalent bidirectional message forwarding, error handling, and close propagation, with the relevant Python tests updated or added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100