-
Notifications
You must be signed in to change notification settings - Fork 247
examples: add a simple chat client for example #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e3ce607
to
9e4dd6b
Compare
1. optimize the readme in root 2. add example Signed-off-by: jokemanfire <[email protected]> 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple quick comments. Thank you for having an example!
}; | ||
|
||
//default config path | ||
const DEFAULT_CONFIG_PATH: &str = "/etc/simple-chat-client/config.toml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for an example app, should use ./config.toml
as to not need escalated privileges to read from /etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thks, I 'd like to add a arg, to point the config path.
"\ntool name: {}\ndescription: {}\nparameters: {}\n", | ||
tool.name(), | ||
tool.description(), | ||
serde_json::to_string_pretty(&tool.parameters()).unwrap_or_default() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe have an example of error handling instead of hiding serialization issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
* Server wasm compatibility (modelcontextprotocol#15) * add axum sse example * fix: make the sse axum folder name correct * feat: add common modules for Axum SSE example This commit adds supporting modules for the Axum Server-Sent Events (SSE) example: - Added `counter.rs` with a simple counter router implementation - Added `jsonrpc_frame_codec.rs` for decoding JSON-RPC frames - Created a `mod.rs` to expose these modules - Removed the previous SSE example configuration from Cargo.toml * refactor: remove main.rs and update Cargo.toml for WASM compatibility This commit makes two key changes: 1. Removes the main.rs file and make it a example 2. Add a wasi_std_io example * refactor: simplify WASI I/O handling in example and fmt Merged AsyncInputStream and AsyncOutputStream into a single WasiFd struct with std_in() and std_out() methods, reducing code duplication and improving clarity of the WASI standard I/O example. * move examples to root * add missing license (modelcontextprotocol#35) * pin transport once, use project in write_message (modelcontextprotocol#28) * docs: add installation instructions for uv (modelcontextprotocol#37) * fix: update transport command to use the correct example server (modelcontextprotocol#36) * fix: update transport command to use the correct example server * style: cargo fmt * add an actix-web server sse example (modelcontextprotocol#33) * add an actix-web server sse example remove unused import * fix to apply cargo fmt and cargo clippy to pass the the repo checks * chore: decrease log level (modelcontextprotocol#41) Co-authored-by: ziyang zhang <[email protected]> * Move whole rmcp crate to offcial rust sdk (modelcontextprotocol#44) * get rid of async-trait * move rmcp to official-rust-sdk * replace master with main * update readme, change license * fix typo * Update README.md Co-authored-by: Jefry Dewangga <[email protected]> * fix typos --------- Co-authored-by: = <=> Co-authored-by: Jefry Dewangga <[email protected]> * doc: fix a typo in Cargo.toml (modelcontextprotocol#45) * docs: fix the branch name for git dependency (modelcontextprotocol#46) * docs: update the chinese doc (modelcontextprotocol#48) the chinese doc also should be update Signed-off-by: jokemanfire <[email protected]> * docs: fix broken link (modelcontextprotocol#53) * ci: add commit-lint in CI (modelcontextprotocol#50) no need too many workflows's yaml file, for ci we just need one. Signed-off-by: jokemanfire <[email protected]> * refactor(sse_server): separate router and server startup (modelcontextprotocol#52) * feat: expose axum router * feat: add axum_router example with SSE server implementation * refactor: simplify SseServer configuration handling in server setup * docs: add warning to SseServer::new about potential post_path issues with embedded routers * style: fmt the project (modelcontextprotocol#54) add rustfmt.toml Signed-off-by: jokemanfire <[email protected]> * [Example] Small fix on incorrect counter logic and improve prompt handling (modelcontextprotocol#63) The counter decrement in `get_value` was removed to prevent unintended changes to the counter state. Additionally, `get_prompt` was updated to parse and validate the `message` argument properly, ensuring better error handling and formatting. Co-authored-by: sandrohanea <[email protected]> * fix(server): add error enum while deal server info (modelcontextprotocol#51) 1. wrap the error type for more standardized 2. add more information in error for debug trace 3. wrap helper func for more user-friendly code Signed-off-by: jokemanfire <[email protected]> * ci: use `rust-cache` (modelcontextprotocol#60) Replace actions/cache with rust-cache. * chore: format code correctly (modelcontextprotocol#66) * test: add test with js server (modelcontextprotocol#65) * fix(test): fix tool deserialization error (modelcontextprotocol#68) * ci: add documentation generation job (modelcontextprotocol#59) * ci: add documentation generation job 1. add doc ci in workflow 2. remove the readme in rmcp crate Signed-off-by: jokemanfire <[email protected]> * docs: fix doc test in README.md 1) fix doc test in readme 2) fix some fmt Signed-off-by: jokemanfire <[email protected]> --------- Signed-off-by: jokemanfire <[email protected]> * fix(notification): fix wrongly error report in notification (modelcontextprotocol#70) * docs: format and fix typo (modelcontextprotocol#72) * feat(transport): Sse client transport trait (modelcontextprotocol#67) * feat: created transport trait and impl * feat(transport): abstract sse transport from the client definition * test: add test with js server (modelcontextprotocol#65) * fix: use prefix to check mime type * fix(test): fix tool deserialization error (modelcontextprotocol#68) * ci: add documentation generation job (modelcontextprotocol#59) * ci: add documentation generation job 1. add doc ci in workflow 2. remove the readme in rmcp crate Signed-off-by: jokemanfire <[email protected]> * docs: fix doc test in README.md 1) fix doc test in readme 2) fix some fmt Signed-off-by: jokemanfire <[email protected]> --------- Signed-off-by: jokemanfire <[email protected]> * fix(notification): fix wrongly error report in notification (modelcontextprotocol#70) * chore: fix lint errors by creating a type alias * chore: resolve conflict * chore: fix fmt * chore: revert --------- Signed-off-by: jokemanfire <[email protected]> Co-authored-by: Jefry Dewangga <[email protected]> Co-authored-by: 4t145 <[email protected]> Co-authored-by: jokemanfire <[email protected]> * feat: Sse server auto ping (modelcontextprotocol#74) 1. auto ping in sse stream every second to make cursor happy 2. configurable sse keep alive --------- Co-authored-by: = <=> * feat(tool): allow tool call return a serializable value in json format (modelcontextprotocol#75) (modelcontextprotocol#78) * fix(client): add error enum while deal client info (modelcontextprotocol#76) 1. wrap the error type for more standardized 2. add more information in error for debug trace 3. wrap helper func for more user-friendly code Signed-off-by: jokemanfire <[email protected]> * chore: fix typos (modelcontextprotocol#79) * Adopt Devcontainer for Development Environment (modelcontextprotocol#81) * chore: add devcontainer setting * docs: add Dev Container setup instructions to README and create DEVCONTAINER.md * ci: add spell check (modelcontextprotocol#82) for code greater use spell check Signed-off-by: jokemanfire <[email protected]> * fix(typo): s/marcos/macros/ (modelcontextprotocol#85) * fix: fix rig chat agent output format (modelcontextprotocol#86) * fix(typo): nit language corrections (modelcontextprotocol#90) * Add Claude desktop quick start and update Cargo.toml of examples/servers, examples/clients (modelcontextprotocol#94) * feat(readme): add Claude Desktop quick start guide * fix(readme): correct typo in Claude Desktop instructions * test(logging): Add tests for logging (modelcontextprotocol#96) * test(logging): implement basic logging functionality * test(logging): add comprehensive server transport tests * chore: fix broken wasi example link (modelcontextprotocol#100) fix doc's link in example * feat: revision-2025-03-26 without streamable http (modelcontextprotocol#84) 1. Suppot revision 2025-03-26 data types 2. Support meta, progress tokne, and extensions in request/notification, 3. Remove `Message`, use `JsonRpcMessage` directly * fix(macro): add generics marco types support (modelcontextprotocol#98) add generic marco support Signed-off-by: jokemanfire <[email protected]> * test(context): test context request handling and refactor for reusable client-server tests (modelcontextprotocol#97) * fix(rig-integration): implement ToolEmbeddingDyn trait for McpToolAdaptor (modelcontextprotocol#99) - Added ToolEmbeddingDyn trait for McpToolAdaptor to enable dynamic loading of McpTool - Enhanced logging to record details Co-authored-by: byeblack <[email protected]> * fix(test): fix test introduced by modelcontextprotocol#97 (modelcontextprotocol#101) * fix(server): schemars compilation errors (modelcontextprotocol#104) * feat: extensions to context (modelcontextprotocol#102) * docs: give macOS link and clarify missing UI (modelcontextprotocol#110) fix doc in examples/README.md. * ci: add code coverage job to CI workflow (modelcontextprotocol#111) add code coverage job * fix(macros): add error deal (modelcontextprotocol#109) 1.Check whether the parameters include aggregated parameters and individual parameters 2.Check if the toolbox attribute is default Signed-off-by: jokemanfire <[email protected]> * Fix typo for Claude desktop config file path correction and add more example for Windows, Linux, and MacOS (modelcontextprotocol#107) * fix(typo): claude desktop config file path correction * fix: fix 2 cargo warnings (modelcontextprotocol#112) * fix: fix 3 cargo warnings * revert `version = "1.0"` removal * ci: harden release action (modelcontextprotocol#113) * docs: add an overview to `rmcp/src/lib.rs` (modelcontextprotocol#116) * fix(handler): do call handler methods when initialize server (modelcontextprotocol#118) * docs: add a simple chat client for example (modelcontextprotocol#119) 1. optimize the readme in root 2. add example Signed-off-by: jokemanfire <[email protected]> * docs: fix the url (modelcontextprotocol#120) Signed-off-by: jokemanfire <[email protected]> * docs: update calculator example description (modelcontextprotocol#115) The example in the README uses "sum" for both `sum` and `sub`. I changed it to "difference". For consistency, I also updated the example code to use the same term. * docs: fix typo and clarify instructions (modelcontextprotocol#124) * chore: remove un-used tower.rs (modelcontextprotocol#125) Signed-off-by: nora-coder-dot <[email protected]> Co-authored-by: nora-coder-dot <[email protected]> * docs: fix doc in simple-chat (modelcontextprotocol#129) * ci: security (modelcontextprotocol#133) * ci: add security audit job to workflow * feat(rmcp-macro): generate description from docs (modelcontextprotocol#141) * feat: generate description from docs * fix logic to extract doc * fmt * chore: undo unnecessary changes in `Cargo.toml` * chore: undo unnecessary changes in `Cargo.toml` * chore: remove unnecessary code in tests * create `extract_doc_line` * fmt * make sure the string is not empty * avoid multilayer nesting * fmt * chore: make proxy in simple-chat configure (modelcontextprotocol#134) and remove some prints and some useless codes Signed-off-by: jokemanfire <[email protected]> * fix(rmcp-macros): fix extract_doc_line code (modelcontextprotocol#142) Signed-off-by: jokemanfire <[email protected]> * chore: disable unix_socket example on windows (modelcontextprotocol#146) * chore: make cli command in simple-chat (modelcontextprotocol#145) add config,chat,help command * fix: fix resource leak (modelcontextprotocol#136) When a running service is dropped, its connections should be closed and its resources should be cleaned up. This changes the default from leaving services running to closing them. Library users who want their services to remain running should call `waiting` on their running service, in a new task where necessary. Co-authored-by: Paul Ellenbogen <[email protected]> * chore: add oauth2 support (modelcontextprotocol#130) 1.add oauth2 server and client example 2.add oauth2 impl in sse 3.add auth doc Signed-off-by: jokemanfire <[email protected]> * fix(test): skip serialize tool's annotation if empty (modelcontextprotocol#160) * fix(test): skip serialize tool's annotation if empty 1. skip serialize tool's annotation if empty 2. close js server and client when close * fix(test): fix test with js, don't close too early * feat: allow use of reqwest without ring provider (modelcontextprotocol#155) Signed-off-by: Mauro Sardara <[email protected]> * feat(oauth): fixes + cache client credentials (modelcontextprotocol#157) credentials optimize * feat: add clippy config (modelcontextprotocol#162) Signed-off-by: jokemanfire <[email protected]> * feat(transport): support streamable http server (modelcontextprotocol#152) * feat(transport): support streamable http server * refactor(transport): add common module for shared transport utilities * perf(tracing): add more log for streamable http session * fix(test): fix port conflict in test with js * fix(transport): fix id generating and session management 1. cancel when deleting 2. use `wrapping` and `saturating` correctly * chore(naming): rename sse server to streamable http server * fix: build errors for WASI target (modelcontextprotocol#151) --------- Signed-off-by: jokemanfire <[email protected]> Signed-off-by: nora-coder-dot <[email protected]> Signed-off-by: Mauro Sardara <[email protected]> Co-authored-by: 4t145 <[email protected]> Co-authored-by: niebayes <[email protected]> Co-authored-by: Marc-Andre Giroux <[email protected]> Co-authored-by: situ2001 <[email protected]> Co-authored-by: xring <[email protected]> Co-authored-by: Ma1oneZhang <[email protected]> Co-authored-by: ziyang zhang <[email protected]> Co-authored-by: Jefry Dewangga <[email protected]> Co-authored-by: Ramnivas Laddad <[email protected]> Co-authored-by: jokemanfire <[email protected]> Co-authored-by: Takayuki Maeda <[email protected]> Co-authored-by: Wang Ruobiao <[email protected]> Co-authored-by: Sandro Hanea <[email protected]> Co-authored-by: sandrohanea <[email protected]> Co-authored-by: Todsaporn Banjerdkit <[email protected]> Co-authored-by: Eitan Yarmush <[email protected]> Co-authored-by: Bob Liu <[email protected]> Co-authored-by: z9rtm <[email protected]> Co-authored-by: Alex Kesling <[email protected]> Co-authored-by: Jonathan Hendler <[email protected]> Co-authored-by: Ruangyot Nanchiang <[email protected]> Co-authored-by: A₿del ∞/21M <[email protected]> Co-authored-by: byeblack <[email protected]> Co-authored-by: byeblack <[email protected]> Co-authored-by: Sandipsinh Dilipsinh Rathod <[email protected]> Co-authored-by: Rik Huijzer <[email protected]> Co-authored-by: Rik Huijzer <[email protected]> Co-authored-by: Luke Francl <[email protected]> Co-authored-by: Ofer Affias <[email protected]> Co-authored-by: Nora <[email protected]> Co-authored-by: nora-coder-dot <[email protected]> Co-authored-by: Eucalypt <[email protected]> Co-authored-by: Paul Ellenbogen <[email protected]> Co-authored-by: Paul Ellenbogen <[email protected]> Co-authored-by: Mauro Sardara <[email protected]> Co-authored-by: Andrew Culberson <[email protected]> Co-authored-by: Dennis Kawurek <[email protected]>
Motivation and Context
for dev friendly
How Has This Been Tested?
just use it
Breaking Changes
no
Types of changes
Checklist
Additional context