Add Typescript bindings crate, FFI, workflow, and examples for RMCP Rust SDK#183
Add Typescript bindings crate, FFI, workflow, and examples for RMCP Rust SDK#183tarunanand-dev wants to merge 4 commits intomodelcontextprotocol:mainfrom
Conversation
|
For #172 and this #183, I am sorry that I don't think I can maintain those bindings in the future. So how about this, you create a repository and maintain those yourself, we add a link to your repository in readme. cc @jokemanfire |
|
Wow, amazing work @tarunanand-dev! 🚀 |
I think it is better to use a separate repository for maintenance.That way, the existing rust-sdk target will not be modified and the maintenance effort will not increase. |
Thanks @reneleonhardt Appreciate the feedback. |
Ok @jokemanfire thanks for the feedback. I will keep this PR open around for some more time as I gather feedback from other contributors and will then move it out. |
|
Feel free to open this pr, and I will try to use it and check it after the rust-sdk publish the first stable. |
|
As it goes on in https://github.com/orgs/modelcontextprotocol/discussions/354, I will close this pr here. |
Overview
TypeScript Bindings for RMCP
This PR adds TypeScript bindings for the Rust Model Context Protocol (RMCP) SDK, providing a native TypeScript/JavaScript interface for interacting with RMCP services.
Changes
Core TypeScript Bindings
bindings/typescriptbuild.rsMotivation and Context
How Has This Been Tested?
Breaking Changes
None
Types of changes
Checklist
Additional context
Example Client
bindings/typescript/examples/clientsIntegration
Cargo.tomlto include TypeScript bindingsDocumentation
TypeScript Bindings Setup & Example Usage
Prerequisites
npm install -g typescript)Build the TypeScript Bindings
cd bindings/typescriptNote on Cargo.toml
If you encounter an error indicating that the
Cargo.tomlofbindings/pythonis not present in the rootCargo.toml, and you don't want to build Python and TypeScript together, you can edit the rootCargo.tomlto remove the Python bindings (bindings/python) entry.Run the Rust Server
In a separate terminal, start the Rust SDK server (example using the rmcp crate):
cd examples/servers cargo run --example servers_axumLink the Module Locally
If the
rmcp-typescriptmodule is not published to npm, you can link it locally:cd bindings/typescriptcd examples/clients npm link rmcp-typescriptRun the TypeScript SSE Client Example
With the server running, in another terminal:
cd bindings/typescript/examples/clients/src npx tsx sse.tsThis will connect to the running Rust server and demonstrate the SSE client functionality.