refactor: rename file asset MCP service
Rename the Streamable HTTP MCP server and generated client config key from obsidian-wiki to wiki-file-assets so remote agents see the narrower file lookup purpose. Keep existing tool names unchanged and cover the service name in tests.
This commit is contained in:
@@ -350,7 +350,7 @@ Client configuration example:
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"obsidian-wiki": {
|
||||
"wiki-file-assets": {
|
||||
"type": "streamable-http",
|
||||
"url": "http://127.0.0.1:8765/mcp",
|
||||
"headers": {
|
||||
|
||||
@@ -28,6 +28,7 @@ DEFAULT_HTTP_HOST = "127.0.0.1"
|
||||
DEFAULT_HTTP_PORT = 8765
|
||||
DEFAULT_HTTP_PATH = "/mcp"
|
||||
DEFAULT_TOKEN_ENV = "OBSIDIAN_MCP_TOKEN"
|
||||
MCP_SERVER_NAME = "wiki-file-assets"
|
||||
|
||||
|
||||
def bearer_token(authorization: str) -> str:
|
||||
@@ -100,7 +101,7 @@ def create_server(
|
||||
allowed_origins=allowed_origins or [],
|
||||
)
|
||||
server = FastMCP(
|
||||
"obsidian-wiki",
|
||||
MCP_SERVER_NAME,
|
||||
host=host,
|
||||
port=port,
|
||||
streamable_http_path=streamable_http_path,
|
||||
|
||||
@@ -24,6 +24,7 @@ from obsidian_wiki.config import resolve_vault_path
|
||||
|
||||
SERVICE_NAME = "obsidian-wiki-mcp.service"
|
||||
ENV_RELATIVE_PATH = Path(".runtime") / "obsidian-wiki-mcp.env"
|
||||
MCP_CLIENT_NAME = "wiki-file-assets"
|
||||
DEFAULT_HOST = "0.0.0.0"
|
||||
DEFAULT_PORT = 8765
|
||||
DEFAULT_PATH = "/mcp"
|
||||
@@ -264,7 +265,7 @@ def render_remote_config(
|
||||
"Example MCP client config:\n"
|
||||
"{\n"
|
||||
' "mcpServers": {\n'
|
||||
' "obsidian-wiki": {\n'
|
||||
f' "{MCP_CLIENT_NAME}": {{\n'
|
||||
' "type": "streamable-http",\n'
|
||||
f' "url": "{url}",\n'
|
||||
' "headers": {\n'
|
||||
|
||||
@@ -97,6 +97,34 @@ class RemoteMcpServerTests(unittest.TestCase):
|
||||
self.assertTrue(fake_server.inner.called)
|
||||
self.assertEqual(messages[0]["status"], 200)
|
||||
|
||||
def test_create_server_uses_file_asset_service_name(self):
|
||||
class FakeMCP:
|
||||
names = []
|
||||
|
||||
def __init__(self, name, **kwargs):
|
||||
self.names.append(name)
|
||||
|
||||
def tool(self):
|
||||
def decorator(func):
|
||||
return func
|
||||
|
||||
return decorator
|
||||
|
||||
def resource(self, *_args, **_kwargs):
|
||||
def decorator(func):
|
||||
return func
|
||||
|
||||
return decorator
|
||||
|
||||
with (
|
||||
tempfile.TemporaryDirectory() as tmp,
|
||||
patch.dict("sys.modules", {"mcp.server.fastmcp": type("Mod", (), {"FastMCP": FakeMCP})()}),
|
||||
):
|
||||
server = mcp_server.create_server(vault_path=Path(tmp))
|
||||
|
||||
self.assertIsInstance(server, FakeMCP)
|
||||
self.assertEqual(FakeMCP.names[-1], "wiki-file-assets")
|
||||
|
||||
def test_run_http_server_fails_before_server_creation_without_token(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
|
||||
@@ -94,7 +94,8 @@ class McpServiceConfigTests(unittest.TestCase):
|
||||
self.assertIn("Authorization", output)
|
||||
self.assertIn("Bearer test-token", output)
|
||||
self.assertIn('"type": "streamable-http"', output)
|
||||
self.assertIn('"obsidian-wiki"', output)
|
||||
self.assertIn('"wiki-file-assets"', output)
|
||||
self.assertNotIn('"obsidian-wiki"', output)
|
||||
|
||||
def test_new_token_writes_token_without_touching_systemd_when_unit_missing(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
|
||||
Reference in New Issue
Block a user