Security Context MCP Server

Security Context MCP Server

Provides instant access to authoritative security documentation from organizations like OWASP, NIST, and major cloud providers through natural language semantic search. It enables users to retrieve security best practices, frameworks, and vulnerability information directly from a locally cached knowledge base.

Category
访问服务器

README

Security Context MCP Server

An MCP (Model Context Protocol) server that provides instant access to authoritative security documentation from OWASP, NIST, AWS, Google Cloud, SANS, CIS, and other cybersecurity authorities. Think of it as having a security expert at your fingertips.

Features

  • Comprehensive Security Knowledge Base: Aggregates documentation from multiple authoritative sources
  • Semantic Search: Find relevant security guidance using natural language queries
  • Local Caching: Fast, offline-capable access to indexed documentation
  • Multiple Security Domains:
    • OWASP Top 10, Cheat Sheets
    • NIST Cybersecurity Framework, SP 800-53, SP 800-171, Zero Trust
    • AWS Security Best Practices, Well-Architected Framework
    • Google Cloud Security, BeyondCorp Zero Trust
    • SANS/CWE Top 25, CIS Controls
    • CIS Benchmarks

Installation

npm install
npm run build

Initial Setup

Before using the MCP server, fetch and index the security documentation:

npm run fetch-docs

This will:

  1. Download documentation from all configured sources
  2. Index the content for fast semantic search
  3. Cache everything locally in ~/.security-mcp/

The fetch process takes 2-5 minutes depending on your internet connection. You only need to run this once, or periodically to update the documentation.

Usage

As an MCP Server

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "security-context": {
      "command": "node",
      "args": ["/path/to/security-mcp/dist/index.js"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "security-context": {
      "command": "security-mcp"
    }
  }
}

Available Tools

Once configured, Claude will have access to these tools:

1. search_security_docs

Search across all security documentation using natural language.

Example queries:

  • "How do I prevent SQL injection?"
  • "What are AWS IAM best practices?"
  • "Explain zero trust architecture"
  • "NIST incident response guidelines"

Parameters:

  • query (required): Your security question or topic
  • limit (optional): Max results (default: 5)
  • source (optional): Filter to specific source (OWASP, NIST, AWS, Google, SANS, CIS)

2. get_security_context

Get comprehensive context on a topic from multiple sources.

Example:

{
  "topic": "authentication best practices"
}

Returns aggregated information from all relevant sources.

3. list_security_sources

List all available documentation sources and their categories.

4. get_owasp_top10

Get specific OWASP Top 10 vulnerability information.

Parameters:

  • category (optional): Specific category like "A01:2021 - Broken Access Control"

Examples

Example 1: Finding Security Guidance

User: "How should I secure my AWS S3 buckets?"

Claude (using search_security_docs):

Found relevant guidance from AWS Security Best Practices:

  • Enable S3 Block Public Access by default
  • Use IAM roles and policies for access control
  • Enable versioning and Object Lock
  • Implement bucket encryption [... detailed results with links ...]

Example 2: Understanding Frameworks

User: "What is NIST CSF and how do I use it?"

Claude (using get_security_context):

The NIST Cybersecurity Framework provides structured approach to managing risk... [Shows information from multiple NIST sources about CSF functions, implementation tiers, and profiles]

Example 3: Vulnerability Research

User: "Tell me about the latest OWASP Top 10"

Claude (using get_owasp_top10):

OWASP Top 10 2021 includes:

  1. A01:2021 - Broken Access Control
  2. A02:2021 - Cryptographic Failures [... detailed information about each category ...]

Architecture

Components

  • MCP Server (src/index.ts): Main server implementing MCP protocol
  • Vector Store (src/vector/simple-store.ts): TF-IDF based search with local caching
  • Document Sources (src/sources/): Fetchers for each security authority
  • Document Fetcher (src/fetcher.ts): Orchestrates downloading and indexing

Data Flow

  1. Fetch Phase: npm run fetch-docs downloads documentation from sources
  2. Index Phase: Content is processed and indexed with TF-IDF for semantic search
  3. Cache Phase: Indexed documents saved to ~/.security-mcp/documents.json
  4. Query Phase: MCP tools search the indexed cache and return relevant results

Storage

Documents are stored in: ~/.security-mcp/documents.json

To update documentation, simply run npm run fetch-docs again.

Customization

Adding New Sources

Create a new source in src/sources/:

import { DocumentSource, SecurityDocument } from "../types.js";

export class CustomSource implements DocumentSource {
  name = "CustomSource";

  async fetchDocuments(): Promise<SecurityDocument[]> {
    // Fetch and return documents
    return [];
  }
}

Then add it to src/fetcher.ts:

import { CustomSource } from "./sources/custom.js";

const sources = [
  // ... existing sources
  new CustomSource(),
];

Upgrading to Vector Embeddings

The current implementation uses TF-IDF for simplicity and zero external dependencies. For better semantic search, you can upgrade to proper embeddings:

  1. Replace SimpleVectorStore with a real vector DB (ChromaDB, Pinecone, Weaviate)
  2. Add embedding generation using:
    • OpenAI embeddings API
    • Local models via Sentence Transformers
    • Anthropic's Claude API

Updating Documentation

Security documentation changes frequently. Update your cache periodically:

npm run fetch-docs

Consider setting up a cron job to update weekly:

# Run every Sunday at 2am
0 2 * * 0 cd /path/to/security-mcp && npm run fetch-docs

Technical Details

Technologies Used

  • MCP SDK: Official Model Context Protocol implementation
  • TypeScript: Type-safe development
  • Axios & Cheerio: Web scraping and HTML parsing
  • Natural: NLP and TF-IDF search
  • PDF Parse: PDF document processing (for future enhancements)

Performance

  • Initial fetch: 2-5 minutes
  • Index size: ~2-5 MB (for all sources)
  • Search latency: <100ms (local cache)
  • Memory usage: ~50-100 MB

Limitations

  • Web scraping may break if source websites change structure
  • TF-IDF is simpler than embedding-based search
  • No automatic update mechanism (manual refresh required)
  • English language only

Troubleshooting

Documents not found

Run the fetcher to download documentation:

npm run fetch-docs

Server not connecting

Check your MCP configuration in Claude Desktop and ensure the path is correct.

Fetch errors

Some sources may be temporarily unavailable. The fetcher continues with other sources even if one fails.

Empty results

Try different query phrasings or use list_security_sources to see what's available.

Contributing

To add more security sources:

  1. Create a new source file in src/sources/
  2. Implement the DocumentSource interface
  3. Add the source to src/fetcher.ts
  4. Submit a pull request

Potential sources to add:

  • Microsoft Security Best Practices
  • Azure Security
  • PCI DSS guidelines
  • HIPAA security rules
  • ISO 27001/27002
  • SOC 2 requirements

License

MIT

Security & Privacy

  • All documentation is cached locally
  • No external API calls during query time
  • No telemetry or data collection
  • Open source and auditable

Support

For issues or questions:

  • File an issue on GitHub
  • Check the documentation
  • Review the source code

Built with ❤️ for the security community

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选