Skip to main content

Overview

MCP (Model Context Protocol) Tools enable integration with MCP servers for extended functionality. These tools allow you to connect to both local and remote MCP servers, discover available tools, and execute them with custom inputs using the Python SDK.

Key Features

MCP_LOCAL_RUN

  • Connect to local MCP servers
  • Execute tools on your local environment
  • Direct Python SDK integration
  • Real-time tool discovery and execution

MCP_REMOTE_RUN

  • Connect to remote MCP servers via HTTP
  • Streamable HTTP connections
  • Cloud-based tool execution
  • Scalable remote processing

Authentication

MCP tools may require authentication depending on the server configuration. Check with your MCP server administrator for specific requirements.

Example: Local MCP Server Integration

Example: Remote MCP Service Integration

Example: Multi-Tool MCP Workflow

Example: Custom MCP Tool Development

MCP Server Configuration

Local Server Setup

Remote Server Setup

Tool Discovery

List Available Tools

Get Tool Schema

Error Handling

Common Error Types

  • Connection errors: Server unreachable or authentication failed
  • Tool not found: Specified tool doesn’t exist on server
  • Input validation: Invalid inputs for tool execution
  • Timeout errors: Tool execution exceeded time limit
  • Server errors: Internal server errors during execution

Error Response Format

Use Cases

  • Data Processing: Advanced data transformation and analysis
  • Document Processing: Complex document parsing and extraction
  • AI/ML Integration: Machine learning model execution
  • Custom Workflows: Domain-specific business logic execution
  • External API Integration: Wrapper for external services
  • Batch Processing: Large-scale data processing operations
  • Specialized Tools: Industry-specific processing tools
  • Research Tools: Academic and scientific computing tools

Best Practices

Performance Optimization

  • Use local servers for frequent operations
  • Use remote servers for compute-intensive tasks
  • Implement proper timeout handling
  • Cache tool discovery results

Security Considerations

  • Secure authentication tokens
  • Validate all inputs and outputs
  • Use HTTPS for remote connections
  • Implement proper error handling

Development Guidelines

  • Document custom MCP tools thoroughly
  • Implement proper logging and monitoring
  • Use consistent input/output schemas
  • Test tools thoroughly before deployment