add credentials to new axios client (#2897)

This commit is contained in:
Jonathan Dobson
2025-07-08 09:42:53 -04:00
committed by GitHub
parent 2098cee562
commit 04fc7e190f
4 changed files with 2718 additions and 2472 deletions

5175
poetry.lock generated

File diff suppressed because one or more lines are too long

View File

@@ -65,7 +65,7 @@ pyotp = "^2.9.0"
asyncpg = "^0.30.0" asyncpg = "^0.30.0"
json-repair = "^0.34.0" json-repair = "^0.34.0"
pypdf = "^5.1.0" pypdf = "^5.1.0"
fastmcp = "^2.10.1" fastmcp = "^0.4.1"
psutil = ">=7.0.0" psutil = ">=7.0.0"
tiktoken = ">=0.9.0" tiktoken = ">=0.9.0"
anthropic = "^0.50.0" anthropic = "^0.50.0"

View File

@@ -40,18 +40,21 @@ const artifactApiClient = axios.create({
export function setAuthorizationHeader(token: string) { export function setAuthorizationHeader(token: string) {
client.defaults.headers.common["Authorization"] = `Bearer ${token}`; client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
v2Client.defaults.headers.common["Authorization"] = `Bearer ${token}`; v2Client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
clientSansApiV1.defaults.headers.common["Authorization"] = `Bearer ${token}`;
} }
export function removeAuthorizationHeader() { export function removeAuthorizationHeader() {
if (client.defaults.headers.common["Authorization"]) { if (client.defaults.headers.common["Authorization"]) {
delete client.defaults.headers.common["Authorization"]; delete client.defaults.headers.common["Authorization"];
delete v2Client.defaults.headers.common["Authorization"]; delete v2Client.defaults.headers.common["Authorization"];
delete clientSansApiV1.defaults.headers.common["Authorization"];
} }
} }
export function setApiKeyHeader(apiKey: string) { export function setApiKeyHeader(apiKey: string) {
client.defaults.headers.common["X-API-Key"] = apiKey; client.defaults.headers.common["X-API-Key"] = apiKey;
v2Client.defaults.headers.common["X-API-Key"] = apiKey; v2Client.defaults.headers.common["X-API-Key"] = apiKey;
clientSansApiV1.defaults.headers.common["X-API-Key"] = apiKey;
} }
export function removeApiKeyHeader() { export function removeApiKeyHeader() {
@@ -61,6 +64,9 @@ export function removeApiKeyHeader() {
if (v2Client.defaults.headers.common["X-API-Key"]) { if (v2Client.defaults.headers.common["X-API-Key"]) {
delete v2Client.defaults.headers.common["X-API-Key"]; delete v2Client.defaults.headers.common["X-API-Key"];
} }
if (clientSansApiV1.defaults.headers.common["X-API-Key"]) {
delete clientSansApiV1.defaults.headers.common["X-API-Key"];
}
} }
async function getClient( async function getClient(

View File

@@ -3,7 +3,7 @@ import os
import shutil import shutil
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from typing import Any, List from typing import List
import psutil import psutil
import typer import typer
@@ -26,7 +26,7 @@ mcp = FastMCP("Skyvern")
@mcp.tool() @mcp.tool()
async def skyvern_run_task(prompt: str, url: str) -> dict[str, Any]: async def skyvern_run_task(prompt: str, url: str) -> dict[str, str]:
"""Use Skyvern to execute anything in the browser. Useful for accomplishing tasks that require browser automation. """Use Skyvern to execute anything in the browser. Useful for accomplishing tasks that require browser automation.
This tool uses Skyvern's browser automation to navigate websites and perform actions to achieve This tool uses Skyvern's browser automation to navigate websites and perform actions to achieve
@@ -202,6 +202,5 @@ def run_all() -> None:
@run_app.command(name="mcp") @run_app.command(name="mcp")
def run_mcp() -> None: def run_mcp() -> None:
"""Run the MCP server.""" """Run the MCP server."""
# This breaks the MCP processing because it expects json output only console.print(Panel("[bold green]Starting MCP Server...[/bold green]", border_style="green"))
# console.print(Panel("[bold green]Starting MCP Server...[/bold green]", border_style="green"))
mcp.run(transport="stdio") mcp.run(transport="stdio")