Skip to content

Add in-memory transport#25

Merged
nick-merrill merged 12 commits intomainfrom
merrill/mcp-memory-transport
Nov 5, 2024
Merged

Add in-memory transport#25
nick-merrill merged 12 commits intomainfrom
merrill/mcp-memory-transport

Conversation

@nick-merrill
Copy link
Copy Markdown
Contributor

@nick-merrill nick-merrill commented Nov 4, 2024

Goal

Support running an MCP server in the same process as the client, while preserving MCP abstractions.

Details

  1. (core change) Adds a new memory transport module that enables in-process client-server communication.
    This includes:

    • create_client_server_memory_streams() to create bidirectional memory streams
    • create_connected_server_and_client_session() to establish an in-process client-server connection
  2. (minor) Enhances error handling and timeout support:

    • Adds configurable read timeouts to sessions via read_timeout_seconds parameter
    • Improves exception handling in the server with a new raise_exceptions flag to control whether errors are returned to clients or raised directly
    • Ensures proper cleanup of request context tokens in error cases
  3. (minor) Makes server improvements:

    • Adds built-in ping handler support

@nick-merrill nick-merrill marked this pull request as ready for review November 5, 2024 15:17
Copy link
Copy Markdown
Member

@jspahrsummers jspahrsummers left a comment

Choose a reason for hiding this comment

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

successkid

self,
read_stream: MemoryObjectReceiveStream[JSONRPCMessage | Exception],
write_stream: MemoryObjectSendStream[JSONRPCMessage],
read_timeout_seconds: int | float | None = None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TIOLI: Should this be a timedelta to avoid unit errors entirely?

@k6l3
Copy link
Copy Markdown
Member

k6l3 commented Nov 5, 2024

sweeeet

@nick-merrill nick-merrill force-pushed the merrill/mcp-memory-transport branch from 3849a4d to 5dd79b2 Compare November 5, 2024 19:59
@nick-merrill nick-merrill merged commit 60e9c7a into main Nov 5, 2024
@nick-merrill nick-merrill deleted the merrill/mcp-memory-transport branch November 5, 2024 23:42
ksteiny pushed a commit to ksteiny/python-sdk that referenced this pull request Dec 5, 2025
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.

3 participants