패키지 문서 MCP 서버
여러 프로그래밍 언어와 언어 서버 프로토콜(LSP) 기능을 통해 LLM이 패키지 문서에 효율적으로 액세스할 수 있도록 하는 MCP(모델 컨텍스트 프로토콜) 서버입니다.
특징
- 다국어 지원 :
go doc
통한 Go 패키지- 내장된
help()
통한 Python 라이브러리 - 레지스트리 문서(개인 레지스트리 포함)를 통한 NPM 패키지
- crates.io 및 docs.rs를 통한 Rust 크레이트
- 스마트 문서 파싱 :
- 설명, 사용법 및 예시가 포함된 구조화된 출력
- 컨텍스트 과부하를 피하기 위한 집중된 정보
- 특정 심볼/함수 조회 지원
- 문서 전반에 걸친 퍼지 및 정확한 검색 기능
- 고급 검색 기능 :
- 패키지 문서 내 검색
- 유연한 쿼리를 위한 퍼지 매칭
- 관련성 점수가 포함된 컨텍스트 인식 결과
- 검색 결과에서 심볼 추출
- 언어 서버 프로토콜(LSP) 지원 :
- 코드 기호에 대한 호버 정보
- 코드 완성
- 진단(오류 및 경고)
- 현재 TypeScript/JavaScript를 지원합니다.
- 다른 언어로 확장 가능
- 성능 최적화 :
설치
지엑스피1
Smithery를 통해 설치
Smithery를 통해 Claude Desktop용 패키지 문서를 자동으로 설치하려면:
npx -y @smithery/cli install mcp-package-docs --client claude
용법
MCP 서버로서
- MCP 설정 구성에 다음을 추가합니다.
{
"mcpServers": {
"package-docs": {
"command": "npx",
"args": ["-y", "mcp-package-docs"],
"env": {
"ENABLE_LSP": "true" // Optional: Enable Language Server Protocol support
}
}
}
}
- LSP 기능에는 공통 언어 서버에 대한 기본 구성이 포함되어 있습니다.
- TypeScript/JavaScript:
typescript-language-server --stdio
- HTML:
vscode-html-language-server --stdio
- CSS:
vscode-css-language-server --stdio
- JSON:
vscode-json-language-server --stdio
필요한 경우 다음 기본값을 재정의할 수 있습니다.
{
"mcpServers": {
"package-docs": {
"command": "npx",
"args": ["-y", "mcp-package-docs"],
"env": {
"ENABLE_LSP": "true",
"TYPESCRIPT_SERVER": "{\"command\":\"/custom/path/typescript-language-server\",\"args\":[\"--stdio\"]}"
}
}
}
}
- 서버는 다음과 같은 도구를 제공합니다.
go_doc 조회 / go_package 설명
Fetches Go 패키지 문서
{
"name": "describe_go_package",
"arguments": {
"package": "encoding/json", // required
"symbol": "Marshal" // optional
}
}
파이썬 문서 조회 / 파이썬 패키지 설명
Python 패키지 문서를 가져옵니다.
{
"name": "describe_python_package",
"arguments": {
"package": "requests", // required
"symbol": "get" // optional
}
}
설명_녹_패키지
crates.io 및 docs.rs에서 Rust 크레이트 문서를 가져옵니다.
{
"name": "describe_rust_package",
"arguments": {
"package": "serde", // required: crate name
"version": "1.0.219" // optional: specific version
}
}
패키지 문서 검색
패키지 문서 내에서 검색
{
"name": "search_package_docs",
"arguments": {
"package": "requests", // required: package name
"query": "authentication", // required: search query
"language": "python", // required: "go", "python", "npm", "swift", or "rust"
"fuzzy": true // optional: enable fuzzy matching (default: true)
}
}
npm_doc_lookup/npm_package_설명
공개 및 비공개 레지스트리에서 NPM 패키지 문서를 가져옵니다. .npmrc 설정에 따라 적절한 레지스트리를 자동으로 사용합니다.
{
"name": "describe_npm_package",
"arguments": {
"package": "axios", // required - supports both scoped (@org/pkg) and unscoped packages
"version": "1.6.0" // optional
}
}
이 도구는 ~/.npmrc 파일을 읽어 각 패키지에 맞는 올바른 레지스트리를 확인합니다.
- 범위가 지정된 레지스트리 구성을 사용합니다(예: @mycompany:registry=...)
- 개인 레지스트리(GitHub 패키지, GitLab, Nexus, Artifactory 등)를 지원합니다.
- 사용자 정의 레지스트리가 구성되지 않은 경우 기본 npm 레지스트리로 돌아갑니다.
.npmrc 구성 예시:
registry=https://nexus.mycompany.com/repository/npm-group/
@mycompany:registry=https://nexus.mycompany.com/repository/npm-private/
@mycompany-ct:registry=https://npm.pkg.github.com/
언어 서버 프로토콜(LSP) 도구
LSP 지원이 활성화되면 다음과 같은 추가 도구를 사용할 수 있습니다.
get_hover
문서 내 위치에 대한 호버 정보 가져오기
{
"name": "get_hover",
"arguments": {
"languageId": "typescript", // required: language identifier (e.g., "typescript", "javascript")
"filePath": "src/index.ts", // required: path to the source file
"content": "const x = 1;", // required: content of the file
"line": 0, // required: zero-based line number
"character": 6, // required: zero-based character position
"projectRoot": "/path/to/project" // optional: project root directory
}
}
get_completions
문서에서 직위에 대한 완료 제안 받기
{
"name": "get_completions",
"arguments": {
"languageId": "typescript", // required: language identifier
"filePath": "src/index.ts", // required: path to the source file
"content": "const arr = []; arr.", // required: content of the file
"line": 0, // required: zero-based line number
"character": 16, // required: zero-based character position
"projectRoot": "/path/to/project" // optional: project root directory
}
}
진단 받기
문서에 대한 진단 정보(오류, 경고) 가져오기
{
"name": "get_diagnostics",
"arguments": {
"languageId": "typescript", // required: language identifier
"filePath": "src/index.ts", // required: path to the source file
"content": "const x: string = 1;", // required: content of the file
"projectRoot": "/path/to/project" // optional: project root directory
}
}
LLM에서의 사용 예
문서 찾기
// Looking up Go documentation
const goDocResult = await use_mcp_tool({
server_name: "package-docs",
tool_name: "describe_go_package",
arguments: {
package: "encoding/json",
symbol: "Marshal"
}
});
// Looking up Python documentation
const pythonDocResult = await use_mcp_tool({
server_name: "package-docs",
tool_name: "describe_python_package",
arguments: {
package: "requests",
symbol: "post"
}
});
// Looking up Rust documentation
const rustDocResult = await use_mcp_tool({
server_name: "package-docs",
tool_name: "describe_rust_package",
arguments: {
package: "serde"
}
});
// Searching within documentation
const searchResult = await use_mcp_tool({
server_name: "package-docs",
tool_name: "search_package_docs",
arguments: {
package: "serde",
query: "serialize",
language: "rust",
fuzzy: true
}
});
// Using LSP for hover information (when LSP is enabled)
const hoverResult = await use_mcp_tool({
server_name: "package-docs",
tool_name: "get_hover",
arguments: {
languageId: "typescript",
filePath: "src/index.ts",
content: "const axios = require('axios');\naxios.get",
line: 1,
character: 7
}
});
요구 사항
- 노드.js >= 20
- Go(Go 패키지 문서용)
- Python 3(Python 패키지 문서용)
- 인터넷 연결(NPM 패키지 문서 및 Rust 크레이트 문서용)
- 언어 서버(LSP 기능용):
- TypeScript/JavaScript:
npm install -g typescript-language-server typescript
- HTML/CSS/JSON:
npm install -g vscode-langservers-extracted
개발
# Install dependencies
npm i
# Build
npm run build
# Watch mode
npm run watch
기여하다
- 저장소를 포크하세요
- 기능 브랜치를 생성합니다(
git checkout -b feature/amazing-feature
) - 변경 사항을 커밋하세요(
git commit -m 'Add some amazing feature'
) - 브랜치에 푸시(
git push origin feature/amazing-feature
) - 풀 리퀘스트 열기
특허
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.