mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-28 04:30:52 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
292876a991 | ||
|
|
d6a9146e27 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -76,7 +76,7 @@ jobs:
|
||||
|
||||
# services:
|
||||
# postgres:
|
||||
# image: postgres:15
|
||||
# image: pgvector/pgvector:pg17
|
||||
# env:
|
||||
# POSTGRES_PASSWORD: postgres
|
||||
# POSTGRES_DB: mcphub_test
|
||||
|
||||
@@ -3,7 +3,7 @@ version: "3.8"
|
||||
services:
|
||||
# PostgreSQL database for MCPHub configuration
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
image: pgvector/pgvector:pg17-alpine
|
||||
container_name: mcphub-postgres
|
||||
environment:
|
||||
POSTGRES_DB: mcphub
|
||||
|
||||
@@ -59,7 +59,7 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
image: pgvector/pgvector:pg17
|
||||
environment:
|
||||
POSTGRES_DB: mcphub
|
||||
POSTGRES_USER: mcphub
|
||||
|
||||
@@ -119,7 +119,7 @@ services:
|
||||
- mcphub-network
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
@@ -203,7 +203,7 @@ services:
|
||||
retries: 3
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
@@ -305,7 +305,7 @@ services:
|
||||
- mcphub-dev
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-postgres-dev
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
@@ -445,7 +445,7 @@ Add backup service to your `docker-compose.yml`:
|
||||
```yaml
|
||||
services:
|
||||
backup:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-backup
|
||||
environment:
|
||||
- PGPASSWORD=${POSTGRES_PASSWORD}
|
||||
|
||||
@@ -78,7 +78,7 @@ Smart Routing requires additional setup compared to basic MCPHub usage:
|
||||
- ./mcp_settings.json:/app/mcp_settings.json
|
||||
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg16
|
||||
image: pgvector/pgvector:pg17
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
- POSTGRES_USER=mcphub
|
||||
@@ -146,7 +146,7 @@ Smart Routing requires additional setup compared to basic MCPHub usage:
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: pgvector/pgvector:pg16
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: mcphub
|
||||
|
||||
@@ -96,7 +96,7 @@ Optional for Smart Routing:
|
||||
|
||||
# Optional: PostgreSQL for Smart Routing
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg16
|
||||
image: pgvector/pgvector:pg17
|
||||
environment:
|
||||
POSTGRES_DB: mcphub
|
||||
POSTGRES_USER: mcphub
|
||||
|
||||
@@ -59,7 +59,7 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
image: pgvector/pgvector:pg17
|
||||
environment:
|
||||
POSTGRES_DB: mcphub
|
||||
POSTGRES_USER: mcphub
|
||||
|
||||
@@ -119,7 +119,7 @@ services:
|
||||
- mcphub-network
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
@@ -203,7 +203,7 @@ services:
|
||||
retries: 3
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
@@ -305,7 +305,7 @@ services:
|
||||
- mcphub-dev
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-postgres-dev
|
||||
environment:
|
||||
- POSTGRES_DB=mcphub
|
||||
@@ -445,7 +445,7 @@ secrets:
|
||||
```yaml
|
||||
services:
|
||||
backup:
|
||||
image: postgres:15-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: mcphub-backup
|
||||
environment:
|
||||
- PGPASSWORD=${POSTGRES_PASSWORD}
|
||||
|
||||
@@ -96,7 +96,7 @@ description: '各种平台的详细安装说明'
|
||||
|
||||
# 可选:用于智能路由的 PostgreSQL
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg16
|
||||
image: pgvector/pgvector:pg17
|
||||
environment:
|
||||
POSTGRES_DB: mcphub
|
||||
POSTGRES_USER: mcphub
|
||||
|
||||
@@ -325,7 +325,7 @@ export class MCPHubOAuthProvider implements OAuthClientProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Saving OAuth tokens for server: ${this.serverName}`);
|
||||
console.log(`Saving OAuth tokens: ${JSON.stringify(tokens)} for server: ${this.serverName}`);
|
||||
|
||||
const updatedConfig = await persistTokens(this.serverName, {
|
||||
accessToken: tokens.access_token,
|
||||
|
||||
@@ -241,6 +241,8 @@ const callToolWithReconnect = async (
|
||||
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
||||
try {
|
||||
const result = await serverInfo.client.callTool(toolParams, undefined, options || {});
|
||||
// Check auth error
|
||||
checkAuthError(result);
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
// Check if error message starts with "Error POSTing to endpoint (HTTP 40"
|
||||
@@ -830,6 +832,25 @@ export const addOrUpdateServer = async (
|
||||
}
|
||||
};
|
||||
|
||||
// Check for authentication error in tool call result
|
||||
function checkAuthError(result: any) {
|
||||
if (Array.isArray(result.content) && result.content.length > 0) {
|
||||
const text = result.content[0]?.text;
|
||||
if (typeof text === 'string') {
|
||||
let errorContent;
|
||||
try {
|
||||
errorContent = JSON.parse(text);
|
||||
} catch (e) {
|
||||
// Ignore JSON parse errors and continue
|
||||
return;
|
||||
}
|
||||
if (errorContent.code === 401) {
|
||||
throw new Error('Error POSTing to endpoint (HTTP 401 Unauthorized)');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close server client and transport
|
||||
function closeServer(name: string) {
|
||||
const serverInfo = serverInfos.find((serverInfo) => serverInfo.name === name);
|
||||
|
||||
Reference in New Issue
Block a user