Merge branch 'main' into eugene/add_info

This commit is contained in:
Eugene Yurtsev
2025-03-18 16:37:15 -04:00
4 changed files with 70 additions and 23 deletions

View File

@@ -1,35 +1,62 @@
# 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**.
Cursor needs to be in **agent** mode for this to work.
5. 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

View File

@@ -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
@@ -109,6 +110,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()
@@ -151,6 +161,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)
@@ -167,11 +179,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()
@@ -209,7 +230,6 @@ def main() -> None:
timeout=args.timeout,
settings=settings,
)
print()
print(SPLASH)
print()

View File

@@ -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"

2
uv.lock generated
View File

@@ -259,7 +259,7 @@ cli = [
[[package]]
name = "mcpdoc"
version = "0.0.2"
version = "0.0.3"
source = { editable = "." }
dependencies = [
{ name = "httpx" },