chore: restore feishu worktree snapshot
This commit is contained in:
1 parent
e6d707fe21
commit
16d2f1af5d
14 files changed
+1314
-990
No files matched your search
@@ -5,7 +5,11 @@ export const runtime = 'nodejs';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
/**
|
||||
* GET /api/bridge — Return bridge status (pure query, no side effects)
|
||||
* GET /api/bridge — Return bridge status (pure query, no side effects).
|
||||
*
|
||||
* Does NOT run probe — probe is an explicit action via the per-channel
|
||||
* status endpoint (e.g. /api/channels/feishu/status?probe=true).
|
||||
* This endpoint is polled every 5s by useBridgeStatus so it must stay cheap.
|
||||
*/
|
||||
export async function GET() {
|
||||
try {
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { MCPServerConfig } from '@/types';
|
||||
export const runtime = 'nodejs';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
/** Read MCP server configs from ~/.claude.json and ~/.claude/settings.json */
|
||||
/** Read MCP server configs from ~/.claude.json, ~/.claude/settings.json, and project .mcp.json */
|
||||
function loadMcpServers(): Record<string, MCPServerConfig> | undefined {
|
||||
try {
|
||||
const readJson = (p: string): Record<string, unknown> => {
|
||||
@@ -23,10 +23,25 @@ function loadMcpServers(): Record<string, MCPServerConfig> | undefined {
|
||||
};
|
||||
const userConfig = readJson(path.join(os.homedir(), '.claude.json'));
|
||||
const settings = readJson(path.join(os.homedir(), '.claude', 'settings.json'));
|
||||
// Also read project-level .mcp.json
|
||||
const projectMcp = readJson(path.join(process.cwd(), '.mcp.json'));
|
||||
const merged = {
|
||||
...((userConfig.mcpServers || {}) as Record<string, MCPServerConfig>),
|
||||
...((settings.mcpServers || {}) as Record<string, MCPServerConfig>),
|
||||
...((projectMcp.mcpServers || {}) as Record<string, MCPServerConfig>),
|
||||
};
|
||||
// Resolve ${...} placeholders in env values against DB settings
|
||||
for (const server of Object.values(merged)) {
|
||||
if (server.env) {
|
||||
for (const [key, value] of Object.entries(server.env)) {
|
||||
if (typeof value === 'string' && value.startsWith('${') && value.endsWith('}')) {
|
||||
const settingKey = value.slice(2, -1);
|
||||
const resolved = getSetting(settingKey);
|
||||
server.env[key] = resolved || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.keys(merged).length > 0 ? merged : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
|
||||
Reference in new issue
Block a user