MCP Server Tool
The MCP Server tool enables agents to connect to remote Model Context Protocol (MCP) servers, extending their capabilities with external services, tools, and data sources through a standardized protocol.
This tool has Preview status, meaning it’s nearly ready for production with potential minor adjustments based on user feedback.
Overview
The Model Context Protocol (MCP) is an open standard that enables seamless integration between AI agents and external tools. The MCP Server tool allows your PLai agents to:Standardized Integration
Connect to any MCP-compliant server using a unified protocol
Extended Capabilities
Access specialized tools and services beyond built-in functionality
Secure Authentication
Support for OAuth 2.0 and token-based authentication methods
Scalable Architecture
Distributed tool architecture for enterprise deployments
What is MCP?
The Model Context Protocol provides:- Standardized Communication: Consistent API for tool interactions
- Resource Management: Organized access to external resources
- Tool Discovery: Automatic discovery of available capabilities
- Security: Built-in authentication and authorization
- Extensibility: Easy addition of new tools and services
Configuration Parameters
The URL of the MCP server
Example:
Format: Must be a valid HTTPS URL
Note: HTTP URLs are not supported for security reasons
Example:
https://api.example.com/mcp
Format: Must be a valid HTTPS URL
Note: HTTP URLs are not supported for security reasons
Authentication method to use with the MCP server
Options:
Options:
oauth- OAuth 2.0 authentication flowtoken- Simple token-based authentication
OAuth Authentication Parameters
OAuth access token for authentication
Example:
Condition: Only required when
Security: Stored securely and never logged
Example:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
Condition: Only required when
auth_type is set to oauth
Security: Stored securely and never logged
Token expiry timestamp or ‘never’ for long-lived tokens
Example:
Default:
Condition: Only shown when
Format: ISO 8601 timestamp or literal
Example:
2024-12-31T23:59:59Z or never
Default:
never
Condition: Only shown when
auth_type is set to oauth
Format: ISO 8601 timestamp or literal
neverToken Authentication Parameters
API token for authentication
Example:
Condition: Only required when
Security: Stored securely and never logged
Example:
mcp_token_abc123xyz789
Condition: Only required when
auth_type is set to token
Security: Stored securely and never logged
HTTP header name for the token
Example:
Default:
Condition: Only shown when
Example:
X-API-Token, Authorization, X-MCP-Token
Default:
X-API-Token
Condition: Only shown when
auth_type is set to tokenToken prefix for the authorization header
Example:
Default:
Condition: Only shown when
Result: Header will be formatted as
Example:
Bearer, Token, MCP
Default:
Bearer
Condition: Only shown when
auth_type is set to token
Result: Header will be formatted as
{prefix} {token}Setup Instructions
1
Prepare MCP Server
Ensure you have access to an MCP-compliant server with proper credentials
2
Navigate to Tools
Go to the Tools section in your project dashboard
3
Create MCP Server Tool
Click Create Tool and select MCP Server
4
Configure Server URL
Enter the HTTPS URL of your MCP server
5
Select Authentication Method
Choose between OAuth 2.0 or token-based authentication
6
Configure Authentication
Provide the required authentication credentials based on your selected method
7
Test Connection
Use the test button to verify connectivity and authentication
8
Add to Agent
Assign this tool to your agents in agent settings
Authentication Methods
OAuth 2.0 Authentication
OAuth provides secure, token-based authentication with automatic refresh capabilities:- Configuration
- Features
- Use Cases
Token Authentication
Simple token-based authentication for straightforward API access:- Configuration
- Header Formats
- Use Cases
MCP Server Examples
Database Query Server
Connect to a database through an MCP server:- Execute SQL queries
- Retrieve table schemas
- Perform data analysis
- Generate reports
File Processing Server
Process documents and files through MCP:- PDF text extraction
- Image analysis
- Document conversion
- Metadata extraction
Business Logic Server
Access custom business logic and calculations:- Pricing calculations
- Compliance checks
- Workflow automation
- Custom validations
MCP Protocol Features
Resource Management
MCP servers can provide various types of resources:Tool Discovery
MCP servers automatically expose available tools:- Connection Establishment: Agent connects to MCP server
- Capability Discovery: Server provides list of available tools
- Tool Registration: Tools are registered with the agent
- Dynamic Invocation: Agent can call tools as needed
Error Handling
MCP protocol includes comprehensive error handling:- Connection Errors: Network and connectivity issues
- Authentication Errors: Invalid credentials or expired tokens
- Authorization Errors: Insufficient permissions
- Tool Errors: Issues with specific tool execution
- Protocol Errors: MCP-specific communication problems
Best Practices
Security
- HTTPS Only: Always use HTTPS for MCP server connections
- Token Rotation: Regularly rotate authentication tokens
- Least Privilege: Grant minimum necessary permissions
- Audit Logging: Monitor MCP server access and usage
- Network Security: Use VPNs or private networks when possible
Performance
- Caching: Cache MCP responses when appropriate
- Connection Management: Reuse connections for multiple requests
- Timeout Configuration: Set appropriate timeouts for MCP calls
- Load Balancing: Distribute requests across multiple MCP servers
- Monitoring: Track MCP server performance and availability
Development
- Testing: Use mock MCP servers for development and testing
- Documentation: Document custom MCP server capabilities
- Versioning: Version MCP server APIs for backward compatibility
- Monitoring: Implement health checks for MCP servers
- Logging: Log MCP interactions for debugging and analysis
Troubleshooting
Common Issues
Connection Refused
Connection Refused
Symptoms: Unable to connect to MCP serverSolutions:
- Verify server URL is correct and accessible
- Check network connectivity and firewall rules
- Confirm MCP server is running and healthy
- Test connection from PLai infrastructure
Authentication Failed
Authentication Failed
Symptoms: 401 or 403 errors during connectionSolutions:
- Verify authentication credentials are correct
- Check token expiry dates
- Confirm authentication method matches server expectations
- Review server-side authentication logs
Tool Not Available
Tool Not Available
Symptoms: Specific tools not appearing or failingSolutions:
- Check MCP server tool registration
- Verify tool permissions and access rights
- Review server-side tool implementation
- Test tool functionality directly on server
Slow Performance
Slow Performance
Symptoms: Long response times from MCP serverSolutions:
- Check server performance and resource usage
- Review network latency between PLai and server
- Implement caching strategies
- Optimize tool implementations on server side
Debug Mode
Enable detailed logging for troubleshooting:MCP Server Development
Creating Custom MCP Servers
If you need custom functionality, you can develop your own MCP server:- Node.js
- Python
MCP Server Requirements
- Protocol Compliance: Must implement MCP specification
- HTTPS Support: Secure communication required
- Authentication: Support OAuth or token-based auth
- Error Handling: Proper error responses and codes
- Documentation: Tool and resource documentation