Spaces:
Runtime error
Runtime error
Eddyhzd
commited on
Commit
·
a513f18
1
Parent(s):
2c69e27
test
Browse files
app.py
CHANGED
|
@@ -6,16 +6,14 @@ from mcp import ClientSession, StdioServerParameters
|
|
| 6 |
from mcp.client.stdio import stdio_client
|
| 7 |
|
| 8 |
from anthropic import Anthropic
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
load_dotenv() # load environment variables from .env
|
| 12 |
|
| 13 |
class MCPClient:
|
| 14 |
def __init__(self):
|
| 15 |
# Initialize session and client objects
|
| 16 |
self.session: Optional[ClientSession] = None
|
| 17 |
self.exit_stack = AsyncExitStack()
|
| 18 |
-
self.anthropic = Anthropic()
|
| 19 |
|
| 20 |
async def connect_to_server(self, server_script_path: str):
|
| 21 |
"""Connect to an MCP server
|
|
|
|
| 6 |
from mcp.client.stdio import stdio_client
|
| 7 |
|
| 8 |
from anthropic import Anthropic
|
| 9 |
+
import os
|
|
|
|
|
|
|
| 10 |
|
| 11 |
class MCPClient:
|
| 12 |
def __init__(self):
|
| 13 |
# Initialize session and client objects
|
| 14 |
self.session: Optional[ClientSession] = None
|
| 15 |
self.exit_stack = AsyncExitStack()
|
| 16 |
+
self.anthropic = Anthropic(api_key=os.environ.get("CLE_API_ANTHROPIC"))
|
| 17 |
|
| 18 |
async def connect_to_server(self, server_script_path: str):
|
| 19 |
"""Connect to an MCP server
|