AWS Amplify Documentation MCP Server

AWS Amplify Documentation MCP Server

Enables searching AWS Amplify documentation using natural language queries with advanced search syntax, smart ranking, and generation selection.

Category
访问服务器

README

AWS Amplify Documentation MCP Server

A Model Context Protocol (MCP) server that provides powerful search functionality for AWS Amplify documentation. This server clones the official AWS Amplify documentation repository and makes it searchable through a simple MCP tool interface.

Features

  • Powerful Search: Search AWS Amplify documentation using natural language queries
  • Advanced Search Syntax: Support for boolean operators, wildcards, field-specific search, and more
  • Smart Results Ranking: Intelligent ranking of search results based on relevance to query
  • Pagination: Navigate through large result sets with pagination support
  • Performance Caching: Caching of search results for improved performance
  • Auto-Updates: Automatic updates of documentation from the official AWS Amplify repository
  • Generation Selection: Choose between Gen 1, Gen 2, or both documentation sets to optimize disk usage and search radius.
  • TypeScript Implementation: Built with TypeScript for better type safety and developer experience

Disclaimer: This is a personal project and is not affiliated with, endorsed by, or officially connected to AWS Amplify or Amazon Web Services. This tool is provided as-is without any guarantees or warranty.

Installation

  1. Clone this repository:
git clone https://github.com/ykethan/amplify-doc-mcp.git
cd amplify-doc-mcp
  1. Install dependencies:
npm install
  1. Build the TypeScript code:
npm run build

Configuration

The server is configured using the docs-mcp.config.json file:

{
  "gitUrl": "https://github.com/aws-amplify/docs.git",
  "gitRef": "main",
  "autoUpdateInterval": 60,
  "toolName": "search_amplify_docs",
  "toolDescription": "Search AWS Amplify documentation using the probe search engine.",
  "ignorePatterns": [
    "node_modules",
    ".git",
    "dist",
    "build",
    "coverage",
    ".vitepress/cache",
    "*.jpg",
    "*.jpeg",
    "*.png",
    "*.gif",
    "*.svg",
    "*.mp4",
    "*.webm"
  ],
  "amplifyGeneration": "gen2"
}

Configuration Options

Option Description Default
gitUrl URL of the Git repository to clone for documentation "https://github.com/aws-amplify/docs.git"
gitRef Git branch or tag to checkout "main"
autoUpdateInterval Interval in minutes to check for updates (0 to disable) 60
dataDir Directory to store documentation data "./data"
toolName Name of the search tool "search_amplify_docs"
toolDescription Description of the search tool "Search AWS Amplify documentation using the probe search engine."
ignorePatterns Array of patterns to ignore when searching ["node_modules", ".git", ...]
amplifyGeneration Which Amplify documentation generation to include "gen2"

Auto-Update Mechanism

The server includes an automatic update mechanism that keeps the documentation up-to-date:

  1. When the server starts, it clones the documentation repository specified in gitUrl.
  2. If autoUpdateInterval is set to a value greater than 0, the server will periodically check for updates.
  3. Every autoUpdateInterval minutes, the server:
    • Fetches the latest changes from the remote repository
    • Checks if the local branch is behind the remote branch
    • If updates are available, pulls the changes automatically
    • If no updates are needed, continues with the current documentation

This ensures that your documentation search results always include the latest information without requiring a server restart.

Usage

Starting the Server

npm start

Or use the provided start script with options:

./start-server.sh [--gen <1|2|both>] [--rebuild]

Options

  • --gen 1: Include only Gen 1 documentation (reduces disk space usage)
  • --gen 2: Include only Gen 2 documentation (default, reduces disk space usage)
  • --gen both: Include both Gen 1 and Gen 2 documentation
  • --rebuild: Force rebuild of data directory

Examples

# Start with Gen 2 documentation (default)
./start-server.sh

# Start with only Gen 1 documentation
./start-server.sh --gen 1

# Start with both Gen 1 and Gen 2 documentation
./start-server.sh --gen both

# Start with only Gen 2 documentation and force rebuild
./start-server.sh --gen 2 --rebuild

Important: When switching between different generation options (e.g., from Gen 1 to Gen 2 or vice versa), it's recommended to use the --rebuild flag to ensure a clean repository. This will remove the data directory and clone the repository again, ensuring that the correct files are included based on the selected generation.

For example:

