Skip to content

Conversation

@dpiskula-nxp
Copy link

@dpiskula-nxp dpiskula-nxp commented Nov 4, 2025

Intermediary PR containing a partial working implementation of the MCP core with the following features:

Core Infrastructure

  • Multi-threaded request processing with configurable worker pools
  • Message queue-based communication between transport and server layers (transport side is mocked in a very trivial way)
  • Server initialization and startup lifecycle management

Client Management

  • Client registration/deregistration and connection lifecycle tracking
  • State machine enforcement (DEINITIALIZED → NEW → INITIALIZING → INITIALIZED → DEINITIALIZING → DEINITIALIZED)

Protocol Support

  • MCP initialization handshake with capability negotiation
  • Initialize request/response processing
  • System message processing for client shutdown to enable client registry clean up (used by unit tests only, for now)
  • Tools/list request handling implemented
  • Tools/call request handling implemented

Tool Management

  • Tool registration and removal

Message Processing

  • Request type routing and dispatching
  • Response queuing to transport layer (mocked)
  • Error handling and cleanup for failed operations

Testing

  • Basic unit tests for client lifecycle and tool management

Currently Missing/TODO

  • Tool cancellation
  • The library uses dynamic memory allocation abstracted through mcp_alloc/mcp_free – optimizations through static allocation/memory slabs are to be considered
  • MCP Core health monitor

This commit removes an unncessary config for the qemu target

Signed-off-by: David Piskula <david.piskula@nxp.com>
Added thread pool and message queue initialization and enabled logging

Signed-off-by: David Piskula <david.piskula@nxp.com>
Basic steps towards lifecycle handling, starting with  initialization

Signed-off-by: David Piskula <david.piskula@nxp.com>
Added tool registration, improved type definitions and tools/list

Signed-off-by: David Piskula <david.piskula@nxp.com>
Refactored comments and code

Signed-off-by: David Piskula <david.piskula@nxp.com>
Added unit tests for implemented features

Signed-off-by: David Piskula <david.piskula@nxp.com>
Implemented the tools/call method

Signed-off-by: David Piskula <david.piskula@nxp.com>
Implemented tool response processing and testing

Signed-off-by: David Piskula <david.piskula@nxp.com>
Added server error responses

Signed-off-by: David Piskula <david.piskula@nxp.com>
@dpiskula-nxp dpiskula-nxp changed the title Initialization, Client and Tool registry, Initialization lifecycly of MCP Core MCP Core implementation - Initialization, Tools/List, Tools/Call (Missing Health monitor) Nov 24, 2025
@dpiskula-nxp dpiskula-nxp changed the title MCP Core implementation - Initialization, Tools/List, Tools/Call (Missing Health monitor) MCP Core implementation - Initialization, Tools/List, Tools/Call (Missing Health monitor and tool cancellation) Nov 24, 2025
Defined an enum for error codes

Signed-off-by: David Piskula <david.piskula@nxp.com>
Refactored code, made response workers optional

Signed-off-by: David Piskula <david.piskula@nxp.com>
Additional error handling for client initialization

Signed-off-by: David Piskula <david.piskula@nxp.com>
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.

2 participants