This commit is contained in:
@@ -585,14 +585,18 @@ async function executeGetMyOrchestratorState(
|
||||
let mcpServers: McpServerRow[] = [];
|
||||
let userTokens: McpTokenRow[] = [];
|
||||
try {
|
||||
mcpServers = db
|
||||
.prepare(`
|
||||
SELECT id, name, auth_kind, owner_id, enabled
|
||||
FROM mcp_servers
|
||||
WHERE enabled = 1 AND (owner_id IS NULL OR owner_id = ?)
|
||||
ORDER BY id
|
||||
`)
|
||||
.all(userId) as McpServerRow[];
|
||||
// Report ONLY the servers actually exposed to the agent in THIS task, i.e.
|
||||
// scoped to the task's effective space — exactly mirroring the aggregator's
|
||||
// registry.listEnabledForSpace(ctx.spaceId). The old owner-scoped query
|
||||
// listed servers from other spaces too, so it told the agent a server was
|
||||
// "connected" when it was not callable here (cross-space). See
|
||||
// docs/superpowers/specs/2026-06-19-personal-space-mcp-resolution-design.md
|
||||
const effectiveSpaceId = ctx.spaceId ?? null;
|
||||
mcpServers = (
|
||||
effectiveSpaceId === null
|
||||
? db.prepare(`SELECT id, name, auth_kind, owner_id, enabled FROM mcp_servers WHERE enabled = 1 AND space_id IS NULL ORDER BY id`).all()
|
||||
: db.prepare(`SELECT id, name, auth_kind, owner_id, enabled FROM mcp_servers WHERE enabled = 1 AND space_id = ? ORDER BY id`).all(effectiveSpaceId)
|
||||
) as McpServerRow[];
|
||||
userTokens = db
|
||||
.prepare('SELECT server_id, expires_at FROM user_mcp_tokens WHERE user_id = ?')
|
||||
.all(userId) as McpTokenRow[];
|
||||
@@ -602,7 +606,7 @@ async function executeGetMyOrchestratorState(
|
||||
|
||||
const tokenSet = new Set(userTokens.map((t) => t.server_id));
|
||||
|
||||
lines.push('## MCP サーバー');
|
||||
lines.push('## MCP サーバー (このタスクで利用可能)');
|
||||
if (mcpServers.length === 0) {
|
||||
lines.push('- (利用可能なサーバーなし)');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user