mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
wire spec_path through build_mcp_server_from_table
This commit is contained in:
parent
6ca01a54e8
commit
8f2166d204
4 changed files with 44 additions and 2 deletions
|
|
@ -71,7 +71,9 @@ try:
|
|||
from mcp.shared.tool_name_validation import (
|
||||
validate_tool_name, # pyright: ignore[reportAssignmentType]
|
||||
)
|
||||
from mcp.shared.tool_name_validation import SEP_986_URL
|
||||
from mcp.shared.tool_name_validation import (
|
||||
SEP_986_URL,
|
||||
)
|
||||
except ImportError:
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
|
@ -608,6 +610,7 @@ class MCPServerManager:
|
|||
alias=getattr(mcp_server, "alias", None),
|
||||
server_name=getattr(mcp_server, "server_name", None),
|
||||
url=mcp_server.url,
|
||||
spec_path=getattr(mcp_server, "spec_path", None),
|
||||
transport=cast(MCPTransportType, mcp_server.transport),
|
||||
auth_type=auth_type,
|
||||
authentication_token=auth_value,
|
||||
|
|
|
|||
|
|
@ -564,7 +564,6 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
|
|||
label={<span className="text-sm font-medium text-gray-700">MCP Server URL</span>}
|
||||
name="url"
|
||||
rules={[
|
||||
{ required: true, message: "Please enter a server URL" },
|
||||
{ validator: (_, value) => validateMCPServerUrl(value) },
|
||||
]}
|
||||
>
|
||||
|
|
@ -575,6 +574,26 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
|
|||
</Form.Item>
|
||||
)}
|
||||
|
||||
{/* OpenAPI Spec URL - only show for HTTP and SSE */}
|
||||
{transportType !== "stdio" && (
|
||||
<Form.Item
|
||||
label={
|
||||
<span className="text-sm font-medium text-gray-700 flex items-center">
|
||||
OpenAPI Spec URL (optional)
|
||||
<Tooltip title="Provide an OpenAPI spec URL to automatically generate MCP tools from the API endpoints. When set, tools are generated from the spec instead of connecting to an MCP server.">
|
||||
<InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
|
||||
</Tooltip>
|
||||
</span>
|
||||
}
|
||||
name="spec_path"
|
||||
>
|
||||
<Input
|
||||
placeholder="https://api.example.com/openapi.json"
|
||||
className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{/* Authentication - only show for HTTP and SSE */}
|
||||
{transportType !== "stdio" && (
|
||||
<Form.Item
|
||||
|
|
|
|||
|
|
@ -566,6 +566,25 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({
|
|||
</Form.Item>
|
||||
)}
|
||||
|
||||
{!isStdioTransport && (
|
||||
<Form.Item
|
||||
label={
|
||||
<span className="text-sm font-medium text-gray-700 flex items-center">
|
||||
OpenAPI Spec URL (optional)
|
||||
<Tooltip title="Provide an OpenAPI spec URL to automatically generate MCP tools from the API endpoints. When set, tools are generated from the spec instead of connecting to an MCP server.">
|
||||
<InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
|
||||
</Tooltip>
|
||||
</span>
|
||||
}
|
||||
name="spec_path"
|
||||
>
|
||||
<Input
|
||||
placeholder="https://api.example.com/openapi.json"
|
||||
className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{!isStdioTransport && (
|
||||
<Form.Item label="Authentication" name="auth_type" rules={[{ required: true }]}>
|
||||
<Select>
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ export interface MCPServer {
|
|||
* For `stdio`, the backend can return null/undefined.
|
||||
*/
|
||||
url?: string | null;
|
||||
spec_path?: string | null;
|
||||
transport?: string | null;
|
||||
auth_type?: string | null;
|
||||
authorization_url?: string | null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue