Merge pull request #4 from langchain-ai/eugene/add_info

add info level log to sse by default
This commit is contained in:
Eugene Yurtsev
2025-03-18 16:38:40 -04:00
committed by GitHub
3 changed files with 30 additions and 9 deletions

View File

@@ -85,6 +85,17 @@ def parse_args() -> argparse.Namespace:
help="Transport protocol for MCP server", help="Transport protocol for MCP server",
) )
parser.add_argument(
"--log-level",
type=str,
default="INFO",
help=(
"Log level for the server. Use one on the following: DEBUG, INFO, "
"WARNING, ERROR."
" (only used with --transport sse)"
),
)
# SSE-specific options # SSE-specific options
parser.add_argument( parser.add_argument(
"--host", "--host",
@@ -209,6 +220,7 @@ def main() -> None:
settings = { settings = {
"host": args.host, "host": args.host,
"port": args.port, "port": args.port,
"log_level": "INFO",
} }
# Create and run the server # Create and run the server
@@ -218,14 +230,15 @@ def main() -> None:
timeout=args.timeout, timeout=args.timeout,
settings=settings, settings=settings,
) )
print()
print(SPLASH)
print()
print( if args.transport == "sse":
f"Launching MCPDOC server with {len(doc_sources)} doc sources", print()
file=sys.stderr, print(SPLASH)
) print()
print(
f"Launching MCPDOC server with {len(doc_sources)} doc sources",
)
# Pass transport-specific options # Pass transport-specific options
server.run(transport=args.transport) server.run(transport=args.transport)

View File

@@ -42,7 +42,15 @@ def create_server(
settings: dict | None = None, settings: dict | None = None,
) -> FastMCP: ) -> FastMCP:
"""Create the server and generate tools.""" """Create the server and generate tools."""
server = FastMCP(name="llms-txt", **settings) server = FastMCP(
name="llms-txt",
instructions=(
"Use the list doc sources tool to see available documentation "
"sources. Once you have a source, use fetch docs to get the "
"documentation"
),
**settings,
)
httpx_client = httpx.AsyncClient(follow_redirects=follow_redirects, timeout=timeout) httpx_client = httpx.AsyncClient(follow_redirects=follow_redirects, timeout=timeout)
@server.tool() @server.tool()

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "mcpdoc" name = "mcpdoc"
version = "0.0.3" version = "0.0.4"
description = "Server llms-txt documentation over MCP" description = "Server llms-txt documentation over MCP"
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"