ISEK icon indicating copy to clipboard operation
ISEK copied to clipboard

Feature Request: Add Support for MCP

Open SparkssL opened this issue 1 year ago • 3 comments

✨ Feature Request: Add Support for MCP (Model Context Protocol)

Description

We propose adding native support for Anthropic's Model Context Protocol (MCP) in ISEK, to standardize how agents interact with external tools, data sources, and structured contextual environments.

MCP enables agents to request, retrieve, and act upon structured context from tool APIs and external knowledge systems. Integrating MCP into ISEK will empower agents with richer decision-making capabilities, unified context access, and smoother tool orchestration.

Motivation

  • Standardized Tool Access: MCP provides a uniform interface for invoking and interacting with tools and structured APIs.
  • Enhanced Context Awareness: Agents can dynamically retrieve contextual data (e.g. documents, variables, environment) to improve task reasoning.
  • Improved Interoperability: Aligns ISEK agents with emerging standards used by other agent ecosystems (e.g., Claude).
  • Extensibility: Supporting MCP will simplify future integrations with new tools, APIs, and agent services.

Proposed Approach

  • Create a dedicated mcp_client/ module that implements MCP communication logic.
  • Define a protocol interface for MCP-compatible agent-tool interactions.
  • Add configuration flags to enable or disable MCP support per agent.
  • Allow agents to send MCP-style requests and receive standardized responses (e.g., tool results, contextual payloads).
  • Provide example usage and fallback behavior when MCP is disabled.

Scope

  • [ ] Implement mcp_client/ with envelope formatting, tool request logic, and parsing.
  • [ ] Add protocol abstraction layer for tool invocation (MCP vs native).
  • [ ] Update agent configuration to support MCP toggles and endpoints.
  • [ ] Write example agent that uses MCP to call external tools or retrieve documents.
  • [ ] Add unit tests for MCP interactions and fallback logic.

References

SparkssL avatar May 10 '25 01:05 SparkssL

Update on MCP Integration I'm currently working on integrating MCP into ISEK. This update focuses on how MCP tools (MCP server) are managed and accessed alongside functional (callable) tools.

Proposed Structure:

Agent
└── ToolBox (Tool Manager + MCP Client)
    ├── FunctionTool (Tool) 
    │   ├── tool1()
    │   └── tool2()
    └── MCPTool (Tool) 
        ├── mcp_server1
        └── mcp_server2

Components:

  • Tool (base class): Defines a standard interface for all tools, ensuring the Agent can use them interchangeably.
  • FunctionTool: Represents the existing callable tools currently used in ISEK. These are simple local Python functions wrapped to conform to the Tool interface.
  • MCPTool: Represents tools provided by remote MCP servers. These rely on an internal MCPHandler for server communication.
  • ToolBox: Acts as both:
    • A Tool Manager that aggregates and exposes all tools (local and remote) in a consistent manner.
    • An MCP Client, which internally delegates all MCP-related communication and connection management to a separate object called MCPHandler. This MCPHandler is responsible for handling the details of MCP server connections and protocol logic for all MCPTool instances.

Benefits:

  • Decouples the Agent logic from specific tool implementations.
  • Simplifies extension with new tools, whether local or remote.
  • Centralizes and encapsulates MCP server handling in a clean, testable way.

Feedback on this design and any edge cases I should consider would be appreciated

Edward9292 avatar May 23 '25 21:05 Edward9292

Thanks for sharing! The overall design is clear: the Agent just calls Tools, ToolBox manages both local FunctionTools and remote MCPTools, and MCPHandler handles all network communication.

A few notes:

Async interfaces: Make all Tools use async/await so MCPTool and FunctionTool calls are consistent.

Unique names: Ensure each tool’s name in ToolBox is unique (e.g., prefix with “fn:” vs. “mcp:”).

Error/timeout handling: MCPHandler should centralize timeouts, retries, and error reporting so the Agent can degrade gracefully under load or network issues.

SparkssL avatar Jun 01 '25 15:06 SparkssL

https://github.com/isekOS/ISEK/pull/51

SparkssL avatar Jul 02 '25 14:07 SparkssL