File size: 786 Bytes
915aba5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# client_example.py
from mcp import ClientSession, StdioServerParameters
import asyncio

async def run():
    # Start your MCP server
    server_params = StdioServerParameters(
        command="python",
        args=["mcp_server.py"]
    )
    
    async with ClientSession(server_params) as session:
        await session.initialize()
        
        # Call your context-pilot tool
        result = await session.call_tool("context-pilot", {
            "msg": "How do I implement authentication in FastAPI?",
            "chat_history": [
                {"role": "user", "content": "Tell me about Python web frameworks"},
                {"role": "assistant", "content": "Flask and FastAPI are popular..."}
            ]
        })
        
        print(result)

asyncio.run(run())