API Reference

The MCPClient REST api is mounted at /api/v1/mcpclients/. MCPClients are created and updated by applying manifests, so the api lists, reads and deletes them, and connects to their MCP servers.

MCPClient api/v1/mcpclients views.

MCPClients are created and updated by applying manifests, with smarter apply, so these views do not create or update them. They list, read and delete MCPClients, and connect to their MCP servers:

  • GET mcpclients/: the MCPClients that the user may read.

  • GET mcpclients/<hashed_id>/: an MCPClient that the user may read.

  • DELETE mcpclients/<hashed_id>/: delete an MCPClient that the user owns.

  • GET mcpclients/<hashed_id>/tools/: the tools that the MCPClient offers the LLM, from its cached catalog. ?refresh=true reconnects to the server first.

  • POST mcpclients/<hashed_id>/refresh/: reconnect to the MCP server, and return the MCPClient’s status.

  • POST mcpclients/<hashed_id>/tools/<tool_name>/: call a tool, with the JSON request body as its arguments. Only the owner may call tools.

The responses are built from the models of smarter.apps.mcpclient.contract.models, which the Smarter api’s OpenAPI document publishes. Errors are Django REST framework’s {"detail": ...}. A failed connection to the MCP server adds the MCPClient’s connection status beside it.

Note

Experimental. The MCPClient was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental, and will be documented.

class smarter.apps.mcpclient.api.v1.views.views.MCPClientListView(*args, **kwargs)[source]

Bases: ContractListMixin, SmarterAuthenticatedListAPIView

The MCPClients that the user may read.

contract_model

alias of MCPClientApiMCPClient

get_queryset(*args, **kwargs)[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

Return type:

QuerySet

item(row)[source]

An MCPClient of the response, whose canDelete is the requesting user’s.

serializer_class

alias of MCPClientSerializer

class smarter.apps.mcpclient.api.v1.views.views.MCPClientRefreshView(*args, **kwargs)[source]

Bases: MCPClientViewBase

Reconnect to an MCPClient’s MCP server.

post(request, *args, **kwargs)[source]

Reconnect to the MCP server, and return the MCPClient’s status.

class smarter.apps.mcpclient.api.v1.views.views.MCPClientToolCallView(*args, **kwargs)[source]

Bases: MCPClientViewBase

Call one of an MCPClient’s tools.

Only the owner may call tools.

post(request, *args, **kwargs)[source]

Call the tool, with the JSON request body as its arguments.

class smarter.apps.mcpclient.api.v1.views.views.MCPClientToolsView(*args, **kwargs)[source]

Bases: MCPClientViewBase

The tools that an MCPClient offers the LLM.

get(request, *args, **kwargs)[source]

Return the MCPClient’s allowed tools, from its catalog.

class smarter.apps.mcpclient.api.v1.views.views.MCPClientView(*args, **kwargs)[source]

Bases: MCPClientViewBase

Read or delete an MCPClient.

delete(request, *args, **kwargs)[source]

Delete an MCPClient that the user owns.

get(request, *args, **kwargs)[source]

Return an MCPClient that the user may read.

serializer_class

alias of MCPClientSerializer

class smarter.apps.mcpclient.api.v1.views.views.MCPClientViewBase(*args, **kwargs)[source]

Bases: SmarterAuthenticatedAPIView

Base class for views of one MCPClient, identified by hashed_id or mcpclient_id.

get_mcpclient() returns the MCPClient only if the user may read it, or, with owner=True, only if the user owns it. Otherwise it raises Http404, so that the MCPClients of other accounts are not disclosed.

get_mcpclient(request, owner=False, **kwargs)[source]

Return the MCPClient in the URL, if the user may read it, or own it.

Raises:

Http404 – If the MCPClient does not exist, or the user may not access it.

Return type:

MCPClient

mcpclient_id(**kwargs)[source]

Return the MCPClient id from the URL.

Return type:

int | None

smarter.apps.mcpclient.api.v1.views.views.error_status(e)[source]

Return the HTTP status for an MCPClient error.

Return type:

int

smarter.apps.mcpclient.api.v1.views.views.status_error(mcpclient, e)[source]

The response to a failed connection to an MCPClient’s server: the error, beside the MCPClient’s connection status.

Parameters:
Returns:

The response, whose status is error_status()’s.

Return type:

Response

URL configuration for the MCPClient app API.

These are mounted at /api/v1/mcpclients/. See smarter.apps.mcpclient.api.v1.views.views.

class smarter.apps.mcpclient.api.v1.urls.MCPClientApiV1ReverseViews[source]

Bases: object

Reverse view names for the MCPClient api.

Each MCPClient view is available by the MCPClient’s hashed id, and by its id.

Example

from django.urls import reverse
url = reverse(
    f"{MCPClientApiV1ReverseViews.namespace}:{MCPClientApiV1ReverseViews.tools_by_hashed_id}",
    kwargs={"hashed_id": mcpclient.hashed_id},
)
list_view = 'mcp_client_list_view'
mcpclient_by_hashed_id = 'mcp_client_view_by_hashed_id'
mcpclient_by_id = 'mcp_client_view_by_id'
namespace = 'api:v1:mcpclient'
refresh_by_hashed_id = 'mcp_client_refresh_view_by_hashed_id'
refresh_by_id = 'mcp_client_refresh_view_by_id'
tool_call_by_hashed_id = 'mcp_client_tool_call_view_by_hashed_id'
tool_call_by_id = 'mcp_client_tool_call_view_by_id'
tools_by_hashed_id = 'mcp_client_tools_view_by_hashed_id'
tools_by_id = 'mcp_client_tools_view_by_id'