Skip to content

Conversation

laulauland
Copy link
Member

@laulauland laulauland commented Oct 14, 2025

  • Add McpClient, StreamableHttpClientTransport, and Connection (tools, prompts, resources, ping)
  • Support stateless and session modes (SSE stream, onElicit/onSample for server-initiated requests)
  • Implement ClientSessionAdapter with InMemoryClientSessionAdapter
  • Protocol: negotiate and send MCP-Protocol-Version (uses SUPPORTED_MCP_PROTOCOL_VERSIONS.V2025_06_18)
  • Docs: add README.client.md with examples (tool discovery before call, progress handling, connection pool + persistence)
  • Tests: stateless ops, server-initiated requests (elicitation), multi-server workflows, progress notifications, error recovery
  • Cleanup: remove client middleware/context; delete packages/core/src/client/context.ts; simplify types and exports; fix version constants

Why

  • Minimal, spec-aligned client; reflects typical MCP flows (discover tools then call)
  • Enables session-based features (SSE, elicitation/sampling) without forcing state in basic use

Notes

  • No breaking changes to server APIs
  • Client API is new; examples provided in README.client.md

Follow-ups

  • Tool list caching
  • Reconnect/backoff strategy in connection pool

Copy link

changeset-bot bot commented Oct 14, 2025

🦋 Changeset detected

Latest commit: 020cc8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mcp-lite Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@laulauland laulauland force-pushed the mcp-client-implementation branch from 4792449 to f855e96 Compare October 14, 2025 14:11
Copy link

pkg-pr-new bot commented Oct 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/fiberplane/mcp-lite@133

commit: 020cc8b

Add complete MCP client implementation:

Core Foundation:
- McpClient class with fluent API (.use, .onError)  
- Connection class for server interactions (tools, prompts, resources)
- StreamableHttpClientTransport for HTTP communication
- ToolAdapter interface for SDK integration
- Full TypeScript support with proper type inference
- Zero runtime dependencies (built on Fetch API)

Session Management:
- ClientSessionAdapter interface for session persistence
- InMemoryClientSessionAdapter implementation
- openSessionStream() for GET SSE streams
- Session lifecycle management (create, reconnect, delete)
- Event replay with Last-Event-ID support

Server-Initiated Requests:
- onSample() and onElicit() handler registration
- Client _dispatch() method for processing server requests
- Middleware support for server-initiated requests
- Automatic SSE stream processing for incoming requests
- Response sending back to server via POST

Testing and Documentation:
- 182 integration tests (stateless, session, server requests, E2E)
- 624 expect() assertions validating all features
- Multi-server workflow tests
- Progress notification handling
- Error recovery patterns
- Complete README documentation with examples

The client mirrors McpServer patterns but inverted for sending
requests rather than handling them. Supports stateless operations
by default with opt-in session and bidirectional features.
@laulauland laulauland force-pushed the mcp-client-implementation branch from f8866c3 to 4626cb6 Compare October 16, 2025 12:06
@laulauland laulauland changed the title Implement MCP client with session and bidirectional support core/client: add MCP client with sessions, server requests, and docs Oct 16, 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.

1 participant