mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-27 04:54:45 +03:00
feat(mcp): add a built-in MCP server at /panel/api/mcp (#6956)
AI agents (Claude, Cursor, VS Code) can manage the panel through a stateless streamable-HTTP MCP endpoint. Every tool re-enters the router with the caller's credentials, so authentication, token scopes, CSRF and runtime.Runtime dispatch apply exactly as for the REST API; a restricted token scope is refused, log text is fenced as untrusted data, and each tool call is written to the panel log. The endpoint hands an API token's whole reach to the agent that holds it, so it is off by default: a panel answers 404 until the MCP server is enabled under Settings -> Security -> API Token (the mcpEnable setting).
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: MCP
|
||||
description: Model Context Protocol endpoint for AI agents (Claude, Cursor, VS
|
||||
Code). Point an MCP client at this URL with an admin Bearer token; restricted
|
||||
token scopes are refused.
|
||||
full: true
|
||||
_openapi:
|
||||
preload:
|
||||
- ./public/openapi.json
|
||||
toc:
|
||||
- depth: 2
|
||||
title: 'Stateless streamable-HTTP MCP endpoint (JSON-RPC 2.0). Exposes panel
|
||||
tools for inbounds, clients, server, Xray, nodes, hosts and settings;
|
||||
each tool call runs the matching /panel/api route with the caller’s
|
||||
credentials. Off by default: answers 404 until the MCP server is enabled
|
||||
under Settings → Security → API Token.'
|
||||
url: '#stateless-streamable-http-mcp-endpoint-json-rpc-20-exposes-panel-tools-for-inbounds-clients-server-xray-nodes-hosts-and-settings-each-tool-call-runs-the-matching-panelapi-route-with-the-callers-credentials-off-by-default-answers-404-until-the-mcp-server-is-enabled-under-settings--security--api-token'
|
||||
structuredData:
|
||||
headings:
|
||||
- content: 'Stateless streamable-HTTP MCP endpoint (JSON-RPC 2.0). Exposes panel
|
||||
tools for inbounds, clients, server, Xray, nodes, hosts and settings;
|
||||
each tool call runs the matching /panel/api route with the caller’s
|
||||
credentials. Off by default: answers 404 until the MCP server is
|
||||
enabled under Settings → Security → API Token.'
|
||||
id: stateless-streamable-http-mcp-endpoint-json-rpc-20-exposes-panel-tools-for-inbounds-clients-server-xray-nodes-hosts-and-settings-each-tool-call-runs-the-matching-panelapi-route-with-the-callers-credentials-off-by-default-answers-404-until-the-mcp-server-is-enabled-under-settings--security--api-token
|
||||
contents: []
|
||||
---
|
||||
|
||||
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
|
||||
|
||||
export default function Layout(props) {
|
||||
const { OpenAPIPage } = props.components ?? {};
|
||||
return (
|
||||
<>
|
||||
{props.children}
|
||||
<OpenAPIPage document="./public/openapi.json" webhooks={[]} operations={[{"path":"/panel/api/mcp","method":"post"}]} showTitle />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
"hosts",
|
||||
"nodes",
|
||||
"backup",
|
||||
"mcp",
|
||||
"websocket"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user