Background Description
Currently, llama-server has no knowledge about tools or MCP, all the logic is implemented on webui client side. This introduce a lot of duplicated code if we want to also support MCP and tools on llama-cli
The plan is to allow user to use built-in tools and MCP tools from llama-cli by having a mcp.json file
Possible Refactor Approaches
Tool registry will allow having 2 types of tools:
- Built-in tools, served in OAI-compat schema
- MCP tools: this will reflect just the server URL, NOT a list of tools from that server. The client will be responsible for extracting tools from this server (on webui, we already had this logic; on CLI, we will need to implement this logic)
For MCP tools, we support both streaming HTTP and stdio protocols, using http://, https:// and stdio:// protocols respectively
Client call POST /tools to effectively "proxy" the request to the destination MCP server/stdio
Example of a list returned from GET /tools:
read_file: built-in tool
edit_file: built-in tool
list_files: built-in tool
huggingface-mcp: MCP server
python-interpreter: MCP stdio
Background Description
Currently,
llama-serverhas no knowledge about tools or MCP, all the logic is implemented on webui client side. This introduce a lot of duplicated code if we want to also support MCP and tools onllama-cliThe plan is to allow user to use built-in tools and MCP tools from
llama-cliby having amcp.jsonfilePossible Refactor Approaches
Tool registry will allow having 2 types of tools:
For MCP tools, we support both streaming HTTP and stdio protocols, using
http://,https://andstdio://protocols respectivelyClient call
POST /toolsto effectively "proxy" the request to the destination MCP server/stdioExample of a list returned from
GET /tools:read_file: built-in tooledit_file: built-in toollist_files: built-in toolhuggingface-mcp: MCP serverpython-interpreter: MCP stdio