DS DevShelfHub Projects · AI tools
Tutorials / CrewAI / Reference / Classes / MCPServerHTTP
Class mcp

MCPServerHTTP: Reference Guide

By DevShelfHub

Connect to a remote MCP server over streamable HTTP — the modern remote transport.

See the CrewAI API reference index, CrewAI introduction, and core concepts for surrounding context.

What is MCPServerHTTP?

MCPServerHTTP speaks MCP over streamable HTTP, which is the direction the ecosystem is converging for hosted integrations. You get familiar TLS termination, standard load balancers, and room for auth headers or mutual TLS without inventing a custom framing layer. That makes it the default choice for SaaS MCP marketplaces, partner APIs, and anything running outside the process tree of your crew.

Operationally, treat the URL like a dependency on an internal microservice: pin versions, monitor error rates, and configure retries at the HTTP client layer where CrewAI exposes hooks. Combine the transport with MCPServerAdapter filters so agents only see vetted tools — remote servers frequently advertise powerful primitives such as shell or filesystem access.

Local iteration remains smoother with MCPServerStdio because you avoid TLS and DNS entirely. Swap transports behind the same adapter code so dev uses stdio and prod uses HTTP without rewriting agent definitions.

When to Use

Production hosted MCP servers.

Use Cases

  • Production remote MCP
  • Cloud MCP services

Key Features

  • Streamable HTTP
  • Auth-friendly

When NOT to Use

Local development — stdio is simpler.

Notes

Token rotation

If JWTs expire mid-kickoff, cache a refresher or rebuild the server object before long multi-step runs. Failures surface as generic tool errors unless you log HTTP status bodies carefully.

Latency vs stdio

Each tool call pays RTT to the remote host. Coalesce operations server-side when possible instead of issuing dozens of tiny MCP round trips from the agent loop.

Schema drift

Remote vendors version tool schemas independently. Pin server releases in config and run smoke tests on deploy because silent field renames break structured tool args.

Import

python
from crewai.mcp import MCPServerHTTP

Key Parameters

Parameter Type Default Purpose
url str HTTP endpoint URL.

Code Examples

Hosted endpoint

python
from crewai.mcp import MCPServerHTTP

server = MCPServerHTTP(url='https://mcp.vendor.example/v1/stream')

Bearer auth

python
server = MCPServerHTTP(
    url='https://mcp.vendor.example/v1/stream',
    headers={'Authorization': 'Bearer ' + os.environ['MCP_JWT']},
)

Adapter + static filter

python
from crewai.mcp.filters import create_static_tool_filter
from crewai_tools import MCPServerAdapter

adapter = MCPServerAdapter(server=MCPServerHTTP(url='https://mcp.example.com'))
adapter = adapter.with_filter(create_static_tool_filter(['search_docs', 'create_ticket']))

Common Mistakes

❌ Mounting an unfiltered HTTP MCP in a multi-tenant agent

✅ Always pair remote transports with explicit allowlists and human review for destructive tools.

MCPServerHTTP FAQ

What is MCPServerHTTP in CrewAI?

Connect to a remote MCP server over streamable HTTP — the modern remote transport. MCPServerHTTP speaks MCP over streamable HTTP, which is the direction the ecosystem is converging for hosted integrations. You get familiar TLS termination, standard load balancers, and room for auth headers or mutual TLS without inventing a custom framing layer. That makes it the default choice for SaaS MCP marketplaces, partner APIs, and anything running outside the process tree of your crew. Operationally, treat the URL like a dependency on an internal microservice: pin v…

Which package defines the CrewAI class MCPServerHTTP?

DevShelfHub maps MCPServerHTTP to Python module crewai.mcp (package path crewai.mcp in this reference). Pin your installed crewai version and match imports to the snippet on this page.

When should I use MCPServerHTTP?

Production hosted MCP servers.

When should I avoid using MCPServerHTTP?

Local development — stdio is simpler.

How do I import MCPServerHTTP in Python?

from crewai.mcp import MCPServerHTTP

Where can I explore more CrewAI API reference pages?

Open the CrewAI API reference index on DevShelfHub to search 58 classes, 30 methods, and 16 decorators, each with runnable examples, parameters, common mistakes, and cross-links.