LLMling MCP server

Provides a YAML-based configuration system for LLM applications, enabling declarative setup of custom environments with resource management, tool execution, and prompt handling capabilities.
Back to servers
Setup instructions
Provider
Philipp Temminghoff
Release date
Dec 05, 2024
Language
Python
Package
Stats
7.7K downloads
5 stars

mcp-server-llmling is a server implementation for the Machine Chat Protocol (MCP) that provides a YAML-based configuration system for LLM applications. It allows you to define resources, tools, and prompts that LLMs can interact with, all without writing code - just configuration in YAML.

Installation

You can install and run the mcp-server-llmling using several methods:

Using uvx (Recommended)

The easiest way to run the latest version:

# Run the latest version
uvx mcp-server-llmling@latest

# Run with a specific configuration file
uvx mcp-server-llmling start path/to/your/config.yml

Using pip

You can install the package with pip:

pip install mcp-server-llmling

Then run it:

mcp-server-llmling start path/to/your/config.yml

Server Configuration

The server is configured through a YAML file with several main sections:

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

resources:
  # Resource definitions go here
  
tools:
  # Tool definitions go here

toolsets:
  # Toolset definitions go here

prompts:
  # Prompt definitions go here

Resource Configuration

Resources provide content that LLMs can access:

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

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

Tool Configuration

Tools are Python functions that LLMs can execute:

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"

Integrating with Editors and Applications

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": {}
    }
  }
}

Programmatic Usage

Basic Setup

from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer
import asyncio

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

asyncio.run(main())

Using Custom Transport

from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer
import asyncio

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

asyncio.run(main())

Key Features

Resource Management

The server supports various resource types:

  • Text files (PathResource)
  • Raw text content (TextResource)
  • CLI command output (CLIResource)
  • Python source code (SourceResource)
  • Python callable results (CallableResource)
  • Images (ImageResource)

Resources can be configured to automatically update when their sources change (hot-reload).

Tool System

Tools extend LLM capabilities by providing access to Python functions:

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

Prompt Management

Prompts provide templated interactions:

  • Static prompts with template support
  • Dynamic prompts from Python functions
  • File-based prompts
  • Prompt argument validation

Multiple Transport Options

The server supports multiple communication methods:

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

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later