Refactor into package, add 6 new tools, add 96 tests
Split the monolithic syncthing_mcp.py into a proper src/syncthing_mcp/ package with focused modules: client, models, registry, server, and tool submodules (system, folders, devices, config, instances). New tools: browse_folder, file_info, folder_need (file-level queries), override_folder, revert_folder (conflict resolution), check_upgrade (system management). Bumps tool count from 30 to 36. Adds comprehensive test suite (96 tests) using pytest + respx for HTTP mocking, covering client methods, registry logic, model validation, and all tool functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b54c09cd5
commit
3a33d34bd1
26 files changed
+3398
-1897
No files matched your search
@@ -0,0 +1,29 @@
|
||||
"""FastMCP server creation and lifespan."""
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
from syncthing_mcp.registry import get_all_instances
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def app_lifespan(app):
|
||||
import sys
|
||||
|
||||
instances = get_all_instances()
|
||||
missing = [n for n, c in instances.items() if not c.api_key]
|
||||
if missing:
|
||||
print(f"WARNING: API key missing for instance(s): {missing}", file=sys.stderr)
|
||||
print(
|
||||
f"Syncthing MCP: {len(instances)} instance(s) configured — "
|
||||
f"{list(instances.keys())}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
yield {}
|
||||
|
||||
|
||||
mcp = FastMCP("syncthing_mcp", lifespan=app_lifespan)
|
||||
|
||||
# Import all tool modules so they register with `mcp` via decorators.
|
||||
import syncthing_mcp.tools # noqa: E402, F401
|
||||
Reference in new issue
Block a user