mirror of
https://github.com/langchain-ai/mcpdoc.git
synced 2025-10-19 03:18:14 +03:00
x
This commit is contained in:
61
README.md
61
README.md
@@ -1,35 +1,60 @@
|
|||||||
# MCP LLMS-TXT Documentation Server
|
# MCP LLMS-TXT Documentation Server
|
||||||
|
|
||||||
A Model Control Protocol (MCP) server for serving documentation from llms.txt files.
|
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.
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install mcpdoc
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## 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
|
### 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
|
4. Launch claude code
|
||||||
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
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
### Command-line Interface
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from typing import List, Dict
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from mcpdoc._version import __version__
|
||||||
from mcpdoc.main import create_server, DocSource
|
from mcpdoc.main import create_server, DocSource
|
||||||
from mcpdoc.splash import SPLASH
|
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)",
|
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()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@@ -140,6 +150,8 @@ def create_doc_sources_from_urls(urls: List[str]) -> List[DocSource]:
|
|||||||
"""
|
"""
|
||||||
doc_sources = []
|
doc_sources = []
|
||||||
for entry in urls:
|
for entry in urls:
|
||||||
|
if not entry.strip():
|
||||||
|
continue
|
||||||
if ":" in entry and not entry.startswith(("http:", "https:")):
|
if ":" in entry and not entry.startswith(("http:", "https:")):
|
||||||
# Format is name:url
|
# Format is name:url
|
||||||
name, url = entry.split(":", 1)
|
name, url = entry.split(":", 1)
|
||||||
@@ -156,11 +168,20 @@ def main() -> None:
|
|||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
# No arguments, print help
|
# No arguments, print help
|
||||||
# Use the same custom formatter as parse_args()
|
# Use the same custom formatter as parse_args()
|
||||||
argparse.ArgumentParser(
|
help_parser = argparse.ArgumentParser(
|
||||||
description="MCP LLMS-TXT Documentation Server",
|
description="MCP LLMS-TXT Documentation Server",
|
||||||
formatter_class=CustomFormatter,
|
formatter_class=CustomFormatter,
|
||||||
epilog=EPILOG,
|
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)
|
sys.exit(0)
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
@@ -197,7 +218,6 @@ def main() -> None:
|
|||||||
timeout=args.timeout,
|
timeout=args.timeout,
|
||||||
settings=settings,
|
settings=settings,
|
||||||
)
|
)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print(SPLASH)
|
print(SPLASH)
|
||||||
print()
|
print()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "mcpdoc"
|
name = "mcpdoc"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user