feat: Implement Docker deployment with configurable SSE/STDIO modes and add get_current_time tool.

This commit is contained in:
2026-01-25 15:56:42 +01:00
parent d8cb818040
commit 32dd756885
13 changed files with 173 additions and 1 deletions

45
test_mcp.py Normal file
View File

@@ -0,0 +1,45 @@
import asyncio
import sys
import os
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def main():
# Get absolute path to the project root
project_dir = os.path.dirname(os.path.abspath(__file__))
# Define the server parameters
server_params = StdioServerParameters(
command="uv",
args=["run", "src/server.py"],
env=os.environ.copy() # Pass current environment including PATH and .env vars
)
print("Connecting to server...")
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Initialize
await session.initialize()
print("Initialized!")
# List tools
print("\n--- Available Tools ---")
tools = await session.list_tools()
for tool in tools.tools:
print(f"- {tool.name}: {tool.description}")
# Call list_calendars
print("\n--- Calling list_calendars ---")
try:
result = await session.call_tool("list_calendars", {})
print("Result:")
for content in result.content:
print(content.text)
except Exception as e:
print(f"Error calling tool: {e}")
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
sys.exit(0)