Files
agent-framework/docs/design/mcp-servers.md
T
Eric Zhu 6089446f04 Design doc draft (#5)
* wip

* wip

* wip

* wip

* wip

* wip

* Update docs/design/main.md

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>

* Update docs/design/main.md

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* update

* update

* update

* wip

* wip

* wip

* wip

* address comment

* update

* add custom agent example

* address comment

* update code teaser

* Update docs/design/main.md

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>

* update

* address comments

* update guardrails

* address some of mark's comments

* add new separate sections for agents and workflows

* update agent doc

* Update agent.md

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>

* add foundry agent doc

* wip

* refine the component registration interface with agent runtime

* update

* workflows

* update

* update

* Update

* Update

* update

* Update design doc to remove runtime

* Update

* Update

* Update

* update

* Add eval section notes (#9)

* add notes on eval

* remove duplicate title

* update docs

* update docs

* save updates before merge

* update evaluation script

* Update agents.md

* update workflows

* Update

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>

* update workflow

* Updated design doc

* Update

* Update

* update

* update

* Update

* update

* update

* Update

* update

* Update with agent abstraction alternatives

* Update discussion

* Update

* update

* Update

* Update

* Update

* Update

---------

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
2025-05-29 19:36:54 +00:00

1.8 KiB

MCP Servers

An MCP server is a component that wraps a session to an Model Context Protocol (MCP) server.

The tools provided by MCP server should match the tool interface to ensure minimal boilerplate code when dealing with both tools and MCP servers.

Other features like sampling and resources, should be accessible through the MCP server interface as well.

MCP Server base class (draft)


class MCPServer(ABC):
    """The base class for all MCP servers in the framework."""

    @abstractmethod
    async def list_tools(self, context: Context) -> list[ToolSchema]:
        """List all available tools in the MCP server.

        Returns:
            A list of tool schemas available in the MCP server.
        """
        ...

    @abstractmethod
    async def call_tool(
        self,
        call: ToolCall,
        context: Context,
    ) -> ToolResult:
        """Call a tool with the given name and arguments.

        Args:
            tool_name: The name of the tool to call.
            args: The arguments to pass to the tool.
            context: The context for the current invocation of the MCP server.

        Returns:
            The result of calling the tool.
        """
        ...
    
    def add_input_guardrails(
        self, 
        guardrails: list[InputGuardrail[ToolCall]]
    ) -> None:
        """Add input guardrails to the MCP server.

        Args:
            guardrails: The list of input guardrails to add.
        """
        ...
    
    def add_output_guardrails(
        self, 
        guardrails: list[OutputGuardrail[ToolResult]]
    ) -> None:
        """Add output guardrails to the MCP server.

        Args:
            guardrails: The list of output guardrails to add.
        """
        ...
    

MCP specs have other APIs. We should consider adding them as well.