Skip to content

Conversation

@olaservo
Copy link
Member

@olaservo olaservo commented Jan 19, 2026

Summary

Reference implementation of @modelcontextprotocol/inspector-core - a reusable core package for MCP client logic with no React dependencies.

Specification References

This implementation follows the V2 specification documents in specification/:

Spec Implementation
v2_scope.md Package architecture enabling CLI/TUI/Web sharing
v2_ux_handlers.md Handler interfaces for sampling, elicitation
v2_tech_stack.md TypeScript, MCP SDK integration

Related: Issue #983 (data spec discussion)

Directory Structure

core/
├── src/
│   ├── client.ts         # MCP client lifecycle (create, connect, disconnect)
│   ├── transport.ts      # StreamableHTTPClientTransport factory
│   ├── handlers.ts       # Sampling/elicitation handler creation
│   ├── index.ts          # Public API exports
│   ├── data/
│   │   ├── repositories.ts  # CRUD interfaces (ServerConfig, History, Logs, TestingProfile)
│   │   ├── services.ts      # Stateful interfaces (Connection, Execution)
│   │   ├── memory.ts        # In-memory stub implementations
│   │   └── index.ts
│   └── types/
│       ├── auth.ts          # OAuth state types
│       ├── capabilities.ts  # Server capabilities
│       ├── clientRequests.ts # Sampling/elicitation request types
│       ├── history.ts       # History entries with parent-child relationships
│       ├── logs.ts          # RFC 5424 log levels
│       ├── responses.ts     # MCP response types
│       ├── servers.ts       # Server config types
│       ├── tasks.ts         # Task management types
│       ├── testingProfiles.ts # Auto-respond configuration
│       └── index.ts
├── test-core.js          # Unit tests for memory implementations
└── test-real-server.js   # Integration tests with Everything MCP server

Core Features

  • MCP client lifecycle: createMcpClient, connectClient, disconnectClient, isClientConnected
  • Transport factory: createHttpTransport for Streamable HTTP connections
  • Handler creation: createSamplingHandler, createElicitationHandler with queue-based patterns
  • Repository interfaces: ServerConfigRepository, HistoryRepository, LogsRepository, TestingProfileRepository
  • Service interfaces: ConnectionService, ExecutionService for stateful operations
  • Memory implementations: In-memory stubs for all repositories/services (testing, CLI, TUI)
  • Type definitions: History entries with parent-child relationships, RFC 5424 log levels, testing profiles

Design Principles

  1. No React dependencies - Can be used in CLI, TUI, or test frameworks
  2. Interface-first data layer - Repository/service interfaces with swappable implementations
  3. Stubbable for testing - Memory implementations enable unit tests without I/O

Test Plan

  • Unit tests pass: node core/test-core.js (all 21 tests)
  • Integration tests pass with Everything server running
  • Review feedback incorporated

Stack


Generated with Claude Code

olaservo and others added 2 commits January 18, 2026 12:44
Extracts reusable MCP client logic into a separate package that can be
shared across web UI, CLI, and TUI implementations.

Includes:
- MCP client lifecycle (createMcpClient, connectClient, disconnectClient)
- HTTP transport creation (createHttpTransport, createAuthenticatedTransport)
- Sampling/elicitation request handlers
- Data layer interfaces (repositories, services) with memory stubs
- Shared type definitions
- test-core.js: Unit tests for memory implementations (repositories,
  services, type helpers)
- test-real-server.js: Integration tests with Everything MCP server

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants