feat: support server-specified endpoint (#58)

This commit is contained in:
samanhappy
2025-05-09 21:25:44 +08:00
committed by GitHub
parent 74d1ca6a87
commit 0f5dfbe419
3 changed files with 33 additions and 1 deletions

View File

@@ -115,6 +115,15 @@ Where `{group}` is the ID or name of the group you created in the dashboard. Thi
- Isolate different AI tools to access only relevant servers
- Implement more granular access control for different environments or teams
**Server-Specific Endpoints**:
For direct access to individual servers, use the server-specific HTTP endpoint:
```
http://localhost:3000/mcp/{server}
```
Where `{server}` is the name of the server you want to connect to. This allows you to access a specific MCP server directly.
> **Note**: If the server name and group name are the same, the group name will take precedence.
### SSE Endpoint (Deprecated in Future)
Connect AI clients (e.g., Claude Desktop, Cursor, DeepChat, etc.) via:
@@ -127,6 +136,11 @@ For targeted access to specific server groups, use the group-based SSE endpoint:
http://localhost:3000/sse/{group}
```
For direct access to individual servers, use the server-specific SSE endpoint:
```
http://localhost:3000/sse/{server}
```
## 🧑‍💻 Local Development
```bash

View File

@@ -125,7 +125,18 @@ http://localhost:3000/mcp/{group}
- 通过分组名称轻松识别和管理服务器
- 允许不同的 AI 客户端使用相同的端点,简化集成过程
### SSE 端点集成 (即将废弃)
**针对特定服务器的 HTTP 端点**
要针对特定服务器进行访问,请使用以下格式:
```
http://localhost:3000/mcp/{server}
```
其中 `{server}` 是您要连接的服务器名称。这样做可以直接访问特定的 MCP 服务器。
> **提示**:如果服务器名称和分组名称相同,则分组名称优先。
### SSE 端点集成 (未来可能废弃)
通过以下地址连接 AI 客户端(如 Claude Desktop、Cursor、DeepChat 等):
@@ -139,6 +150,12 @@ http://localhost:3000/sse
http://localhost:3000/sse/{group}
```
要针对特定服务器进行访问,请使用以下格式:
```
http://localhost:3000/sse/{server}
```
## 🧑‍💻 本地开发
```bash

View File

@@ -347,6 +347,7 @@ export const createMcpServer = (name: string, version: string): Server => {
if (serverInfo.enabled === false) return false;
if (!group) return true;
const serversInGroup = getServersInGroup(group);
if (!serversInGroup || serversInGroup.length === 0) return serverInfo.name === group;
return serversInGroup.includes(serverInfo.name);
});