lmstudio-agent-mcp
Provides local agent capabilities for LM Studio including file I/O, terminal execution, and web search.
README
Agent MCP Server for LM Studio
A lightweight MCP (Model Context Protocol) server that provides local agent capabilities for LM Studio: file I/O, terminal execution, and web search.
Features
| Tool | Description |
|---|---|
agent_read_file |
Read text files with offset/limit pagination and encoding support |
agent_write_file |
Write or append to files, with optional parent directory creation |
agent_execute_command |
Execute shell commands with pipes, redirections, custom working directory, environment variables, and configurable timeout |
agent_web_search |
Search the web via DuckDuckGo (no API key required), returning titles, URLs, and snippets |
Requirements
- Python 3.10+
- Dependencies listed in
requirements.txt
Installation
cd lmstudio_agent_mcp
pip install -r requirements.txt
Usage with LM Studio
Add the following to your LM Studio MCP server configuration:
{
"mcpServers": {
"agent_mcp": {
"command": "python3",
"args": ["/absolute/path/to/lmstudio_agent_mcp/server.py"]
}
}
}
If you are using a virtual environment, replace python3 with the absolute path to your venv's Python binary (e.g. /path/to/venv/bin/python).
Usage with Other MCP Clients
The server uses stdio transport by default. Start it directly:
python3 server.py
For remote access, you can switch to streamable HTTP:
# Add to the bottom of server.py
if __name__ == "__main__":
mcp.run(transport="streamable_http", port=8000)
Tool Reference
agent_read_file
Read the contents of a text file.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
string | (required) | Absolute or relative path to the file |
offset |
int | 0 |
Number of lines to skip from the beginning |
limit |
int | null | 200 |
Maximum number of lines to return (null = unlimited) |
encoding |
string | "utf-8" |
Text encoding |
agent_write_file
Write text content to a file.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
string | (required) | Absolute or relative path to the file |
content |
string | (required) | Text content to write |
encoding |
string | "utf-8" |
Text encoding |
append |
bool | false |
If true, append instead of overwrite |
create_dirs |
bool | true |
If true, create parent directories when missing |
agent_execute_command
Execute a terminal command.
| Parameter | Type | Default | Description |
|---|---|---|---|
command |
string | (required) | Shell command to execute |
working_directory |
string | null | null |
Working directory (defaults to server cwd) |
timeout |
float | 60.0 |
Maximum execution time in seconds (1-600) |
env |
object | null | null |
Additional environment variables to set |
shell |
bool | true |
Execute through system shell (required for pipes/redirects) |
agent_web_search
Search the web via DuckDuckGo.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string | (required) | Search query (1-500 chars) |
num_results |
int | 5 |
Maximum results to return (1-20) |
region |
string | null | null |
DuckDuckGo region code (e.g. wt-wt, us-en, zh-cn) |
Security Notes
- File paths are resolved to absolute paths;
~expansion is supported - Large files (>10 MiB) are rejected to prevent memory exhaustion
- Command execution has a configurable timeout (max 600s)
- Do not expose this server to untrusted clients —
agent_execute_commandcan run arbitrary shell commands
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。