Skip to content

Feature/loopbacktransport #367

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

phil-rice
Copy link

Adds a Loopback Transport to the Model Context Protocol (MCP), enabling efficient in-memory communication between MCP clients and servers within the same execution context.

Motivation and Context

MCP currently supports communication via SSE and standard IO but lacks an efficient solution for testing or fully client-side, browser-based applications. The Loopback Transport fills this gap by providing a low-overhead, direct in-memory transport method, ideal for:

  • Browser-based applications: Enables MCP usage entirely in-browser without the overhead and complexity of backend servers, leveraging browser-native APIs.
  • Integration testing: Simplifies tests by removing external dependencies, network variability, and infrastructure complexity.

This feature is primarily motivated by several active enterprise projects involving enterprise search and AI-driven modernization. Modern single-page applications with robust security mechanisms (such as OAuth) often no longer require traditional backend APIs. Deploying MCP fully client-side provides significant benefits in simplicity, operational overhead reduction, and security. The Loopback Transport allows organizing prompts, tools, and resources effectively within MCP—even when running entirely in the browser.

While this transport is primarily aimed at JavaScript/TypeScript environments (due to the ease of running these languages directly in browsers), similar transports can be developed for other languages if there's sufficient demand.

How Has This Been Tested?

  • Comprehensive unit and integration tests are included and pass locally.
  • Tested extensively in a real-world, browser-based React application currently under development, specifically utilizing MCP to:
    • Send and receive emails.
    • Integrate seamlessly with LLMs.
  • Fully verified tool/resource discovery and MCP lifecycle functionality.
  • Successfully demonstrated to clients and end users in presentations.

Breaking Changes

No breaking changes. This addition is purely optional and introduces a new transport mechanism without affecting existing functionality.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • The Loopback Transport significantly simplifies client-side application architectures by eliminating unnecessary external API calls when they're not required.
  • Provides robust, performant solutions for testing scenarios and rapid prototyping within browser contexts.

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.

1 participant