Skip to content
Discussion options

You must be logged in to vote

Answering my own question. This feels a little silly but it works if it helps someone else.

import httpx
from fastmcp import FastMCP
import asyncio

API_KEY = "XXXXXX"
openapi_spec = httpx.get("https://example1.com/openapi.json", headers={'x-api-key': API_KEY}).json()
client = httpx.AsyncClient(base_url="https://example1.com", headers={'x-api-key': API_KEY})

API_KEY_2 = "XXXXXX"
openapi_spec2 = httpx.get("https://example2.com/openapi.json").json()
client2 = httpx.AsyncClient(base_url="https://example2.com", headers={'x-api-key': API_KEY_2})    

mcp = FastMCP.from_openapi(
    openapi_spec=openapi_spec,
    client=client,
    name="The Actual Server",
)

mcp2 = FastMCP.from_openapi(
    o…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by jbnitorum
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jbnitorum
Comment options

Comment options

You must be logged in to vote
2 replies
@jbnitorum
Comment options

@sandeepkunusoth
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants