Skip to content

Comments

feat: Unified Agent Auth - MCP Tools#17

Open
khaliqgant wants to merge 1 commit intomainfrom
feature/unified-agent-auth
Open

feat: Unified Agent Auth - MCP Tools#17
khaliqgant wants to merge 1 commit intomainfrom
feature/unified-agent-auth

Conversation

@khaliqgant
Copy link
Contributor

@khaliqgant khaliqgant commented Feb 11, 2026

Summary

MCP tools for Unified Agent Auth system.

Tools Added:

  • relay_proxy - Proxy authenticated API calls through integrations
  • relay_connections - List available provider connections
  • relay_can_access - Check agent access to provider/scope

API Alignment

Tools call relay-cloud endpoints:

  • POST /api/proxy/{provider} - proxy requests
  • GET /api/proxy/providers - list providers
  • GET /api/proxy/{provider}/access - check access

Test Plan

  • relay_proxy successfully proxies requests to connected providers
  • relay_connections returns list of available providers
  • relay_can_access correctly reports access permissions

Made with Cursor


Open with Devin

Phase 2 of Unified Agent Auth feature:

- Add relay_proxy tool: Proxy HTTP requests through authenticated integrations
- Add relay_connections tool: List available providers and connection status
- Add relay_can_access tool: Check agent access permissions for providers

These tools enable agents to make authenticated API calls to external
services (GitHub, Slack, Linear, etc.) via the relay-cloud proxy endpoint.

Ref: unified-agent-auth-spec.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

const parsedParams = params ? JSON.parse(params) : undefined;
const parsedHeaders = headers ? JSON.parse(headers) : undefined;

const result = await client.client.post(`/api/proxy/${provider}`, {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Path traversal via unencoded provider parameter in URL construction

The provider parameter is interpolated directly into URL paths without encodeURIComponent(), enabling path traversal attacks.

Root Cause and Impact

All three integration tools construct URLs by directly interpolating the user-supplied provider string:

  • Line 48: `/api/proxy/${provider}`
  • Line 100: `/api/proxy/${provider}/access${queryParams}`

The new URL(path, baseUrl) constructor in packages/sdk/src/client.ts:51 resolves .. segments, so a provider value like ../../v1/agents causes the request to be sent to https://api.agentrelay.dev/v1/agents instead of the intended proxy endpoint.

This breaks the established pattern in the codebase where all user-supplied path segments use encodeURIComponent() (see packages/sdk/src/agent.ts which consistently applies it to every dynamic path segment).

Impact: An agent (or LLM providing tool inputs) could craft a provider value to make authenticated requests to arbitrary API endpoints on the relay server, bypassing the intended proxy routing. For example, provider = "../../v1/workspace" would hit the workspace info endpoint with the agent's credentials.

Prompt for agents
In packages/mcp/src/tools/integrations.ts, wrap the `provider` parameter with `encodeURIComponent()` in all three URL constructions:

1. Line 48: Change `/api/proxy/${provider}` to `/api/proxy/${encodeURIComponent(provider)}`
2. Line 100: Change `/api/proxy/${provider}/access${queryParams}` to `/api/proxy/${encodeURIComponent(provider)}/access${queryParams}`

This matches the established pattern used throughout packages/sdk/src/agent.ts where all dynamic path segments are encoded.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant