MCP Products Server
by lokesh1382
README.md
# š MCP Products Server
A hands-on Python project demonstrating **Model Context Protocol (MCP)** by building a product management server that integrates with Claude Desktop and GitHub Copilot.
## šļø Project Structure
```
create_new_mcp/
ā
āāā mcp_server.py # MCP Server with tools, resource, and prompt template
āāā add_product.py # DB logic to INSERT a product
āāā fetch_products.py # DB logic to SELECT all products
āāā db_connect.py # Database connection helper
āāā .env # API keys and DB credentials (not committed)
āāā .gitignore
āāā README.md
```
---
## āļø MCP Server ā `mcp_server.py`
## š Configuration
### Claude Desktop
Update `claude_desktop_config.json`:
```json
{
"mcpServers": {
"products": {
"command": "uv.exe",
"args": [
"--directory", "C:\\path\\to\\create_new_mcp",
"run", "mcp_server.py"
]
}
}
}
```
### GitHub Copilot
Update `mcp.json` with the same server details.
## š Getting Started
### Prerequisites
- Python 3.10+
- `uv` package manager
- MySQL database
- Claude Desktop or GitHub Copilot
## š Key Learnings
- ā
MCP Tools are invoked directly by the LLM
- ā
MCP Resources are fetched manually via host UI and injected into context
- ā
Prompt Templates enable consistent prompt generation via `/` command
- ā ļø MCP Sampling (server ā LLM callback) is **not yet supported** by Claude Desktop or GitHub Copilot in practice
- š” Workaround for sampling: call Anthropic API directly from the MCP server
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues