Skip to content

Latest commit

 

History

History
84 lines (72 loc) · 2.93 KB

File metadata and controls

84 lines (72 loc) · 2.93 KB

How to Use MCP Server in agentUniverse

In agentUniverse, you can integrate any MCP Server and make it available as a tool/toolkit for agents by following two steps.

step1. Use MCPToolkit to Integrate MCP Server as Toolkits

The current version of MCPServer supports three communication modes: Standard Input/Output Stream (stdio), Server-Sent Events (SSE), Streamable HTTP.

Below are YAML configuration examples for each mode:

  1. Standard Input/Output Stream (stdio) Mode Example
name: 'docx_toolkit'
description: |
  这是一个docx相关的工具集
transport: 'stdio'
command: 'uvx'
args:
  - 'mcp-server-office'

metadata:
  type: 'TOOLKIT'
  module: 'agentuniverse.agent.action.toolkit.mcp_toolkit'
  class: 'MCPToolkit'
  1. SSE Mode Example
name: 'search_toolkit'
description: |
  这是一个搜索相关的工具包
transport: 'sse'
url: 'http://localhost:8000/sse'

metadata:
  type: 'TOOLKIT'
  module: 'agentuniverse.agent.action.toolkit.mcp_toolkit'
  class: 'MCPToolkit'
  1. Streamable HTTP Mode Example
name: 'weather'
transport: 'streamable_http'
url: 'http://localhost:8000/mcp'
metadata:
  type: 'TOOLKIT'
  module: 'agentuniverse.agent.action.toolkit.mcp_toolkit'
  class: 'MCPToolkit'
  • `Parameters: transport, url, command, args, env, and other parameters follow the official MCP specification definitions.

step2. Configure MCPToolkit for the Agent to Use MCP Server

After integrating the MCP service in Step 1, you can configure the agent to use the MCPToolkit by adding it to the agent's configuration file under the [actiontoolkit] property.

Here’s a agent configuration that uses the docx MCP Server from Step 1:

info:
  name: 'demo_agent_with_mcp_toolkit'
  description: 'A simple demonstration react agent designed to showcase 
  the integration and usage of mcp toolkits.'
profile:
  prompt_version: qwen_react_agent.cn
  llm_model:
    name: 'qwen3-32b'
    stop: 'Observation'
    temperature: 0.1
action:
  toolkit:
    - 'docx_toolkit'
memory:
  name: 'demo_memory'
metadata:
  type: 'AGENT'
  module: 'agentuniverse.agent.template.react_agent_template'
  class: 'ReActAgentTemplate'

Additional Resources:

For more details, consult the following documentation: MCP Toolkit Guide, MCP Tool Guide.