The MCP Package Documentation Server provides efficient access to package documentation across multiple programming languages, along with Language Server Protocol (LSP) capabilities to enhance developer workflows. It enables LLMs to reference accurate, up-to-date documentation from various package ecosystems.
You can run the MCP server using npm:
npm install mcp-package-docs
Add the following to your MCP settings configuration:
{
"mcpServers": {
"package-docs": {
"command": "npx",
"args": ["-y", "mcp-package-docs"],
"env": {
"ENABLE_LSP": "true"
}
}
}
}
The server includes default configurations for common language servers:
typescript-language-server --stdio
vscode-html-language-server --stdio
vscode-css-language-server --stdio
vscode-json-language-server --stdio
You can override these defaults if needed:
{
"mcpServers": {
"package-docs": {
"command": "npx",
"args": ["-y", "mcp-package-docs"],
"env": {
"ENABLE_LSP": "true",
"TYPESCRIPT_SERVER": "{\"command\":\"/custom/path/typescript-language-server\",\"args\":[\"--stdio\"]}"
}
}
}
}
Fetch Go package documentation:
{
"name": "describe_go_package",
"arguments": {
"package": "encoding/json", // required
"symbol": "Marshal" // optional
}
}
Fetch Python package documentation:
{
"name": "describe_python_package",
"arguments": {
"package": "requests", // required
"symbol": "get" // optional
}
}
Fetch Rust crate documentation:
{
"name": "describe_rust_package",
"arguments": {
"package": "serde", // required: crate name
"version": "1.0.219" // optional: specific version
}
}
Fetch NPM package documentation from public and private registries:
{
"name": "describe_npm_package",
"arguments": {
"package": "axios", // required - supports both scoped (@org/pkg) and unscoped packages
"version": "1.6.0" // optional
}
}
The tool reads your ~/.npmrc file to determine the correct registry for each package, supporting:
Search within package documentation:
{
"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)
}
}
When LSP support is enabled, the following tools become available:
{
"name": "get_hover",
"arguments": {
"languageId": "typescript", // required: language identifier
"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
}
}
{
"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
}
}
Here's how to use the documentation tools from an 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"
}
});
// 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
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
}
});
npm install -g typescript-language-server typescript
npm install -g vscode-langservers-extracted
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "package-docs" '{"command":"npx","args":["-y","mcp-package-docs"],"env":{"ENABLE_LSP":"true"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"package-docs": {
"command": "npx",
"args": [
"-y",
"mcp-package-docs"
],
"env": {
"ENABLE_LSP": "true"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"package-docs": {
"command": "npx",
"args": [
"-y",
"mcp-package-docs"
],
"env": {
"ENABLE_LSP": "true"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect