lgnd_geo_sdk¶
client ¶
client(
url: str | None = None,
*,
token_directory: str | Path | None = None,
) -> Client
Return a FastMCP client for LGND Geo's MCP server, to call its tools from code.
Parameters:
-
url(str | None, default:None) –The MCP server URL. Defaults to
server_url(). -
token_directory(str | Path | None, default:None) –Where sign-in tokens are stored. Defaults to
default_token_directory().
Returns:
-
Client–The client. It connects when entered (
async with), signing in the first time; see -
Client–auth.
Example
async with client() as geo:
result = await geo.call_tool("user_identity_get", {})
print(result.content[0].text)
auth ¶
auth(
url: str | None = None,
*,
token_directory: str | Path | None = None,
) -> OAuth | ClientCredentialsOAuthProvider | BearerAuth
Return the sign-in to LGND Geo's MCP server.
With LGND_GEO_API_KEY set, this sends that API key with every request.
With LGND_GEO_CLIENT_ID and LGND_GEO_CLIENT_SECRET set, this signs in as that machine
user: the OAuth client-credentials grant, with no browser. Its tokens are kept in memory; a
new one is a single request.
Otherwise this is the OAuth 2.1 sign-in: the first run opens the browser, and the tokens are
stored in token_directory, so later runs sign in without it. In Colab, or with
LGND_GEO_SIGN_IN=device, the first run instead prints a link and a code to confirm in any
browser, since the notebook's own browser cannot reach it.
Parameters:
-
url(str | None, default:None) –The MCP server URL. Defaults to
server_url(). -
token_directory(str | Path | None, default:None) –Where a person's sign-in tokens are stored. Defaults to
default_token_directory().
Returns:
-
OAuth | ClientCredentialsOAuthProvider | BearerAuth–A FastMCP
BearerAuth,OAuthorClientCredentialsOAuthProvider: anhttpx2.Auth -
OAuth | ClientCredentialsOAuthProvider | BearerAuth–that any MCP client on the
mcp2 SDK can sign in with.
Raises:
-
ValueError–LGND_GEO_API_KEYis set with a machine user's credentials, only one ofLGND_GEO_CLIENT_IDandLGND_GEO_CLIENT_SECRETis set,LGND_GEO_SIGN_INis neitherbrowsernordevice, or a device sign-in has no client for the server.
server_url ¶
server_url(url: str | None = None) -> str
Return the URL of LGND Geo's MCP server.
Parameters:
-
url(str | None, default:None) –A URL to use instead of the configured one.
Returns:
-
str–urlif given, elseLGND_GEO_MCP_URLif set, elseDEFAULT_URL.
default_token_directory ¶
default_token_directory() -> Path
Return the default directory for stored sign-in tokens.
Returns:
-
Path–~/.config/lgnd_geo_sdk/tokens.
DEFAULT_URL
module-attribute
¶
DEFAULT_URL = 'https://geo.lgnd.ai/mcp'
The server URL used when none is given: LGND Geo's MCP server.
URL_ENVIRONMENT_VARIABLE
module-attribute
¶
URL_ENVIRONMENT_VARIABLE = 'LGND_GEO_MCP_URL'
The environment variable that overrides the server URL.
API_KEY_ENVIRONMENT_VARIABLE
module-attribute
¶
API_KEY_ENVIRONMENT_VARIABLE = 'LGND_GEO_API_KEY'
The environment variable holding an API key.