#!/usr/bin/env python3
"""
Test DP-MCP server using actual MCP client.
Make sure your server is running first: uv run python src/dp_mcp/server.py
"""
import asyncio
import httpx
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def test_mcp_tools():
"""Test MCP tools through actual protocol."""
print("๐ Testing DP-MCP server via MCP protocol...")
# Note: This is a simplified example
# For HTTP transport, you'd need to implement the HTTP client
print("๐ To test via MCP protocol:")
print("1. Your server is running at http://127.0.0.1:8888/mcp/")
print("2. Use an MCP-compatible client library")
print("3. Or build a custom HTTP client for the MCP protocol")
# Example of what an MCP request would look like:
mcp_request = {
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"name": "describe_db_table",
"arguments": {
"table_name": "users",
"schema": "public"
}
}
}
print(f"\n๐ Example MCP request:")
print(f"POST http://127.0.0.1:8888/mcp/")
print(f"Content-Type: application/json")
print(f"Accept: text/event-stream")
print(f"\n{mcp_request}")
if __name__ == "__main__":
asyncio.run(test_mcp_tools())