Skip to content

Feature/add rust mcp client integration example#390

Merged
ahmedhesham6 merged 5 commits intostakpak:betafrom
abd0-omar:feature/add-Rust-MCP-client-integration-example
Jan 5, 2026
Merged

Feature/add rust mcp client integration example#390
ahmedhesham6 merged 5 commits intostakpak:betafrom
abd0-omar:feature/add-Rust-MCP-client-integration-example

Conversation

@abd0-omar
Copy link
Contributor

@abd0-omar abd0-omar commented Dec 19, 2025

Description

Brief description of what this PR does.

Related Issues

Fixes #250

  • Example configuration for Claude Desktop
  • Example configuration for other MCP clients
  • Sample Python MCP client code
  • Sample TypeScript/Node.js MCP client code
  • Sample Rust MCP client code
  • Documentation on mTLS setup and certificates
  • Example environment variable configurations
  • Troubleshooting guide for common connection issues

Changes Made

  • add strategy pattern for certification generation to support both in-memory and persistent certificates (used in the examples)
  • add 3 different use cases examples demonstrating how to integrate Rust client with the MCP server

Testing

  • All tests pass locally
  • Added tests for new functionality
  • Tested on Linux (specify which)

Screenshots

Running the tool generate_password from the server using 3 different ways

ezgif-3452f620ecf098d4

Breaking Changes

  • updated rmcp to version 0.9.1 to match rig's version
  • updated reqwest to the latest 0.12.26, it was rig or mcp complaining can't remember who to be honest

@ahmedhesham6
Copy link
Collaborator

Thanks for the great work. We’re currently upgrading our MCP client to also work with our MCP proxy (see PR #378). Can you confirm whether this change impacts your change in any way?

@abd0-omar
Copy link
Contributor Author

Thanks for the great work. We’re currently upgrading our MCP client to also work with our MCP proxy (see PR #378). Can you confirm whether this change impacts your change in any way?

Thank so much for the heads up and sorry for the late reply, I was resolving merge conflicts and wanted to understand more the proxy addition (even though it doesn't use certification persistent as the PR does) and make sure it works fine. I also made the code simpler
I'm happy to do a rebase instead of a merge if it's needed, just let me know

Copy link
Collaborator

@ahmedhesham6 ahmedhesham6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MCP client examples are valuable and well-documented. The certificate strategy pattern is a good addition for supporting both development and production use cases.

Requested Changes

1. Please rebase to incorporate the latest changes from main

The PR has many merge commits and conflicts with recent changes.

2. Isolate changes from other PRs

This PR includes changes from multiple other PRs (388, 389, 393, 395, 378). Please rebase so only the example-related and certificate strategy changes are included. This will make the PR much easier to review and reduce merge conflicts.

3. Consider adding MCP proxy examples too

It would be great to also include examples showing how to connect to the MCP proxy, not just the direct server connection. This would provide more complete documentation for users.

Issues to Address

4. CertificateStrategy::Persistent doesn't actually load persistent certs

Self::Persistent(_path) => {
    // Since we can't reconstruct the rcgen::Certificate objects from PEM,
    // we'll generate a new chain (this is fine for client connections)
    CertificateChain::generate()  // <-- Generates NEW certs, doesn't load!
}

This is misleading - the name suggests it loads from disk but it generates new certs. Either fix the loading or rename/document the behavior clearly.

5. Examples use deprecated parameter name

"no_symbols": false  // Should be "include_symbols": true based on PR #377

If PR #377 is merged first, these examples will break. Please update to use include_symbols.

6. Improve error handling in examples

The examples use .unwrap() in several places that could panic:

let x = content_item.as_text().unwrap().text.to_string();

Consider using proper error handling with ? or if let.


Thanks for the great work on this! The documentation (README, MTLS.md) is particularly helpful.

@abd0-omar abd0-omar force-pushed the feature/add-Rust-MCP-client-integration-example branch from 0ceb441 to 6de4c80 Compare January 2, 2026 20:33
@abd0-omar abd0-omar force-pushed the feature/add-Rust-MCP-client-integration-example branch from 6de4c80 to d074865 Compare January 2, 2026 21:10
@abd0-omar
Copy link
Contributor Author

Thanks @ahmedhesham6 for the detailed review!

  • Rebase: I have cleaned and force-pushed the branch against main as I was before merging with an old branch containing the new proxy additions before it got merged to main and cleaned up the commit history.

  • added mcp proxy to CertificationStrategy

  • Added mcp proxy example in 2bf3a69 that uses stdio and https for mcp calls
    WindowsTerminal_I4OtJit9YY

  • Deprecated Parameters: Updated the examples in b296411 to use with_symbols, thanks for the heads up!

  • Error Handling: Replaced .unwrap() call with if let in bde76ac

please let me know for any changes!

@ahmedhesham6 ahmedhesham6 changed the base branch from main to beta January 4, 2026 01:03
@ahmedhesham6 ahmedhesham6 merged commit 3b4281a into stakpak:beta Jan 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create MCP Client Integration Examples

2 participants