mcp-server-llmling

MCP.Pizza Chef: phil65

mcp-server-llmling is an MCP server implementation that uses the LLMling backend to provide structured, real-time context to large language models. It acts as a lightweight adapter, exposing data and functionality in a model-readable format, enabling advanced AI workflows and multi-step reasoning. This server facilitates secure, scoped, and observable interactions between LLMs and their environment, supporting diverse applications such as IDEs, terminals, and web apps. It is designed for developers building AI-enhanced tools and agents, ensuring smooth integration with various LLM providers and platforms.

Use This MCP server To

Expose structured data to LLMs for enhanced context understanding Enable real-time AI interaction in IDEs and terminals Facilitate multi-step reasoning with external data sources Integrate LLMling backend into MCP workflows Provide secure and observable model environment access

README

mcp-server-llmling

PyPI License Package status Daily downloads Weekly downloads Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Discussions Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this week Github commits this month Github commits this year Package status Code style: black PyUp

Read the documentation!

LLMling Server Manual

Overview

mcp-server-llmling is a server for the Machine Chat Protocol (MCP) that provides a YAML-based configuration system for LLM applications.

LLMLing, the backend, provides a YAML-based configuration system for LLM applications. It allows to set up custom MCP servers serving content defined in YAML files.

  • Static Declaration: Define your LLM's environment in YAML - no code required
  • MCP Protocol: Built on the Machine Chat Protocol (MCP) for standardized LLM interaction
  • Component Types:
    • Resources: Content providers (files, text, CLI output, etc.)
    • Prompts: Message templates with arguments
    • Tools: Python functions callable by the LLM

The YAML configuration creates a complete environment that provides the LLM with:

  • Access to content via resources
  • Structured prompts for consistent interaction
  • Tools for extending capabilities

Key Features

1. Resource Management

  • Load and manage different types of resources:
    • Text files (PathResource)
    • Raw text content (TextResource)
    • CLI command output (CLIResource)
    • Python source code (SourceResource)
    • Python callable results (CallableResource)
    • Images (ImageResource)
  • Support for resource watching/hot-reload
  • Resource processing pipelines
  • URI-based resource access

2. Tool System

  • Register and execute Python functions as LLM tools
  • Support for OpenAPI-based tools
  • Entry point-based tool discovery
  • Tool validation and parameter checking
  • Structured tool responses

3. Prompt Management

  • Static prompts with template support
  • Dynamic prompts from Python functions
  • File-based prompts
  • Prompt argument validation
  • Completion suggestions for prompt arguments

4. Multiple Transport Options

  • Stdio-based communication (default)
  • Server-Sent Events (SSE) for web clients
  • Support for custom transport implementations

Usage

With Zed Editor

Add LLMLing as a context server in your settings.json:

{
  "context_servers": {
    "llmling": {
      "command": {
        "env": {},
        "label": "llmling",
        "path": "uvx",
        "args": [
          "mcp-server-llmling",
          "start",
          "path/to/your/config.yml"
        ]
      },
      "settings": {}
    }
  }
}

With Claude Desktop

Configure LLMLing in your claude_desktop_config.json:

{
  "mcpServers": {
    "llmling": {
      "command": "uvx",
      "args": [
        "mcp-server-llmling",
        "start",
        "path/to/your/config.yml"
      ],
      "env": {}
    }
  }
}

Manual Server Start

Start the server directly from command line:

# Latest version
uvx mcp-server-llmling@latest

1. Programmatic usage

from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer

async def main() -> None:
    async with RuntimeConfig.open(config) as runtime:
        server = LLMLingServer(runtime, enable_injection=True)
        await server.start()

asyncio.run(main())

2. Using Custom Transport

from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer

async def main() -> None:
    async with RuntimeConfig.open(config) as runtime:
        server = LLMLingServer(
            config,
            transport="sse",
            transport_options={
                "host": "localhost",
                "port": 8000,
                "cors_origins": ["http://localhost:3000"]
            }
        )
        await server.start()

asyncio.run(main())

3. Resource Configuration

resources:
  python_code:
    type: path
    path: "./src/**/*.py"
    watch:
      enabled: true
      patterns:
        - "*.py"
        - "!**/__pycache__/**"

  api_docs:
    type: text
    content: |
      API Documentation
      ================
      ...

4. Tool Configuration

tools:
  analyze_code:
    import_path: "mymodule.tools.analyze_code"
    description: "Analyze Python code structure"

toolsets:
  api:
    type: openapi
    spec: "https://api.example.com/openapi.json"
    namespace: "api"

Server Configuration

The server is configured through a YAML file with the following sections:

global_settings:
  timeout: 30
  max_retries: 3
  log_level: "INFO"
  requirements: []
  pip_index_url: null
  extra_paths: []

resources:
  # Resource definitions...

tools:
  # Tool definitions...

toolsets:
  # Toolset definitions...

prompts:
  # Prompt definitions...

MCP Protocol

The server implements the MCP protocol which supports:

  1. Resource Operations

    • List available resources
    • Read resource content
    • Watch for resource changes
  2. Tool Operations

    • List available tools
    • Execute tools with parameters
    • Get tool schemas
  3. Prompt Operations

    • List available prompts
    • Get formatted prompts
    • Get completions for prompt arguments
  4. Notifications

    • Resource changes
    • Tool/prompt list updates
    • Progress updates
    • Log messages

mcp-server-llmling FAQ

How do I install mcp-server-llmling?
You can install mcp-server-llmling via PyPI using pip: `pip install mcp-server-llmling`.
What programming language is mcp-server-llmling written in?
mcp-server-llmling is implemented in Python, making it easy to integrate with Python-based projects.
Can mcp-server-llmling work with multiple LLM providers?
Yes, it supports integration with various LLM providers including OpenAI, Anthropic Claude, and Google Gemini.
How does mcp-server-llmling ensure secure model interactions?
It follows MCP principles for scoped and observable interactions, limiting model access to authorized data and actions.
Is mcp-server-llmling suitable for production environments?
Yes, it is designed to be lightweight and robust, suitable for both development and production use.
Where can I find documentation for mcp-server-llmling?
Documentation is available on its GitHub repository and PyPI page, providing usage instructions and API details.
Does mcp-server-llmling support real-time data updates?
Yes, it can expose dynamic data sources to LLMs, enabling real-time context updates during model interaction.
How do I contribute to mcp-server-llmling?
Contributions are welcome via GitHub; you can fork the repo, make changes, and submit pull requests.