Overview
Welcome to the MCP (Model Context Protocol) integration guide for Julep! This integration enables you to connect Julep agents with any MCP-compatible server, providing access to a vast ecosystem of tools and capabilities. MCP is a standardized protocol that allows language models to interact with external tools and services in a consistent, secure manner. The MCP integration is unique because instead of hardcoding specific tools, it dynamically discovers available capabilities from any MCP server. This makes Julep infinitely extensible - simply point it at a new MCP server and all its tools become available to your agents automatically.Prerequisites
To use the MCP integration, you need access to an MCP-compatible server. The server can be:
- A public MCP server (e.g., DeepWiki, GitHub Copilot MCP)
- A private MCP server you’ve deployed
Supported Transports
The MCP integration supports two transport types:HTTP Transport
Standard request-response pattern for tool execution. Works with servers that expose HTTP endpoints.
SSE Transport
Server-Sent Events for streaming responses and real-time updates. Ideal for long-running operations.
How to Use the Integration
To get started with the MCP integration, you need to define two types of tools:1
Define Tool Discovery
First, create a tool that discovers available capabilities from the MCP server using the
list_tools
method.2
Define Tool Execution
Then, create a tool that executes specific MCP tools using the
call_tool
method.3
Configure Your Task
Use the discovered tools in your task workflow to interact with the MCP server.
Examples
Example 1: Basic HTTP Transport (DeepWiki)
Example 2: SSE Transport with Headers
Example 3: Authenticated MCP Server (GitHub)
YAML Configuration Explained
Basic Configuration
Basic Configuration
- name: A descriptive name for the task
- tools: Lists the MCP integration tools being used
- type: Must be
integration
for MCP tools
Integration Setup
Integration Setup
- provider: Must be
mcp
for MCP integration - method: Either
list_tools
orcall_tool
list_tools
: Discovers available tools from the MCP servercall_tool
: Executes a specific tool on the MCP server
- setup: Connection configuration
- transport: Either
http
orsse
- http_url: The MCP server endpoint URL
- http_headers: (Optional) HTTP headers for authentication or content negotiation
- transport: Either
Tool Execution Arguments
Tool Execution Arguments
For
call_tool
method:- tool_name: The name of the MCP tool to execute
- arguments: (Optional) Arguments to pass to the MCP tool
- timeout_seconds: (Optional) Per-call timeout in seconds (default: 60)
list_tools
method:- No arguments required (empty object or omit entirely)
Best Practices
Tool Discovery: Always call
list_tools
first to discover available capabilities before attempting to use specific tools. This ensures you’re aware of what tools are available and their required parameters.Authentication: Never hardcode authentication tokens in your task definitions. Use Julep’s secrets management to store sensitive credentials securely.
- Different MCP servers expose different tools. Always check the server’s documentation for available capabilities
- SSE transport is recommended for long-running operations or when you need real-time updates
- HTTP transport is simpler and works well for quick request-response operations
- Some servers may have rate limits - consider implementing retry logic in your tasks
Advanced Features
Dynamic Tool Discovery
The MCP integration’s killer feature is dynamic tool discovery. Instead of defining tools statically, your agents can:- Connect to any MCP server
- Discover available tools at runtime
- Adapt their capabilities based on what’s available
- Switch between different MCP servers without changing your code
- Add new capabilities by simply deploying new MCP servers
- Build agents that adapt to their environment
Response Handling
MCP tool responses are normalized into a consistent format:Using MCP with Automatic Tool Execution
One of the most powerful features of Julep is automatic tool execution, which works seamlessly with MCP integrations. This allows your agents to dynamically discover and use MCP tools without manual intervention.How It Works
When you combine MCP integration with Julep’sauto_run_tools
feature:
- Tool Discovery: The agent first calls
list_tools
to discover available capabilities from the MCP server - Automatic Execution: When the model determines an MCP tool is needed, it’s executed automatically
- Result Integration: Tool results are fed back to the model to continue processing
- Seamless Workflow: Everything happens in a single call - no manual intervention required
Example: Autonomous MCP Agent in Tasks
Troubleshooting
Connection Issues
Connection Issues
- Verify the MCP server URL is correct and accessible
- Check if authentication headers are required and properly formatted
- Ensure the transport type matches what the server expects
Tool Execution Failures
Tool Execution Failures
- Use
list_tools
to verify the tool exists on the server - Check the tool’s input schema for required parameters
Authentication Errors
Authentication Errors
- Ensure Bearer tokens include the “Bearer ” prefix
- Verify API keys/tokens are valid and not expired
- Check if additional headers are required
Conclusion
The MCP integration opens up unlimited possibilities for extending Julep agents with external capabilities. By following a standardized protocol, you can connect to any MCP-compatible server and instantly gain access to its tools, making your agents more powerful and adaptable.For more information about the Model Context Protocol, visit the official MCP documentation. To explore available MCP servers, check out the MCP server directory.