Logo vun Dive MCP Host

Dive MCP Host

Organisatioun
OpenAgentPlatform

A production-grade Python host for the Model Context Protocol — multi-LLM, multi-transport, spec-compliant.

EditeurOpenAgentPlatform
Repositorydive-mcp-host
SproochPython
Forks
18
Stären
48
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    Dive MCP Host stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    48 Stären an 18 Forks aus dem verlinkte Repository.

🌊 Dive MCP Host

A production-grade Python host for the Model Context Protocol — multi-LLM, multi-transport, spec-compliant.

Python 3.12+ License: MIT MCP Spec LangGraph

The Python brain behind the Dive desktop app — also runnable standalone as a service or library.


✨ Why Dive MCP Host?

The MCP ecosystem is growing fast, but most hosts are tightly coupled to a single LLM, a single transport, or a single front-end. Dive MCP Host is the opposite: a transport-agnostic, model-agnostic runtime that turns any collection of MCP servers into a single agent backend.

  • 🧠 Any LLM — OpenAI, Anthropic, Google, AWS Bedrock, Mistral, DeepSeek, Ollama, Azure OpenAI — anything LangChain speaks.
  • 🔌 Any MCP server — stdio, sse, streamable-http, websocket, plus a "spawn-and-connect" local-HTTP mode.
  • 🛰 Three ways to use it — embed the SDK, talk to the HTTP API, or drive it from the CLI.
  • 🧩 Spec-compliant capability negotiation — calls tools/list / prompts/list only when the server advertises them; gracefully tolerates Method not found.
  • 💬 MCP prompts as first-class — list, fetch, render, and refresh on notifications/prompts/list_changed.
  • 🔐 OAuth + elicitation built in — interactive flows surface to the host without bespoke glue per server.
  • 🗃 Persistent threads — SQLite or Postgres checkpointing via LangGraph; messages, OAuth tokens, and conversation state survive restarts.

🏗 Architecture at a Glance

The same DiveMcpHost core is reused by all three entry points. The HTTP layer is a thin FastAPI wrapper; the CLI and SDK are even thinner.

Lifecycle

Everything is an async context manager (ContextProtocol). Resources nest strictly so cleanup is deterministic:


🚀 Quick Start

Install

bash
# Recommended: uv (respects uv.lock)
uv sync --frozen

# Or with pip
pip install -e .

# With dev tools (pytest, ruff, …)
uv sync --extra dev --frozen

Requires Python 3.12+.

Run the HTTP service

bash
dive_httpd

Serves on 0.0.0.0:61990 by default. Configure via dive_httpd.json (DB, checkpointer, CORS).

Try the CLI

bash
dive_cli "Summarize today's news"
dive_cli -c CHAT_ID "and what about tech?"   # resume a thread

Embed in Python

python
from dive_mcp_host.host.host import DiveMcpHost
from dive_mcp_host.host.conf import HostConfig

config = HostConfig(...)  # see model_config.json / mcp_config.json samples

async with DiveMcpHost(config) as host:
    async with host.chat(chat_id="demo") as chat:
        async for event in chat.query("hello"):
            print(event)

⚙️ Configuration

Three JSON files drive the service. Samples are at the repo root.

json
{
  "mcpServers": {
    "fetch": {
      "transport": "stdio",
      "command": "uvx",
      "args": ["mcp-server-fetch@latest"]
    },
    "weather": {
      "transport": "streamable",
      "url": "https://example.com/mcp"
    }
  }
}

Supported transport values: stdio, sse, streamable, websocket. Add "command" together with "url" to spawn a local HTTP MCP server and connect to it.

json
{
  "activeProvider": "ollama",
  "configs": {
    "openai":     { "modelProvider": "openai",    "model": "gpt-4o-mini", "apiKey": "..." },
    "anthropic":  { "modelProvider": "anthropic", "model": "claude-sonnet-4-5" },
    "ollama":     { "modelProvider": "ollama",    "model": "qwen2.5:14b",
                    "configuration": { "baseURL": "http://localhost:11434" } }
  }
}
json
{
  "db":           { "uri": "sqlite:///db.sqlite", "async_uri": "sqlite+aiosqlite:///db.sqlite", "migrate": true },
  "checkpointer": { "uri": "sqlite:///db.sqlite" },
  "cors_origin":  "http://localhost:5173"
}

🧩 MCP Capability Support

Dive negotiates capabilities per the MCP spec: each server's initialize response is inspected, and only the advertised endpoints are queried. This protects you from the entire class of "host crashes because server doesn't implement X" bugs.

CapabilityBehavior
tools 🔧Listed at startup, exposed to the LLM, dispatched via call_tool.
prompts 💬Listed at startup, cached, refreshed on notifications/prompts/list_changed. Surfaced via McpServerInfo.prompts and the /api/tools response.
resources 📦Discovery wired up; expose as needed by your front-end.
OAuth 🔐Full authorization-code + dynamic-client-registration flow with persistent token store.
Elicitation 🗨Server-initiated prompts surface to the front-end via the elicitation manager.
Method not found ⚠️Treated as "server doesn't support that"; never breaks initialization.

Prompts HTTP API

http
GET  /api/tools/{server}/prompts          # list (?refresh=true bypasses cache)
POST /api/tools/{server}/prompts/get      # body: {"name": "...", "arguments": {...}}

Both endpoints return the repo-standard DataResult[T] envelope ({success, message, data}); data is the list of prompts or the rendered GetPromptResult (description + ordered PromptMessages) ready to append to a chat thread.


🔭 HTTP API Map

PrefixPurpose
/api/chatStreaming chat, message history
/api/v1/mcpRemote MCP-style endpoints (re-mount of /api/chat)
/api/toolsServer inventory, prompts, OAuth, elicitation, log stream
/api/configHot-reload MCP and model config
/api/skillsMarkdown-defined skills (with frontmatter)
/v1/openaiOpenAI-compatible chat completion endpoint
/model_verifyOne-shot credential check for an LLM provider

🧪 Development

bash
# Install dev deps
uv sync --extra dev --frozen

# (Optional) local Postgres for tests/dev
./scripts/run_pg.sh

# Run the full suite
pytest

# Single test
pytest tests/test_tools.py::test_mcp_server_info

# Integration tests only
pytest -m integration

# Lint & format (ruff is the only tool you need)
ruff check .
ruff format .

# DB migrations
alembic upgrade head
alembic revision --autogenerate -m "describe change"

Without activating the venv:

bash
uv run --extra dev --frozen pytest

🤝 Contributing

This repo is the Python backend of the Dive desktop app. PRs that change wire formats must stay backwards-compatible with shipped Dive builds — favor additive fields and new endpoints over breaking existing ones.

📜 License

MIT — see LICENSE.

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "openagentplatform-dive-mcp-host": {
      "command": "",
      "args": []
    }
  }
}

Dive MCP Host MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal Dive MCP Host verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

Dive MCP Host als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu Dive MCP Host an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "openagentplatform-dive-mcp-host": {
      "command": "npx",
      "args": [
        "-y",
        "dive-mcp-host"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu Dive MCP Host. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu Dive MCP Host.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat Dive MCP Host?
Dive MCP Host
Jo. Ech hunn et gelies.
Dat hunn ech mat Dive MCP Host fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server Dive MCP Host benotzt?

Dive MCP Host ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech Dive MCP Host MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir Dive MCP Host mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat Dive MCP Host MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann Dive MCP Host verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech Dive MCP Host MCP mat TypingMind?

Dive MCP Host leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt Dive MCP Host MCP an TypingMind zur Verfügung?

Dive MCP Host stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir Dive MCP Host MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann Dive MCP Host eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