fixes greptile

This commit is contained in:
Ishaan Jaffer 2026-02-09 18:32:55 -08:00
parent 25ce55a4dc
commit 29f468d60c
7 changed files with 6 additions and 79 deletions

View file

@ -595,7 +595,7 @@ if MCP_AVAILABLE:
return {
"status": "error",
"error": True,
"message": f"Failed to connect to MCP server: {e}",
"message": "Failed to connect to MCP server. Check proxy logs for details.",
}
@router.post("/test/connection", dependencies=[Depends(user_api_key_auth)])

View file

@ -45,13 +45,6 @@ mcp_servers:
deepwiki:
transport: "http"
url: "https://mcp.deepwiki.com/mcp"
test_oauth2_server:
url: "http://localhost:8765/mcp"
transport: "http"
auth_type: "oauth2"
client_id: "test-client"
client_secret: "test-secret"
token_url: "http://localhost:8765/oauth/token"
# General Settings

View file

@ -1,67 +0,0 @@
#!/usr/bin/env bash
# E2E test for OAuth2 client_credentials MCP flow
# Usage: bash tests/mcp_tests/test_oauth2_e2e.sh
set -euo pipefail
MOCK_PORT=8765
PROXY_PORT=4000
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CONFIG="$SCRIPT_DIR/test_oauth2_mcp_config.yaml"
MOCK_SERVER="$SCRIPT_DIR/mock_oauth2_mcp_server.py"
cleanup() {
echo ""
echo "=== Cleaning up ==="
kill "$MOCK_PID" 2>/dev/null || true
kill "$PROXY_PID" 2>/dev/null || true
wait "$MOCK_PID" 2>/dev/null || true
wait "$PROXY_PID" 2>/dev/null || true
echo "Done."
}
trap cleanup EXIT
# ── 1. Start mock OAuth2 MCP server ──────────────────────────────────────────
echo "=== Starting mock OAuth2 MCP server on :$MOCK_PORT ==="
python "$MOCK_SERVER" &
MOCK_PID=$!
sleep 2
# Quick smoke test on the token endpoint
TOKEN_RESP=$(curl -sf http://localhost:$MOCK_PORT/oauth/token \
-d "grant_type=client_credentials&client_id=test-client&client_secret=test-secret")
echo "Token endpoint OK: $TOKEN_RESP"
# ── 3. List tools ────────────────────────────────────────────────────────────
echo ""
echo "=== Request 1: List MCP tools ==="
curl -s http://localhost:$PROXY_PORT/mcp-rest/tools/list \
-H "Authorization: Bearer sk-1234" | python3 -m json.tool
# ── 4. Call the echo tool ────────────────────────────────────────────────────
echo ""
echo "=== Request 2: Call echo tool ==="
# Get the server_id from health endpoint
SERVER_ID=$(curl -s http://localhost:$PROXY_PORT/v1/mcp/server/health \
-H "Authorization: Bearer sk-1234" | python3 -c "import json,sys; print(json.load(sys.stdin)[0]['server_id'])")
curl -s http://localhost:$PROXY_PORT/mcp-rest/tools/call \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d "{\"name\": \"echo\", \"arguments\": {\"message\": \"Hello from OAuth2 client_credentials\"}, \"server_id\": \"$SERVER_ID\"}" | python3 -m json.tool
# ── 5. Call again (uses cached token) ────────────────────────────────────────
echo ""
echo "=== Request 3: Call echo again (cached token) ==="
curl -s http://localhost:$PROXY_PORT/mcp-rest/tools/call \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d "{\"name\": \"echo\", \"arguments\": {\"message\": \"Second call - token should be cached\"}, \"server_id\": \"$SERVER_ID\"}" | python3 -m json.tool
# ── 6. Show OAuth2-specific proxy logs ───────────────────────────────────────
echo ""
echo "=== Proxy OAuth2 logs ==="
grep -E "(Fetching OAuth2|Fetched OAuth2)" /tmp/litellm_oauth2_test.log || echo "(no OAuth2 log lines found)"
echo ""
echo "=== All requests succeeded ==="

View file

@ -305,6 +305,8 @@ class TestExecuteWithMcpClient:
assert result["status"] == "error"
assert result["error"] is True
assert "Failed to connect to MCP server" in result["message"]
# Error message must not leak raw exception details
assert "cancel scope" not in result["message"]
class TestTestConnection:

View file

@ -479,7 +479,7 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
rules={[
{
required: false,
message: "Please enter a server description!!!!!!!!!",
message: "Please enter a server description",
},
]}
>

View file

@ -24,7 +24,6 @@ export const TRANSPORT = {
};
export const handleTransport = (transport?: string | null): string => {
console.log(transport);
if (transport === null || transport === undefined) {
return TRANSPORT.SSE;
}

View file

@ -1,6 +1,6 @@
import { useState, useEffect } from "react";
import { testMCPToolsListRequest } from "../components/networking";
import { AUTH_TYPE } from "@/components/mcp_tools/types";
import { AUTH_TYPE, OAUTH_FLOW } from "@/components/mcp_tools/types";
interface MCPServerConfig {
server_id?: string;
@ -53,7 +53,7 @@ export const useTestMCPConnection = ({
// Check if we have the minimum required fields to fetch tools
const isM2MOAuth = formValues.auth_type === AUTH_TYPE.OAUTH2
&& formValues.oauth_flow_type === "m2m";
&& formValues.oauth_flow_type === OAUTH_FLOW.M2M;
const requiresOAuthToken = formValues.auth_type === AUTH_TYPE.OAUTH2 && !isM2MOAuth;
const canFetchTools = !!(
formValues.url &&