# Switch from Gen 2 to Gen 1 with a clean rebuild
./start-server.sh --gen 1 --rebuild

# Switch from Gen 1 to Gen 2 with a clean rebuild
./start-server.sh --gen 2 --rebuild

MCP Tool: search_amplify_docs

The server provides a tool called search_amplify_docs that can be used to search the Amplify documentation.

Parameters

Parameter Type Required Default Description
query string Yes - Elasticsearch query string
page number No 1 Page number for pagination
includeContent boolean No false Include content snippets in results
maxResults number No 10 Maximum number of results to return
filesOnly boolean No false Only return file paths without content
useJson boolean No false Return results in JSON format
sessionId string No - Session ID for related searches
fullContent boolean No false Get full content of a specific file
filePath string No - Path to a specific file to get full content

Example Request

{
  "query": "authentication react",
  "page": 1,
  "includeContent": true,
  "maxResults": 15
}

Advanced Search Syntax

The search tool supports advanced search syntax:

  • Exact phrases: "authentication flow"
  • Exclude terms: authentication -flutter
  • Field-specific search: title:authentication
  • Wildcards: auth*
  • Boolean operators: authentication AND (react OR javascript) NOT flutter

How the Query Process Works

When you submit a search query, the server processes it through several steps:

  1. Query Processing: The server parses your query to understand advanced syntax like boolean operators and wildcards.

  2. Directory Optimization: The server uses the directory structure to narrow down which files to search based on your query terms and the selected Amplify generation (Gen 1, Gen 2, or both).

  3. Smart Ranking: Results are ranked using a sophisticated algorithm that considers:

    • Whether the query mentions specific generations (Gen 1 or Gen 2)
    • If the query is about setup, CLI commands, or resource creation
    • The relevance of the document to the query context
    • Exact matches in document titles
    • Match count and document importance
  4. Content Extraction: For each matching file, relevant content is extracted and formatted for display.

  5. Caching: Search results are cached to improve performance for repeated queries.

This intelligent processing ensures that the most relevant documentation appears at the top of your search results, saving you time and effort.

Generation Selection

The server supports three modes for Amplify documentation generation:

1. Gen 2 Only (Default)

"amplifyGeneration": "gen2"
  • Pros: Focused on modern Amplify implementation, reduced disk space usage
  • Recommended for: New projects using Amplify Gen 2 features
  • Default: This is the default setting as Gen 2 is the current version of Amplify

2. Gen 1 Only

"amplifyGeneration": "gen1"
  • Pros: Focused on classic Amplify implementation, reduced disk space usage
  • Recommended for: Legacy projects specifically using Amplify Gen 1 features

3. Both Generations

"amplifyGeneration": "both"
  • Pros: Complete documentation coverage
  • Cons: Larger search area, can cause confusion as Gen 1 and Gen 2 have similar categories
  • Use when: You need to reference both generations simultaneously

Project Structure

  • src/index.ts: Main server implementation
  • src/config.ts: Configuration loading and processing
  • src/git.ts: Git repository management
  • src/cache.ts: Search result caching
  • src/directory.ts: Directory structure management
  • src/types/: TypeScript type definitions
  • scripts/build.js: Build script for preparing documentation
  • bin/mcp: Executable script for running the server

Recommendations for Usage

  1. Optimize for Your Environment:

    • For best search results, use "amplifyGeneration" as "gen1" or "gen2" only
  2. Search Optimization:

    • Use specific technical terms rather than general phrases
    • Include category names to narrow results (e.g., "storage owner access" instead of just "access")
    • Use quotes for exact phrase matching
    • Include abbreviations and alternative terms to improve results
  3. Performance Considerations:

    • Set an appropriate autoUpdateInterval based on your needs (higher values reduce server load)
    • Use the caching system for frequently accessed queries
    • Consider using filesOnly: true for initial broad searches to improve performance

Contributing and Feedback

We welcome contributions and feedback to improve this MCP server. If you have suggestions for:

  • Improving search query results
  • Enhancing the ranking algorithm
  • Adding new features or parameters
  • Optimizing performance

Please open an issue or submit a pull request on GitHub. Your feedback helps make this tool more effective for everyone. Along the way learn something new.

System Requirements

  • Node.js 18.x or higher (tested with Node.js 20.18.2)
  • npm 8.x or higher (tested with npm 10.8.2)

License

This project is licensed under the MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选