QUICK_REF.mdโข2.98 kB
# MCP Wikipedia Server - Quick Reference
## ๐ Quick Start Commands
```bash
# 1. Activate environment
source .venv311/bin/activate
# 2. Start server
cd src/mcp_server && python mcp_server.py
# 3. Test in another terminal
python mcp_client.py
```
## ๐ง Available Tools
| Tool | Purpose | Parameters |
|------|---------|------------|
| `fetch_wikipedia_info` | Search & get article summary | `query: str` |
| `list_wikipedia_sections` | Get article section titles | `topic: str` |
| `get_section_content` | Get specific section content | `topic: str, section_title: str` |
## ๐ ๏ธ Common Commands
### Environment Management
```bash
# Check Python version
python --version
# Activate virtual environment
source .venv311/bin/activate
# Install/update packages
pip install wikipedia mcp fastmcp
# Check installed packages
pip list | grep -E "(wikipedia|mcp|fastmcp)"
```
### Server Operations
```bash
# Start server (blocking)
python mcp_server.py
# Start server in background
python mcp_server.py &
# Stop background server
pkill -f mcp_server.py
```
### Testing & Debugging
```bash
# Test Wikipedia module
python -c "import wikipedia; print(wikipedia.summary('Python')[:100])"
# Test MCP module
python -c "from mcp.server.fastmcp import FastMCP; print('MCP working')"
# Check server status
ps aux | grep mcp_server
```
## ๐ Troubleshooting Quick Fixes
| Issue | Quick Fix |
|-------|-----------|
| `ModuleNotFoundError: wikipedia` | `pip install wikipedia` |
| `ModuleNotFoundError: mcp` | `pip install mcp fastmcp` |
| Wrong Python version | `pyenv local 3.11.10` |
| Virtual env not active | `source .venv311/bin/activate` |
## ๐ Example Usage
### Basic Wikipedia Search
```python
# Tool call example
{
"tool": "fetch_wikipedia_info",
"parameters": {
"query": "Machine Learning"
}
}
```
### Get Article Sections
```python
# Tool call example
{
"tool": "list_wikipedia_sections",
"parameters": {
"topic": "Artificial Intelligence"
}
}
```
### Read Specific Section
```python
# Tool call example
{
"tool": "get_section_content",
"parameters": {
"topic": "Python (programming language)",
"section_title": "History"
}
}
```
## ๐ฏ Project Structure at a Glance
```
MCPClientServer/
โโโ .venv311/ # Python 3.11 environment
โโโ src/mcp_server/ # Main server code
โ โโโ mcp_server.py # Wikipedia MCP server
โ โโโ mcp_client.py # Example client
โโโ GUIDE.md # Detailed guide (this file)
โโโ QUICK_REF.md # This quick reference
```
## ๐ MCP Integration Examples
### Claude Desktop Config
```json
{
"mcpServers": {
"wikipedia": {
"command": "python",
"args": ["/path/to/mcp_server.py"]
}
}
}
```
### VS Code Settings
```json
{
"mcp.servers": {
"wikipedia": {
"command": "python /path/to/mcp_server.py"
}
}
}
```
---
๐ก **Tip**: Bookmark this file for quick reference while developing!