mcp_llm 2.0.1 copy "mcp_llm: ^2.0.1" to clipboard
mcp_llm: ^2.0.1 copied to clipboard

Dart package for Large Language Model integration with Model Context Protocol (MCP). Multi-provider LLM access (Claude / OpenAI / Gemini / Vertex / Bedrock / Cohere / Mistral / Groq / Together / Custo [...]

MCP LLM #

A comprehensive Dart package for integrating Large Language Models (LLMs) with the Model Context Protocol. Provides multi-provider LLM access, MCP client/server orchestration, and Contract Layer adapters for the mcp_bundle ecosystem.

Features #

LLM Providers #

Text/chat:

  • Claude (Anthropic)
  • OpenAI
  • Gemini (Google)
  • Vertex AI
  • Bedrock (AWS)
  • Cohere
  • Mistral
  • Groq
  • Together
  • Custom (build your own)

Cloud capability providers:

  • Vision — Google Cloud Vision, OpenAI GPT-4 Vision
  • ASR — OpenAI Whisper, Google Cloud Speech-to-Text
  • OCR — Google Cloud Vision OCR, AWS Textract
  • Binary storage — AWS S3, Google Cloud Storage

MCP Integration #

  • Multi-client and multi-server management
  • Service routing, balancing, and pooling
  • MCP spec compliance across revisions 2024-11-05 / 2025-03-26 / 2025-06-18 / 2025-11-25, with per-version capability gating
  • OAuth 2.1 authentication
  • Health monitoring, capability management, lifecycle control, and enhanced error handling
  • Deferred Tool Loading (60–80% token reduction)
  • Multi-round tool calling
  • Resource Tool Bridge (mcp_read_resource, mcp_list_resources)

Contract Layer Adapters #

Implement mcp_bundle ports so mcp_skill, mcp_profile, mcp_knowledge, and mcp_knowledge_ops can plug mcp_llm providers in directly:

  • LlmPortAdapter
  • AsrPortAdapter
  • OcrPortAdapter
  • VisionPortAdapter
  • StoragePortAdapter

Other #

  • Plugin system (custom tools and prompt templates)
  • RAG with document store and vector search (Pinecone, Weaviate)
  • Parallel processing and aggregation
  • Unified logging via Dart logging package

Quick Start #

import 'package:mcp_llm/mcp_llm.dart';

final provider = ClaudeProvider();
await provider.initialize(LlmConfiguration(apiKey: 'your-api-key'));

final response = await provider.complete(LlmRequest(
  messages: [LlmMessage.user('Hello!')],
));
print(response.text);

Multi-Client Management #

final manager = LlmClientManager();
await manager.registerClient('claude', ClaudeProvider(), config);
await manager.registerClient('openai', OpenAiProvider(), config);

final response = await manager.complete(
  clientId: 'claude',
  request: LlmRequest(messages: [LlmMessage.user('Hi')]),
);

Contract Layer Usage #

Bridge any mcp_llm provider to a bundle.LlmPort consumed by knowledge packages:

import 'package:mcp_llm/mcp_llm.dart';
import 'package:mcp_bundle/ports.dart' as bundle;

final provider = ClaudeProvider();
await provider.initialize(LlmConfiguration(apiKey: 'your-key'));

final bundle.LlmPort llmPort = LlmPortAdapter(provider);
// Pass llmPort into mcp_skill / mcp_profile / mcp_knowledge runtimes.

Examples #

  • example/simple_test_example.dart — minimal LlmClient + mock MCP client usage
  • example/logging_example.dart — unified logging via the Dart logging package

Support #

License #

MIT — see LICENSE.

8
likes
0
points
545
downloads

Publisher

unverified uploader

Weekly Downloads

Dart package for Large Language Model integration with Model Context Protocol (MCP). Multi-provider LLM access (Claude / OpenAI / Gemini / Vertex / Bedrock / Cohere / Mistral / Groq / Together / Custom), MCP client + server orchestration, and Contract Layer adapters for the mcp_bundle ecosystem. Compatible with MCP spec 2024-11-05 / 2025-03-26 / 2025-06-18 / 2025-11-25.

Homepage
Repository (GitHub)
View/report issues

Topics

#llm #mcp #ai #dart #flutter

License

unknown (license)

Dependencies

collection, crypto, http, json_annotation, logging, mcp_bundle, path, sqlite3, uuid

More

Packages that depend on mcp_llm