Access tools from MCP servers as LLM tools
Project description
llm-mcp-client
Access tools from MCP servers as LLM tools
Installation
Install this plugin in the same environment as LLM.
llm install llm-mcp-client
Usage
This plugin registers a toolbox called MCP which connects to an MCP server, discovers the tools it exposes and makes them available as LLM tools.
Pass the URL of an MCP server to the toolbox:
llm -T 'MCP("https://example.com/mcp")' 'Ask something that needs a tool' --td
The --td option shows details of the tool calls as they execute.
It works in llm chat too:
llm chat -T 'MCP("https://example.com/mcp")'
Protocol modes
By default the client negotiates the protocol automatically. You can force a specific mode with the mode= argument:
# Force modern stateless MCP:
llm -T 'MCP("https://example.com/mcp", mode="stateless")' '...'
# Force the legacy initialize handshake:
llm -T 'MCP("https://example.com/mcp", mode="legacy")' '...'
Tool name prefixes
If you are using tools from more than one server and their names might clash, give each server a prefix:
llm -T 'MCP("https://one.example.com/mcp", prefix="one_")' \
-T 'MCP("https://two.example.com/mcp", prefix="two_")' '...'
Python API
import llm
from llm_mcp_client import MCP
model = llm.get_model("gpt-4.1-mini")
result = model.chain(
"Ask something that needs a tool",
tools=[MCP("https://example.com/mcp")],
).text()
Tool results containing MCP image or audio content are returned to the model as LLM attachments. An MCP error result raises llm_mcp_client.MCPToolError, which LLM passes back to the model as an error message.
Development
To set up this plugin locally, first checkout the code. Then run the tests with uv:
cd llm-mcp-client
uv run pytest
To run LLM with your in-development plugin:
uv run llm --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_mcp_client-0.1a0.tar.gz.
File metadata
- Download URL: llm_mcp_client-0.1a0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1c55e7d82a662e411ab36c61576d6b67d4e54ad5879dd761e7d396a3ef58784
|
|
| MD5 |
f18db6265e7069c260d7c72c2d0f8af6
|
|
| BLAKE2b-256 |
e0eabfde7813e1b3387858f4bcb905ddd0452b8a68ba16f7a8239b720c8fdcc5
|
Provenance
The following attestation bundles were made for llm_mcp_client-0.1a0.tar.gz:
Publisher:
publish.yml on simonw/llm-mcp-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_mcp_client-0.1a0.tar.gz -
Subject digest:
f1c55e7d82a662e411ab36c61576d6b67d4e54ad5879dd761e7d396a3ef58784 - Sigstore transparency entry: 2308042300
- Sigstore integration time:
-
Permalink:
simonw/llm-mcp-client@acdfff5de5fa623e7986e04e2df5095816c6d045 -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/simonw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@acdfff5de5fa623e7986e04e2df5095816c6d045 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llm_mcp_client-0.1a0-py3-none-any.whl.
File metadata
- Download URL: llm_mcp_client-0.1a0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97fe39d4508262f48ace8e83ddb5d76269896e30e7a886391720f6ec8bfd2b59
|
|
| MD5 |
6ab7f8ec72d1af84eb9cd219d1bb7259
|
|
| BLAKE2b-256 |
e2c7c290918fbeb1dbc99d22388f05756d9f20ad1d4c17e34204ce092ae70a66
|
Provenance
The following attestation bundles were made for llm_mcp_client-0.1a0-py3-none-any.whl:
Publisher:
publish.yml on simonw/llm-mcp-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_mcp_client-0.1a0-py3-none-any.whl -
Subject digest:
97fe39d4508262f48ace8e83ddb5d76269896e30e7a886391720f6ec8bfd2b59 - Sigstore transparency entry: 2308042337
- Sigstore integration time:
-
Permalink:
simonw/llm-mcp-client@acdfff5de5fa623e7986e04e2df5095816c6d045 -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/simonw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@acdfff5de5fa623e7986e04e2df5095816c6d045 -
Trigger Event:
release
-
Statement type: