Fix linter issues and update integration test
- Remove unused imports (signal, yaml, os, socket, ConfigLoader) - Remove unused variable assignments in argument parsers - Update integration test to send initialize request first - Fix test to match new server mode behavior All unit tests pass, integration test needs initialize handshake. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5aacf468a4
commit
d7e617e487
|
|
@ -8,14 +8,11 @@ import sys
|
|||
import asyncio
|
||||
import argparse
|
||||
import json
|
||||
import signal
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any
|
||||
import yaml
|
||||
|
||||
from .proxy import MCPBrowser
|
||||
from .config import ConfigLoader
|
||||
from .default_configs import ConfigManager
|
||||
from .daemon import MCPBrowserDaemon, MCPBrowserClient, get_socket_path, is_daemon_running, kill_daemon_with_children
|
||||
from .logging_config import setup_logging, get_logger
|
||||
|
||||
|
|
@ -695,7 +692,7 @@ Environment:
|
|||
subparsers = parser.add_subparsers(dest="command", help="MCP methods")
|
||||
|
||||
# tools/list command
|
||||
list_tools = subparsers.add_parser("tools-list", help="List available tools")
|
||||
subparsers.add_parser("tools-list", help="List available tools")
|
||||
|
||||
# tools/call command
|
||||
call_tool = subparsers.add_parser("tools-call", help="Call a tool")
|
||||
|
|
@ -703,14 +700,14 @@ Environment:
|
|||
call_tool.add_argument("arguments", help="Tool arguments as JSON")
|
||||
|
||||
# resources/list command
|
||||
list_resources = subparsers.add_parser("resources-list", help="List available resources")
|
||||
subparsers.add_parser("resources-list", help="List available resources")
|
||||
|
||||
# resources/read command
|
||||
read_resource = subparsers.add_parser("resources-read", help="Read a resource")
|
||||
read_resource.add_argument("uri", help="Resource URI")
|
||||
|
||||
# prompts/list command
|
||||
list_prompts = subparsers.add_parser("prompts-list", help="List available prompts")
|
||||
subparsers.add_parser("prompts-list", help="List available prompts")
|
||||
|
||||
# prompts/get command
|
||||
get_prompt = subparsers.add_parser("prompts-get", help="Get a prompt")
|
||||
|
|
@ -762,7 +759,7 @@ Environment:
|
|||
if args.log_level == "TRACE" and config_path is None:
|
||||
from .config import ConfigLoader
|
||||
loader = ConfigLoader()
|
||||
config = loader.load()
|
||||
loader.load()
|
||||
# TRACE level shows raw I/O
|
||||
|
||||
browser = MCPBrowser(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ This client can:
|
|||
4. Act as MCP server (stdin/stdout)
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import asyncio
|
||||
import argparse
|
||||
|
|
@ -22,7 +21,6 @@ from typing import Optional, Dict, Any
|
|||
from .proxy import MCPBrowser
|
||||
from .daemon import MCPBrowserClient, get_socket_path, is_daemon_running
|
||||
from .logging_config import setup_logging, get_logger
|
||||
from .config import ConfigLoader
|
||||
|
||||
|
||||
def start_daemon_if_needed(server_name: Optional[str] = None, timeout: float = 5.0) -> bool:
|
||||
|
|
@ -259,7 +257,7 @@ def main():
|
|||
subparsers = parser.add_subparsers(dest="command", help="Commands")
|
||||
|
||||
# tools/list
|
||||
tools_list = subparsers.add_parser("tools-list", help="List available tools")
|
||||
subparsers.add_parser("tools-list", help="List available tools")
|
||||
|
||||
# tools/call
|
||||
tools_call = subparsers.add_parser("tools-call", help="Call a tool")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ allowing shared state and better performance.
|
|||
import os
|
||||
import json
|
||||
import asyncio
|
||||
import socket
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any
|
||||
import signal
|
||||
|
|
|
|||
|
|
@ -70,6 +70,16 @@ class JSONRPCTestClient:
|
|||
async def test_basic_flow():
|
||||
"""Test basic JSON-RPC flow."""
|
||||
async with JSONRPCTestClient() as client:
|
||||
# First initialize the connection
|
||||
print("Initializing connection...")
|
||||
init_response = await client.send_request("initialize", {
|
||||
"protocolVersion": "2024-11-05",
|
||||
"capabilities": {},
|
||||
"clientInfo": {"name": "test-client", "version": "1.0.0"}
|
||||
})
|
||||
assert init_response.get("result", {}).get("protocolVersion") == "2024-11-05"
|
||||
print("✓ Initialized successfully")
|
||||
|
||||
# Test 1: List tools (should show sparse tools)
|
||||
print("Test 1: Listing tools...")
|
||||
response = await client.send_request("tools/list")
|
||||
|
|
|
|||
Loading…
Reference in New Issue