内容
# llm-tools-mcp
[](https://pypi.org/project/llm-tools-mcp/)
[](https://github.com/rectalogic/llm-tools-mcp/releases)
[](https://github.com/rectalogic/llm-tools-mcp/actions/workflows/test.yml)
[](https://github.com/rectalogic/llm-tools-mcp/blob/main/LICENSE)
MCP工具支持
## 使用方法
要与[LLM命令行工具](https://llm.datasette.io/en/stable/usage.html)一起使用:
```bash
$ echo "The magic word is frumble" > magic.txt
$ uv run llm --tool 'MCP(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "."])' "What is the magic word in the file ./magic.txt?" --tools-debug
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/Users/aw/Projects/rectalogic/llm-tools-mcp' ]
Tool call: read_file({'path': './magic.txt'})
"CallToolResult(meta=None, content=[TextContent(type='text', text='The magic word is frumble\\n', annotations=None)], isError=False)"
The magic word in the file `magic.txt` is **frumble**.
```
使用[LLM Python API](https://llm.datasette.io/en/stable/python-api.html):
```python
import llm
from llm_tools_mcp import MCP
model = llm.get_model("gpt-4.1-mini")
result = model.chain(
"Example prompt goes here",
tools=[MCP(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "."])]
).text()
```
## 开发
要在本地设置此插件,首先检出代码。然后创建一个新的虚拟环境:
```bash
cd llm-tools-mcp
uv sync
```
要运行测试:
```bash
uv run pytest
```