What is MCP?
MCP is a standard protocol for connecting AI applications to external data sources and tools. It enables:- Unified Tool Interface: Access diverse tools through a single protocol
- External Tool Servers: Connect to specialized services (filesystem, git, databases, etc.)
- Ecosystem Integration: Use tools from the growing MCP ecosystem
- Flexible Transport: Support for StdIO, SSE, and HTTP transports
Transport Types
AgentScope supports three MCP transport mechanisms:Quick Start
1. Connect to MCP Server
2. Register MCP Tools
3. Configure MCP in Agent
Transport Configuration
StdIO Transport
For local process communication:SSE Transport
For HTTP Server-Sent Events:HTTP Transport
For stateless HTTP:Tool Filtering
Control which MCP tools to register:Enable Specific Tools
Disable Specific Tools
Both Enable and Disable
Tool Groups
Assign MCP tools to a group for selective activation:Configuration Options
Timeouts
HTTP Headers
Query Parameters
Add URL query parameters for HTTP transports:Note: Query parameters and HTTP headers only apply to HTTP transports (SSE and HTTP). They are silently ignored for StdIO transport.
Synchronous vs Asynchronous Clients
elicitation support
The elicitation feature in MCP enables interactive information collection during the invocation of MCP server-side tools. Asynchronous client exampleManaging MCP Clients
Protocol Version Configuration
By default, the MCP client only supports protocol version2024-11-05. If the MCP server responds with a different protocol version during initialization (e.g., 2025-03-26), the connection will fail with “Unsupported protocol version”.
Use protocolVersions() to declare support for additional protocol versions:
Note: This is useful when connecting to third-party MCP servers that may use newer protocol versions. The MCP specification defines protocol version negotiation as a client-server handshake where the server may respond with a different version than the client requested.
List Tools from MCP Server
Remove MCP Client
Higress AI Gateway Integration
AgentScope provides a Higress AI Gateway extension that enables unified access to MCP tools through the Higress gateway, with semantic search capabilities to automatically select the most suitable tools.Add Dependency
Basic Usage
Enable Semantic Tool Search
Use thetoolSearch() method to enable semantic search. Higress will automatically select the most relevant tools for your query:
Higress Example
See the complete Higress example:agentscope-examples/documentation/quickstart/src/main/java/io/agentscope/examples/quickstart/HigressToolExample.java
Complete Example
See the complete MCP example:agentscope-examples/documentation/quickstart/src/main/java/io/agentscope/examples/quickstart/McpToolExample.java