Skip to content

Commit a0d3704

Browse files
authored
Merge pull request #19 from signnow/feat/add-mcp-resources
Add stateless_http parameter to server and improve list_document_grou…
2 parents 6e156f9 + 4c2ab45 commit a0d3704

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/sn_mcp_server/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from .tools import register_tools
77

88

9-
def create_server(cfg: Settings | None = None) -> FastMCP[Any]:
9+
def create_server(cfg: Settings | None = None, stateless_http: bool = False) -> FastMCP[Any]:
1010
"""Create and configure FastMCP server instance"""
1111
cfg = cfg or load_settings()
1212

13-
mcp: FastMCP[Any] = FastMCP("sn-mcp-server")
13+
mcp: FastMCP[Any] = FastMCP("sn-mcp-server", stateless_http=stateless_http)
1414
register_tools(mcp, cfg)
1515
# load_plugins(mcp, cfg)
1616
return mcp

src/sn_mcp_server/tools/signnow.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _get_token_and_client(token_provider: TokenProvider) -> tuple[str, SignNowAP
7575
return token, client
7676

7777

78-
def _normalize_orders(orders: Any, order_type: type) -> list[Any]:
78+
def _normalize_orders(orders: Any, order_type: type) -> list[Any]: # noqa: ANN401
7979
"""Normalize orders parameter - handle both list and JSON string inputs.
8080
8181
Args:
@@ -132,7 +132,7 @@ def _normalize_orders(orders: Any, order_type: type) -> list[Any]:
132132
raise ValueError(f"Invalid orders type: {type(orders)}")
133133

134134

135-
def bind(mcp: Any, cfg: Any) -> None:
135+
def bind(mcp: Any, cfg: Any) -> None: # noqa: ANN401
136136
# Initialize token provider
137137
token_provider = TokenProvider()
138138

@@ -169,13 +169,21 @@ def _list_document_groups_impl(ctx: Context, limit: int = 50, offset: int = 0) -
169169
token, client = _get_token_and_client(token_provider)
170170
return _list_document_groups(token, client, limit, offset)
171171

172-
@mcp.tool(name="list_document_groups", description="Get simplified list of document groups with basic information." + TOOL_FALLBACK_SUFFIX, tags=["document_group", "list"])
172+
@mcp.tool(
173+
name="list_document_groups",
174+
description=("Get simplified list of documents and document groups with basic information. " "Returns both documents and document groups in a unified format. " + TOOL_FALLBACK_SUFFIX),
175+
tags=["document_group", "list"],
176+
)
173177
def list_document_groups(
174178
ctx: Context,
175179
limit: Annotated[int, Field(ge=1, le=50, description="Maximum number of document groups to return (default: 50, max: 50)")] = 50,
176180
offset: Annotated[int, Field(ge=0, description="Number of document groups to skip for pagination (default: 0)")] = 0,
177181
) -> SimplifiedDocumentGroupsResponse:
178-
"""Provide simplified list of document groups with basic fields.
182+
"""Provide simplified list of documents and document groups with basic fields.
183+
184+
This tool retrieves both individual documents and document groups from SignNow,
185+
presenting them all in a unified format. If you need a list of documents or
186+
a list of document groups, this is the right tool to use.
179187
180188
Args:
181189
limit: Maximum number of document groups to return (default: 50, max: 50)
@@ -186,7 +194,7 @@ def list_document_groups(
186194
@mcp.resource(
187195
"signnow://document-groups/{?limit,offset}",
188196
name="list_document_groups_resource",
189-
description="Get simplified list of document groups with basic information." + RESOURCE_PREFERRED_SUFFIX,
197+
description=("Get simplified list of documents and document groups with basic information. " "Returns both documents and document groups in a unified format. " + RESOURCE_PREFERRED_SUFFIX),
190198
tags=["document_group", "list"],
191199
mime_type="application/json",
192200
)

0 commit comments

Comments
 (0)