mirror of
https://github.com/ggozad/oterm.git
synced 2026-10-26 08:01:24 +01:00
99 lines
3.2 KiB
Markdown
99 lines
3.2 KiB
Markdown
# Model Context Protocol
|
|
|
|
`oterm` has support for Anthropic's open-source [Model Context Protocol](https://modelcontextprotocol.io). While Ollama does not yet directly support the protocol, `oterm` attempts to bridge [MCP servers](https://github.com/modelcontextprotocol/servers) with Ollama.
|
|
|
|
To add an MCP server to `oterm`, simply add the server shim to oterm's [config.json](../app_config.md). The following MCP transports are supported
|
|
|
|
### Supported MCP Features
|
|
#### Tools
|
|
By transforming [MCP tools](https://modelcontextprotocol.io/docs/concepts/tools) into Ollama tools `oterm` provides full support.
|
|
|
|
!!! note
|
|
Not all models are equipped to support tools. For those models that do not, the tool selection will be disabled.
|
|
|
|
A lot of the smaller LLMs are not as capable with tools as larger ones you might be used to. If you experience issues with tools, try reducing the number of tools you attach to a chat, increase the context size, or use a larger LLM.
|
|
|
|
|
|

|
|
oterm using the `git` MCP server to access its own repo.
|
|
|
|
#### Prompts
|
|
`oterm` supports [MCP prompts](https://modelcontextprotocol.io/docs/concepts/prompts). Use the "Use MCP prompt" command to invoke a form with the prompt. Submitting will insert the prompt messages into the chat.
|
|
|
|

|
|
oterm displaying a test MCP prompt.
|
|
|
|
#### Sampling
|
|
`oterm` supports [MCP sampling](https://modelcontextprotocol.io/docs/concepts/sampling), acting as a geteway between Ollama and the servers it connects to. This way, an MCP server can request `oterm` to run a *completion* and even declare its model preferences and parameters!
|
|
|
|
### Transports
|
|
#### `stdio` transport
|
|
|
|
Used for running local MCP servers, the configuration supports the `command`, `args`, `env` & `cwd` parameters. For example for the [git](https://github.com/modelcontextprotocol/servers/tree/main/src/git) MCP server you would add something like the following to the `mcpServers` section of the `oterm` [configuration file](../app_config.md):
|
|
|
|
```json
|
|
{
|
|
...
|
|
"mcpServers": {
|
|
"git": {
|
|
"command": "docker",
|
|
"args": [
|
|
"run",
|
|
"--rm",
|
|
"-i",
|
|
"--mount",
|
|
"type=bind,src=/Users/ggozad/dev/open-source/oterm,dst=/oterm",
|
|
"mcp/git"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
#### `Streamable HTTP` transport
|
|
|
|
Typically used to connect to remote MCP servers through Streamable HTTP, the only accepted parameter is the `url` parameter (should start with `http://` or `https://`). For example,
|
|
|
|
```json
|
|
{
|
|
...
|
|
"mcpServers": {
|
|
"my_mcp": {
|
|
"url": "http://remote:port/path"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
#### `Websocket` transport
|
|
|
|
Also used to connect to remote MCP servers, but through websockets. The only accepted parameter is the `url` parameter (should start with `ws://` or `wss://`). For example,
|
|
|
|
```json
|
|
{
|
|
...
|
|
"mcpServers": {
|
|
"my_mcp": {
|
|
"url": "wss://remote:port/path"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Authentication
|
|
#### HTTP bearer authentication
|
|
|
|
`oterm` supports HTTP bearer authentication by use of tokens. Use
|
|
```json
|
|
{
|
|
...
|
|
"mcpServers": {
|
|
"my_mcp": {
|
|
"url": "http://remote:port/path",
|
|
"auth": {
|
|
"type": "bearer",
|
|
"token": "XXX"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|