Skip to content

Commit

Permalink
cleanup: use MCP_RUN_SESSION_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Jan 7, 2025
1 parent ed4507f commit 2167579
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Login successful!
Session: kabA7w6qH58H7kKOQ5su4v3bX_CeFn4k.Y4l/s/9dQwkjv9r8t/xZFjsn2fkLzf+tkve89P1vKhQ
```

Then set the `MXPC_SESSION_ID` environment variable:
Then set the `MPC_RUN_SESSION_ID` environment variable:

```
$ export MCPX_SESSION_ID=kabA7w6qH58H7kKOQ5su4v3bX_CeFn4k.Y4l/s/9dQwkjv9r8t/xZFjsn2fkLzf+tkve89P1vKhQ
$ export MCP_RUN_SESSION_ID=kabA7w6qH58H7kKOQ5su4v3bX_CeFn4k.Y4l/s/9dQwkjv9r8t/xZFjsn2fkLzf+tkve89P1vKhQ
```

## Python Usage
Expand All @@ -66,7 +66,7 @@ $ pip install git+https://github.com/dylibso/mcpx-py
from mcpx import Client # Import the mcp.run client

client = Client() # Create the client, this will check the
# `MCPX_SESSION_ID` environment variable
# `MCP_RUN_SESSION_ID` environment variable

# Call a tool with the given input
results = client.call("eval-js", {"code": "'Hello, world!'"})
Expand Down Expand Up @@ -155,8 +155,3 @@ mcpx-client tool eval-js '{"code": "2+2"}'
2. Make the file executable: `chmod +x your-model.llamafile`
3. Run in JSON API mode: `./your-model.llamafile --json-api --host 127.0.0.1 --port 8080`
4. Use with the OpenAI provider pointing to `http://localhost:8080`

#### mcp.run Setup

- `MCPX_SESSION_ID`: Your mcp.run session ID

9 changes: 2 additions & 7 deletions mcpx/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,10 @@ def _parse_mcpx_config(filename: str | Path) -> str | None:

def _default_session_id() -> str:
# Allow session id to be specified using MCPX_SESSION_ID
id = os.environ.get("MCPX_SESSION_ID")
id = os.environ.get("MCP_RUN_SESSION_ID", os.environ.get("MCPX_SESSION_ID"))
if id is not None:
return id

# Allow config file to be specified using MCPX_CONFIG
path = os.environ.get("MCPX_CONFIG")
if path is not None:
return _parse_mcpx_config(path)

# Try ~/.config/mcpx/config.json for Linux/macOS
user = Path(os.path.expanduser("~"))
dot_config = user / ".config" / "mcpx" / "config.json"
Expand Down Expand Up @@ -264,7 +259,7 @@ class ClientConfig:
Configures an mcp.run Client
"""

base_url: str = os.environ.get("MCPX_RUN_ORIGIN", "https://www.mcp.run")
base_url: str = os.environ.get("MCP_RUN_ORIGIN", "https://www.mcp.run")
"""
mcp.run base URL
"""
Expand Down

0 comments on commit 2167579

Please sign in to comment.