From 418447ff655cdb5bc2fce8438b98407147c24dc6 Mon Sep 17 00:00:00 2001 From: Ritwij Aryan Parmar Date: Tue, 26 May 2026 11:53:14 -0400 Subject: [PATCH] Improve MCP client compatibility defaults --- README.md | 6 +++--- src/hyperspell_mcp/server.py | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 99a6812..e6a46ce 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Configuration - `HYPERSPELL_TOKEN` should be a valid user or app token (refer to the [Hyperspell docs](https://docs.hyperspell.com/) for how to obtain a user token). -- Some MCP clients don't support resources well (looking at you, Claude Desktop), so we can expose them as tools instead. Set `HYPERSPELL_USE_RESOURCES` to `false` (default) to expose everything as tools, `true` to expose retrieveing single documents or listing collections as resources instead, or `both` if you want it all. +- Some MCP clients don't support resources well (looking at you, Claude Desktop), so we can expose them as tools instead. Set `HYPERSPELL_USE_RESOURCES` to `false` (default) to expose everything as tools, `true` to expose retrieving single documents or listing collections as resources instead, or `both` if you want it all. - Optionally, set `HYPERSPELL_COLLECTION` to the name of the collection you want to query and add data to. If not set, it will use the user's default collection instead. @@ -26,7 +26,7 @@ Note that Claude needs the absolute path to `uv`, which can be found with `which ], "env": { "HYPERSPELL_TOKEN": "", - "USE_RESOURCES": "false" + "HYPERSPELL_USE_RESOURCES": "false" } } } @@ -46,4 +46,4 @@ Then run this to start the inspector: ``` uv run mcp dev src/hyperspell_mcp/server.py -``` \ No newline at end of file +``` diff --git a/src/hyperspell_mcp/server.py b/src/hyperspell_mcp/server.py index 5a8b0f7..a93eebe 100644 --- a/src/hyperspell_mcp/server.py +++ b/src/hyperspell_mcp/server.py @@ -38,7 +38,7 @@ def from_env(cls, env_file: str = ".env") -> "ServerConfig": # Expose resources or tools? # Some MCP clients don't support resources well (looking at you, Claude Desktop), # so we can expose them as tools instead. - tools_or_resources = os.getenv("HYPERSPELL_USE_RESOURCES", "true").lower() + tools_or_resources = os.getenv("HYPERSPELL_USE_RESOURCES", "false").lower() use_resources = tools_or_resources in ("true", "1", "both") use_tools = tools_or_resources in ("false", "0", "both") @@ -96,21 +96,21 @@ async def log( mcp = HyperspellMCPServer(config=ServerConfig.from_env()) -@mcp.tool_or_resource("collection://", name="List Collections") +@mcp.tool_or_resource("collection://", name="list_collections") def list_collections() -> list[Collection]: """Get a list of all collections on Hyperspell""" r = mcp.api.collections.list() return Collection.from_pydantic(r.items) -@mcp.tool_or_resource("collection://{collection_name}", name="Get Collection") +@mcp.tool_or_resource("collection://{collection_name}", name="get_collection") def get_documents(collection_name: str) -> list[Document]: """Get a list of all documents in a collection""" r = mcp.api.documents.list(collection=collection_name) return Document.from_pydantic(r.items) -@mcp.tool_or_resource("document://{document_id}", name="Get Document") +@mcp.tool_or_resource("document://{document_id}", name="get_document") def get_document(document_id: int) -> Document | Error: """Get a document from a collection""" # try: @@ -121,7 +121,7 @@ def get_document(document_id: int) -> Document | Error: @mcp.tool( - name="Search Hyperspell", description="Search Hyperspell for documents and data." + name="search_hyperspell", description="Search Hyperspell for documents and data." ) def query(query: str) -> list[Document]: """Search Hyperspell for documents and data.""" @@ -130,7 +130,7 @@ def query(query: str) -> list[Document]: @mcp.tool( - name="Add File", description="Add a file or website from a URL to Hyperspell." + name="add_file", description="Add a file or website from a URL to Hyperspell." ) def add_file(url: str) -> DocumentStatus: """Add a file or URL to Hyperspell.""" @@ -139,7 +139,7 @@ def add_file(url: str) -> DocumentStatus: @mcp.tool( - name="Add Memory", + name="add_memory", description="Add a plain text document or memory to Hyperspell.", ) def add_memory(text: str, title: str | None = None) -> DocumentStatus: