- Moved scattered scripts, templates, and documentation into organized directories (applications/, scripts/, assets/). - Updated .gitignore to strictly exclude secrets, state files, and IDE configs. - Added comprehensive README.md outlining repository structure and best practices. - Preserved all existing documentation and technical architecture files. - Prepared infrastructure/ for AWS Org and Proxmox Terraform management.
87 lines
2.7 KiB
Markdown
87 lines
2.7 KiB
Markdown
1|# 02 - MCP (Model Context Protocol) — Home
|
|
2|**Purpose:** MCP integration guides and implementation examples.
|
|
3|
|
|
4|## What is MCP?
|
|
5|Model Context Protocol (MCP) is a standardized interface for connecting LLMs to external tools, data sources, and services.
|
|
6|
|
|
7|## MCP Benefits
|
|
8|- **Unified interface** for tool integration
|
|
9|- **Hot-swappable** tool providers
|
|
10|- **Standardized** input/output schemas
|
|
11|- **Type-safe** API definitions
|
|
12|
|
|
13|## Core Concepts
|
|
14|
|
|
15|### Tools
|
|
16|External capabilities exposed to the model:
|
|
17|- File system access
|
|
18|- Database queries
|
|
19|- API endpoints
|
|
20|- Custom business logic
|
|
21|
|
|
22|### Resources
|
|
23|Data sources the model can read:
|
|
24|- Documents
|
|
25|- Configuration files
|
|
26|- Real-time data feeds
|
|
27|- Knowledge bases
|
|
28|
|
|
29|### Prompts
|
|
30|Pre-defined interaction templates:
|
|
31|- Task initiation patterns
|
|
32|- System prompt variations
|
|
33|- Role-definition templates
|
|
34|
|
|
35|## Quick Start
|
|
36|
|
|
37|```bash
|
|
38|# Install MCP server
|
|
39|pip install mcp-server-filesystem mcp-server-sqlite
|
|
40|
|
|
41|# Start a filesystem MCP server
|
|
42|mcp-server-filesystem --path /path/to/allowed/directory
|
|
43|
|
|
44|# Connect via client
|
|
45|from mcp import ClientSession, StdioServerParameters
|
|
46|
|
|
47|async with ClientSession(
|
|
48| stdio_server_parameters=StdioServerParameters(
|
|
49| command="mcp-server-filesystem",
|
|
50| args=["--path", "/path/to/allowed/directory"]
|
|
51| )
|
|
52|) as session:
|
|
53| # List available tools
|
|
54| tools = await session.list_tools()
|
|
55|```
|
|
56|
|
|
57|## Available MCP Servers
|
|
58|
|
|
59|- **Filesystem:** Access documents and configuration files
|
|
60|- **SQL databases:** Query relational databases safely
|
|
61|- **API Gateway:** Connect to REST/GraphQL endpoints
|
|
62|- **Custom Business Logic:** Integrate internal tools and services
|
|
63|
|
|
64|## Security Considerations
|
|
65|
|
|
66|- **Path whitelisting:** Only allow specific directories
|
|
67|- **Query rate limiting:** Prevent resource exhaustion
|
|
68|- **Input sanitization:** Validate all user inputs
|
|
69|- **Token-based access:** Require authentication for sensitive operations
|
|
70|
|
|
71|## Use Cases
|
|
72|
|
|
73|- **Document analysis:** Read and process large document collections
|
|
74|- **Database queries:** Extract insights from operational databases
|
|
75|- **API orchestration:** Coordinate across multiple external services
|
|
76|- **Code generation:** Write and execute code safely
|
|
77|
|
|
78|## References
|
|
79|
|
|
80|- [MCP Specification](https://modelcontextprotocol.io)
|
|
81|- [MCP Server Implementations](https://github.com/modelcontextprotocol/servers)
|
|
82|- [Integration Examples](../03%20-%20AI%20AGENTS%20&%20LEARNING/02%20-%20OpenClaw%20Framework/)
|
|
83|
|
|
84|---
|
|
85|
|
|
86|*MCP integrates seamlessly with OpenClaw agent orchestration for scalable AI applications.*
|
|
87| |