Skip to content

Support for MCP#194

Merged
perdy merged 1 commit intodevelopfrom
feat/mcp-support
Apr 7, 2026
Merged

Support for MCP#194
perdy merged 1 commit intodevelopfrom
feat/mcp-support

Conversation

@migduroli
Copy link
Copy Markdown
Member

@migduroli migduroli commented Mar 24, 2026

This pull request introduces comprehensive support for the Model Context Protocol (MCP) over JSON-RPC in the Flama framework. It adds new modules, endpoints, routing, protocol error handling, and response types to enable extensible and standards-compliant machine learning model interaction. The changes also generalize JSON-RPC support across the framework, including new exception handling and endpoint base classes.

Major enhancements and new features:

Model Context Protocol (MCP) Integration

  • Added the MCPModule, which manages one or more MCP servers, and provides decorators and methods to register tools, resources, and prompts for model interaction. (flama/mcp/module.py, flama/applications.py) [1] [2] [3] [4]
  • Implemented the MCPServer and MCPRoute classes, allowing MCP servers to be mounted at specific paths and routed via HTTP POST requests. (flama/mcp/server.py, flama/mcp/routing.py)
  • Created the MCPEndpoint, which defines the MCP API over JSON-RPC, including methods for initialization, tool/resource/prompt management, and protocol-compliant responses. (flama/mcp/endpoint.py)

JSON-RPC Support

  • Introduced a generic JSONRPCEndpoint base class for handling JSON-RPC requests, including method dispatch, error handling, and response formatting. (flama/endpoints/jsonrpc.py, flama/endpoints/__init__.py) [1] [2]
  • Added JSONRPCException for protocol-specific error reporting, and integrated it into the debug middleware for consistent error handling. (flama/exceptions.py, flama/debug/middleware.py) [1] [2] [3] [4]

JSON-RPC Response Types

  • Defined JSONRPCResponse and JSONRPCErrorResponse classes for standard-compliant JSON-RPC responses, along with a JSONRPCStatus enum for protocol error codes. (flama/http.py) [1] [2] [3]

Other improvements:

  • Updated the HTTP endpoint dispatch method to return a value, aligning it with JSON-RPC endpoint expectations. (flama/endpoints/http.py)
  • Ensured all new MCP and JSON-RPC modules are imported and available within the package. (flama/mcp/__init__.py)

These changes lay the foundation for robust, extensible, and standards-based model serving and interaction within Flama, making it easier to build interoperable AI systems.

@migduroli migduroli self-assigned this Mar 24, 2026
Comment thread flama/mcp/endpoint.py Outdated
Comment thread flama/mcp/endpoint.py Outdated
Comment thread flama/mcp/endpoint.py Outdated
Comment thread flama/mcp/endpoint.py Outdated
Comment thread flama/mcp/server.py
Comment thread flama/mcp/server.py
@migduroli migduroli force-pushed the feat/mcp-support branch 5 times, most recently from 3334a95 to 86cb3fd Compare March 27, 2026 11:29
@migduroli migduroli changed the base branch from master to develop April 3, 2026 14:40
@migduroli migduroli marked this pull request as ready for review April 7, 2026 16:47
@perdy perdy force-pushed the feat/mcp-support branch from de20507 to 72d166d Compare April 7, 2026 18:57
@perdy perdy merged commit 61d071b into develop Apr 7, 2026
@perdy perdy deleted the feat/mcp-support branch April 7, 2026 19:01
@perdy perdy linked an issue Apr 16, 2026 that may be closed by this pull request
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.

Support for MCP

2 participants