mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-06 02:30:58 +00:00
Removed the MCPAuthorization class relying on bearer token
This commit is contained in:
parent
376f0fcd23
commit
9dbeeaca97
7 changed files with 24 additions and 216 deletions
|
|
@ -483,26 +483,6 @@ class AllowedToolsFilter(BaseModel):
|
|||
tool_names: list[str] | None = None
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class MCPAuthorization(BaseModel):
|
||||
"""Authorization configuration for MCP servers.
|
||||
|
||||
:param type: Authorization type ("bearer", "basic", or "api_key")
|
||||
:param token: Bearer token for bearer authorization
|
||||
:param username: Username for basic authorization
|
||||
:param password: Password for basic authorization
|
||||
:param api_key: API key for api_key authorization
|
||||
:param header_name: Custom header name for API key (default: "X-API-Key")
|
||||
"""
|
||||
|
||||
type: Literal["bearer", "basic", "api_key"]
|
||||
token: str | None = None
|
||||
username: str | None = None
|
||||
password: str | None = None
|
||||
api_key: str | None = None
|
||||
header_name: str = "X-API-Key"
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class OpenAIResponseInputToolMCP(BaseModel):
|
||||
"""Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
|
||||
|
|
@ -511,7 +491,7 @@ class OpenAIResponseInputToolMCP(BaseModel):
|
|||
:param server_label: Label to identify this MCP server
|
||||
:param server_url: URL endpoint of the MCP server
|
||||
:param headers: (Optional) HTTP headers to include when connecting to the server
|
||||
:param authorization: (Optional) Authorization configuration for the MCP server
|
||||
:param authorization: (Optional) Bearer token authorization string (format: "Bearer <token>")
|
||||
:param require_approval: Approval requirement for tool calls ("always", "never", or filter)
|
||||
:param allowed_tools: (Optional) Restriction on which tools can be used from this server
|
||||
"""
|
||||
|
|
@ -520,7 +500,9 @@ class OpenAIResponseInputToolMCP(BaseModel):
|
|||
server_label: str
|
||||
server_url: str
|
||||
headers: dict[str, Any] | None = None
|
||||
authorization: MCPAuthorization | None = None
|
||||
# OpenAI's MCP authorization currently only supports bearer tokens as a simple string
|
||||
# Format: "Bearer <token>" (e.g., "Bearer my-secret-token")
|
||||
authorization: str | None = None
|
||||
|
||||
require_approval: Literal["always"] | Literal["never"] | ApprovalFilter = "never"
|
||||
allowed_tools: list[str] | AllowedToolsFilter | None = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue