MCP Support
Create, manage, and connect MCP servers easily to integrate dynamic tools and enhance your AI workflows with full tracing.
LangDB simplifies how you work with MCP (Model Context Protocol) servers — whether you want to use a built-in Virtual MCP or connect to an external MCP server.

Model Context Protocol (MCP) is an open standard that enables AI models to seamlessly communicate with external systems. It allows models to dynamically process contextual data, ensuring efficient, adaptive, and scalable interactions. MCP simplifies request orchestration across distributed AI systems, enhancing interoperability and context-awareness.
With native tool integrations, MCP connects AI models to APIs, databases, local files, automation tools, and remote services through a standardized protocol. Developers can effortlessly integrate MCP with IDEs, business workflows, and cloud platforms, while retaining the flexibility to switch between LLM providers. This enables the creation of intelligent, multi-modal workflows where AI securely interacts with real-world data and tools.
For more details, visit the Model Context Protocol official page and explore Anthropic MCP documentation.
Using Virtual MCPs
Using API
LangDB allows you to create Virtual MCP Servers directly from the dashboard. You can instantly select and bundle tools like database queries, search APIs, or automation tasks into a single MCP URL — no external setup needed.
Here's an example of how you can use a Virtual MCP Server in your project:
from openai import OpenAI
from uuid import uuid4
client = OpenAI(
base_url="https://api.us-east-1.langdb.ai/LangDBProjectID/v1",
api_key="xxxx",
default_headers={"x-thread-id": str(uuid4())},
)
mcpServerUrl = "Virtual MCP Server URL"
response = client.chat.completions.create(
model="openai/gpt-4.1",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What are the databases available"}
],
extra_body={
"mcp_servers": [
{
"server_url": mcpServerUrl,
"type": "sse"
}
]
}
)
Checkout Virtual MCP and Guides section for usecases.
Using MCP Clients
You can instantly connect LangDB’s Virtual MCP servers to editors like Cursor, Claude, or Windsurf.
Run this in your terminal to set up MCP in Cursor:
npx @langdb/mcp setup <server_name> <mcp_url> --client cursor
You can now call tools directly in your editor, with full tracing on LangDB.

Connecting to External MCP Servers
If you already have an MCP server hosted externally — like Smithery’s Exa MCP — you can plug it straight into LangDB with zero extra setup.
Just pass your external MCP server URL in extra_body
when you make a chat completion request. For example Smithery:
extra_body = {
"mcp_servers": [
{
"server_url": "wss://your-mcp-server.com/ws?config=your_encoded_config",
"type": "ws"
}
]
}
For a complete example of how to use external MCP, refer to the Smithery guide.
Last updated
Was this helpful?