Django ORM
All models for the MCPClient app.
- class smarter.apps.mcpclient.models.MCPAuthType(*values)[source]
Bases:
TextChoicesMCP Authentication Type choice list.
- API_KEY = 'api_key'
- BEARER_TOKEN = 'bearer_token'
- NONE = 'none'
- OAUTH2 = 'oauth2'
- class smarter.apps.mcpclient.models.MCPClient(*args, **kwargs)[source]
Bases:
MetaDataWithOwnershipModelA client of a remote MCP server.
The connection, authentication and capability scope fields are set by the MCPClient manifest’s
spec.config. The status fields record the result of the last connection to the MCP server, and are set bysmarter.apps.mcpclient.tasks.refresh_mcpclient()and whenever the server’s catalog is fetched.- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
name (Unknown) – Name. Name in camelCase, e.g., ‘apiKey’, no special characters.
description (Unknown) – Description. A brief description of this resource. Be verbose, but not too verbose.
version (Unknown) – Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.
annotations (Unknown) – Annotations. Key-value pairs for annotating this resource.
transport (Unknown) – Transport
endpoint_url (Unknown) – Endpoint url. The https URL of the MCP server’s endpoint.
command (Unknown) – Command. Reserved for the stdio transport, which is not supported.
headers (Unknown) – Headers. Non-secret HTTP headers to send to the MCP server.
timeout (Unknown) – Timeout. Seconds to wait for the MCP server to connect and respond.
auth_type (Unknown) – Auth type
api_key_header (Unknown) – Api key header. The HTTP header that carries an api_key credential.
allowed_tools (Unknown) – Allowed tools. Glob patterns of the tool names to offer the LLM; empty = all tools the server advertises.
allowed_resources (Unknown) – Allowed resources. Glob patterns of the resource URIs that the LLM may read; empty = none.
include_instructions (Unknown) – Include instructions. Add the MCP server’s instructions to the system prompt.
cache_ttl (Unknown) – Cache ttl. Seconds to cache the MCP server’s tools, instructions and capabilities. 0 disables caching.
is_active (Unknown) – Is active
status (Unknown) – Status
priority (Unknown) – Priority. The order in which an LLMClient’s MCPClients are offered to the LLM; lower runs first.
protocol_version (Unknown) – Protocol version. Negotiated MCP protocol version from the last successful handshake.
server_name (Unknown) – Server name. The name that the MCP server reported.
server_version (Unknown) – Server version. The version that the MCP server reported.
tools (Unknown) – Tools. The names of the tools offered to the LLM, as of the last successful connection.
last_connected_at (Unknown) – Last connected at. When Smarter last connected to the MCP server.
last_error (Unknown) – Last error. The error of the last failed connection, if any.
Relationship fields:
- Parameters:
user_profile (Unknown) – User profile (related name:
mcpclient)credentials (Unknown) – Credentials. The Secret containing the credential. Required unless auth_type is none. (related name:
mcpclient)tags (Unknown) – Tags. Tags for categorizing and organizing this resource. (related name:
mcpclient)tagged_items (Unknown) – Tagged items (related name:
+)
Reverse relationships:
- Parameters:
llmclient_mcpclients (Unknown) – All llmclient mcpclients of this mcp client (related name of
mcpclient)
- CONNECTION_FIELDS = ('transport', 'endpoint_url', 'headers', 'timeout', 'auth_type', 'credentials_id', 'api_key_header', 'allowed_tools', 'allowed_resources')
The fields that determine what the MCP server returns, and so its cached catalog.
- DISCOVERED_FIELDS = ('protocol_version', 'server_name', 'server_version', 'last_connected_at', 'last_error')
The fields that describe the last connection, which a change of connection settings makes stale.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- allowed_resources
-
Allowed resources. Glob patterns of the resource URIs that the LLM may read; empty = none.
- Type:
Type
- allowed_tools
-
Allowed tools. Glob patterns of the tool names to offer the LLM; empty = all tools the server advertises.
- Type:
Type
- api_key_header
-
Api key header. The HTTP header that carries an api_key credential.
- Type:
Type
- cache_ttl
-
Cache ttl. Seconds to cache the MCP server’s tools, instructions and capabilities. 0 disables caching.
- Type:
Type
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- credentials
ForeignKeytoSecretCredentials. The Secret containing the credential. Required unless auth_type is none. (related name:
mcpclient)- Type:
Type
- credentials_id
Internal field, use
credentialsinstead.
- description
-
Description. A brief description of this resource. Be verbose, but not too verbose.
- Type:
Type
- property fingerprint: str
A hash of the fields that determine the MCP server’s catalog.
The cached catalog is keyed by it, so that changing any of these fields invalidates the cache, while recording the status of a connection does not.
- Returns:
A 16-character hexadecimal hash.
- Return type:
- get_auth_type_display(*, field=<django.db.models.CharField: auth_type>)
Shows the label of the
auth_type. Seeget_FOO_display()for more information.
- get_status_display(*, field=<django.db.models.CharField: status>)
Shows the label of the
status. Seeget_FOO_display()for more information.
- get_transport_display(*, field=<django.db.models.CharField: transport>)
Shows the label of the
transport. Seeget_FOO_display()for more information.
- id
-
Primary key: ID
- Type:
Type
- include_instructions
-
Include instructions. Add the MCP server’s instructions to the system prompt.
- Type:
Type
- is_active
-
Is active
- Type:
Type
- last_connected_at
-
Last connected at. When Smarter last connected to the MCP server.
- Type:
Type
- llmclient_mcpclients
Reverse
ForeignKeyfromLLMClientMCPClientsAll llmclient mcpclients of this mcp client (related name of
mcpclient)- Type:
Type
- priority
-
Priority. The order in which an LLMClient’s MCPClients are offered to the LLM; lower runs first.
- Type:
Type
- protocol_version
-
Protocol version. Negotiated MCP protocol version from the last successful handshake.
- Type:
Type
- save(*args, **kwargs)[source]
Save the MCPClient, forgetting what it discovered if its connection settings changed.
Its status, tools and server details describe the last server that it connected to. When, for example, its
endpoint_urlchanges, they no longer describe its server, so they are reset until the refresh thatpost_savequeues connects to the new one. Otherwise the console showed the old server’s tools, and none of them were in a newallowed_tools.
- tagged_items
Reverse
GenericRelationfromMCPClientAll + of this tagged item (related name of
tagged_items)- Type:
Type
- tags = <taggit.managers._TaggableManager object>
- timeout
-
Timeout. Seconds to wait for the MCP server to connect and respond.
- Type:
Type
- tools
-
Tools. The names of the tools offered to the LLM, as of the last successful connection.
- Type:
Type
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- user_profile
-
User profile (related name:
mcpclient)- Type:
Type
- user_profile_id
Internal field, use
user_profileinstead.