Repository navigation
Fix/mcp server tools - #122
Conversation
- improved listing tools to correctly pick up if there are running servers and if the model has been downloaded
- added tool to download models
- add support for optional params in server creation (mostly useful for Anaconda Desktop backend)
| from mcp.server.fastmcp import FastMCP | ||
| except ImportError: | ||
| raise ImportError( | ||
| "MCP server requires the mcp package. Install with: pip install 'anaconda-ai[mcp]'" |
There was a problem hiding this comment.
Outside of the scope of the PR, but should we consider replacing pip install with conda install :)
|
|
||
|
|
||
| @mcp.tool() | ||
| def download_model( |
There was a problem hiding this comment.
A good candidate for long-running tasks once the clients start supporting it
| if opts is None: | ||
| opts = {} |
There was a problem hiding this comment.
nitpick: I might be missing something, but perhaps you could eliminate this check if, instead, you do something like:
opts: dict[str, Any] = extra_options.copy() if extra_options else {}| model_name, extra_options, anaconda_client | ||
| ) | ||
| self._client = openai_client | ||
| object.__setattr__(self, "_client", openai_client) |
There was a problem hiding this comment.
what is setattr needed for?
There was a problem hiding this comment.
In the upstream OpenAIChatModel class .client and ._client are implemented as readonly @property mypy complains when I tried to assign the the attribute. Maybe an ignore would be better?
| Optionally pass backend/site. If name is provided it may be used as server name (backend-dependent). | ||
| Downloads the model if needed, then starts the server. Returns server_id, model, status, openai_url. | ||
|
|
||
| extra_options: Optional dict of server configuration. The AI Navigator backend supports |
There was a problem hiding this comment.
We should probably audit the use of AI Navigator and replace all instances with Anaconda Desktop
There was a problem hiding this comment.
i'm getting telemetry working quite soon and we'll be able to get this information