From efd5958db0cb5185261927acad6316254c0319f6 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Tue, 18 Mar 2025 13:31:15 -0400 Subject: [PATCH] x --- README.md | 61 +++++++++++++++++++++++++++++++++++--------------- mcpdoc/cli.py | 26 ++++++++++++++++++--- pyproject.toml | 2 +- uv.lock | 2 +- 4 files changed, 68 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index bf46d39..de82ec0 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,60 @@ # MCP LLMS-TXT Documentation Server -A Model Control Protocol (MCP) server for serving documentation from llms.txt files. - -## Installation - -```bash -pip install mcpdoc -``` +The MCP LLMS-TXT Documentation Server is a specialized Model Control Protocol (MCP) server that delivers documentation directly from llms.txt files. It serves as a testbed for integrating documentation into IDEs via external **tools**, rather than relying solely on built-in features. While future IDEs may offer robust native support for llms.txt files, this server allows us to experiment with alternative methods, giving us full control over how documentation is retrieved and displayed. ## Usage +### Cursor + +1. Install Cursor: https://www.cursor.com/en +2. Launch the MCP server in **SSE** transport. + + ```shell + uvx --from mcpdoc mcpdoc \ + --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt \ + --transport sse \ + --port 8081 + --host localhost + ``` + +3. Add the mcp server to Cursor. Remember to put the URL as **[host]/sse** for example **http://localhost:8081/sse**. + +4. You should be able to use it within composer now. + ### Claude Code -1. Install uv +1. Install Claude Code: https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview +2. Install [uv](https://github.com/astral-sh/uv). This step is required if you want to run the MCP server in using `uvx` command. This is generally recommended as it'll simplify all the dependency management for you. +3. Configure the MCP server with claude code -2. Add a command to claude that instructs it on how to launch the MCP Server + ```shell + claude mcp add-json langgraph-docs '{"type":"stdio","command":"uvx" ,"args":["--from", "mcpdoc", "mcpdoc", "--urls", "langgraph:https://langchain-ai.github.io/langgraph/llms.txt"]}' -s user + ``` -```shell -claude mcp add-json langgraph-docs '{"type":"stdio","command":"uvx" ,"args":["--from", "mcpdoc", "mcpdoc", "--urls", "langgraph:https://langchain-ai.github.io/langgraph/llms.txt"]}' -s user -``` +4. Launch claude code -3. Launch claude code + ```shell + claude code + ``` + + Verify that the server is running by typing `/mcp` in the chat window. + + ``` + > /mcp + ``` + +5. Test it out! + + ``` + > Write a langgraph application with two agents that debate the merits of taking a shower. + ``` + + +This MCP server was only configured with LangGraph documentation, but you can add more documentation sources by adding more `--urls` arguments or loading it from a JSON file or a YAML file. -```shell -claude code -``` -You can check the status of the mcp serer with `/mcp` command inside of claude -4. Test it out! (For example, "how can i use interrupt in langgraph?") ### Command-line Interface diff --git a/mcpdoc/cli.py b/mcpdoc/cli.py index f31862f..951b962 100644 --- a/mcpdoc/cli.py +++ b/mcpdoc/cli.py @@ -8,6 +8,7 @@ from typing import List, Dict import yaml +from mcpdoc._version import __version__ from mcpdoc.main import create_server, DocSource from mcpdoc.splash import SPLASH @@ -98,6 +99,15 @@ def parse_args() -> argparse.Namespace: help="Port to bind the server to (only used with --transport sse)", ) + # Version information + parser.add_argument( + "--version", + "-V", + action="version", + version=f"mcpdoc {__version__}", + help="Show version information and exit", + ) + return parser.parse_args() @@ -140,6 +150,8 @@ def create_doc_sources_from_urls(urls: List[str]) -> List[DocSource]: """ doc_sources = [] for entry in urls: + if not entry.strip(): + continue if ":" in entry and not entry.startswith(("http:", "https:")): # Format is name:url name, url = entry.split(":", 1) @@ -156,11 +168,20 @@ def main() -> None: if len(sys.argv) == 1: # No arguments, print help # Use the same custom formatter as parse_args() - argparse.ArgumentParser( + help_parser = argparse.ArgumentParser( description="MCP LLMS-TXT Documentation Server", formatter_class=CustomFormatter, epilog=EPILOG, - ).print_help() + ) + # Add version to help parser too + help_parser.add_argument( + "--version", + "-V", + action="version", + version=f"mcpdoc {__version__}", + help="Show version information and exit", + ) + help_parser.print_help() sys.exit(0) args = parse_args() @@ -197,7 +218,6 @@ def main() -> None: timeout=args.timeout, settings=settings, ) - print() print(SPLASH) print() diff --git a/pyproject.toml b/pyproject.toml index f68a076..23a096b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mcpdoc" -version = "0.0.2" +version = "0.0.3" description = "Server llms-txt documentation over MCP" readme = "README.md" requires-python = ">=3.10" diff --git a/uv.lock b/uv.lock index f3cb522..7b96bab 100644 --- a/uv.lock +++ b/uv.lock @@ -259,7 +259,7 @@ cli = [ [[package]] name = "mcpdoc" -version = "0.0.2" +version = "0.0.3" source = { editable = "." } dependencies = [ { name = "httpx" },