This directory contains configuration examples and test scripts for connecting to SimpleMCP servers using different MCP transports.
SimpleMCP provides two MCP server implementations:
- STDIO Transport (
mcp_server.py) - For local MCP clients (e.g., desktop applications) - HTTP/SSE Transport (
mcp_http_server.py) - For remote MCP clients (e.g., web apps, networked services)
This examples directory helps you:
- Configure MCP clients to use SimpleMCP (with Claude Desktop examples)
- Test both transport methods with example configurations
- Test both servers programmatically with Python
| File | Description |
|---|---|
claude_desktop_config_example.json |
Example STDIO configuration (using Claude Desktop as example) |
claude_code_config_example.json |
Example HTTP/SSE configuration (using Claude Code as example) |
test_mcp_client.py |
Python script to test both MCP servers |
README.md |
This file - comprehensive documentation |
Local MCP clients typically use STDIO transport to communicate with MCP servers. This example uses Claude Desktop.
Step 1: Locate Your Client Config File
Example config file locations for Claude Desktop (other MCP clients may differ):
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Step 2: Edit the Config File
Add the SimpleMCP server configuration to your claude_desktop_config.json:
{
"mcpServers": {
"story-teller": {
"command": "python",
"args": [
"/absolute/path/to/SimpleMCP/mcp_server.py"
]
}
}
}Important: Replace /absolute/path/to/SimpleMCP with the actual absolute path to your SimpleMCP directory.
Step 3: Restart Your MCP Client
Close and reopen your MCP client to load the new configuration.
Step 4: Test the Connection
In your MCP client (example prompts for Claude-based clients):
- "Can you list all the stories?"
- "Please get me the story 'squirrel_and_owl'"
- "What stories are available?"
Troubleshooting
If the server doesn't appear in your MCP client:
- Check the path: Ensure you used an absolute path, not a relative one
- Verify Python: Run
python --versionin terminal to ensure Python is accessible - Install dependencies: In SimpleMCP directory, run
pip install -r requirements.txt - Test manually: Run
python mcp_server.pyto verify it starts without errors - Check logs: Look at your MCP client's logs for error messages
Windows Users
On Windows, use one of these path formats:
"args": ["C:/Users/YourName/SimpleMCP/mcp_server.py"]or
"args": ["C:\\\\Users\\\\YourName\\\\SimpleMCP\\\\mcp_server.py"]MCP clients can connect to HTTP/SSE MCP servers for remote access. This example uses Claude Code CLI.
Step 1: Start the HTTP/SSE Server
First, navigate to your SimpleMCP directory and start the server:
cd /path/to/SimpleMCP
python mcp_http_server.pyYou should see output like:
================================================================================
SimpleMCP HTTP/SSE Server v1.0.0
================================================================================
Server Name: story-teller-http
Transport: SSE (Server-Sent Events)
Host: 0.0.0.0
Port: 8000
SSE Endpoint: http://localhost:8000/sse
...
Optional: Use a custom port:
python mcp_http_server.py --port 8080Step 2: Configure Your MCP Client
Add the server configuration to your MCP client. Example for Claude Code:
{
"mcpServers": {
"story-teller-http": {
"url": "http://localhost:8000/sse"
}
}
}Config file locations vary by client:
- Claude Code: See above paths
- Custom clients: Check your client's documentation
Step 3: Test the Connection
Test your MCP client connection (example prompts for Claude-based clients):
- "Can you list all the stories?"
- "Please get me the story 'bear_loses_roar'"
- "Show me the story about the turtle"
Troubleshooting
If the connection fails:
- Verify server is running: Check that you see the startup banner in your terminal
- Test health endpoint: Open http://localhost:8000/health in a browser
- Check port: Ensure the URL in your config matches the port the server is running on
- Firewall: Ensure your firewall isn't blocking port 8000
- Server logs: Check the terminal where the server is running for error messages
Using with curl
You can test the health endpoint with curl:
curl http://localhost:8000/healthExpected response:
{"status":"healthy","server":"story-teller-http","version":"1.0.0"}The test_mcp_client.py script lets you test both servers programmatically.
Prerequisites
Ensure you have the required dependencies:
pip install mcp httpxTest STDIO Server
This will launch the STDIO server as a subprocess and test it:
python examples/test_mcp_client.py --stdioTest HTTP/SSE Server
First, start the server in one terminal:
python mcp_http_server.pyThen, in another terminal, run the test:
python examples/test_mcp_client.py --httpTest with Custom URL
If you're running the HTTP server on a different port:
python examples/test_mcp_client.py --http --url http://localhost:8080/sseTest Both Servers
You can test both servers at once:
# Make sure HTTP server is running first!
python examples/test_mcp_client.py --stdio --httpUnderstanding the Test Output
The test script will:
- Connect to the server
- List available tools
- Call
list_storiesto get all stories - Call
get_storywith a valid story ID - Call
get_storywith an invalid ID (to test error handling)
Example output:
================================================================================
Testing STDIO MCP Server (mcp_server.py)
================================================================================
Server script: /path/to/SimpleMCP/mcp_server.py
Connecting to STDIO server...
Connected successfully!
--------------------------------------------------------------------------------
Available Tools:
--------------------------------------------------------------------------------
- list_stories: List all available stories...
- get_story: Get a specific story by its ID...
--------------------------------------------------------------------------------
Test 1: Calling list_stories tool
--------------------------------------------------------------------------------
Result:
[
{
"id": "squirrel_and_owl",
"title": "The Curious Squirrel and the Wise Owl"
},
...
]
================================================================================
STDIO Server Test: SUCCESS
================================================================================
Both servers provide the same two tools:
Lists all available stories.
Parameters: None
Returns: JSON array of story objects with id and title fields
Example Response:
[
{
"id": "squirrel_and_owl",
"title": "The Curious Squirrel and the Wise Owl"
},
{
"id": "bear_loses_roar",
"title": "The Bear Who Lost His Roar"
},
{
"id": "turtle_wants_to_fly",
"title": "The Turtle Who Wanted to Fly"
},
{
"id": "lonely_firefly",
"title": "The Lonely Firefly"
},
{
"id": "rabbit_and_carrot",
"title": "The Rabbit and the Magic Carrot"
}
]Retrieves a complete story by its ID.
Parameters:
story_id(string, required): The unique identifier of the story
Valid Story IDs:
squirrel_and_owlbear_loses_roarturtle_wants_to_flylonely_fireflyrabbit_and_carrot
Returns: Formatted story text with title, content, and metadata
Example Response:
# The Curious Squirrel and the Wise Owl
In a grand oak tree lived a wise old owl named Oliver...
[Full story text here]
---
Story ID: squirrel_and_owl
Error Handling: If you request a non-existent story ID, you'll receive an error message:
Error: Story 'invalid_id' not found
| Feature | STDIO (mcp_server.py) |
HTTP/SSE (mcp_http_server.py) |
|---|---|---|
| Transport | STDIO (stdin/stdout) | HTTP with Server-Sent Events |
| Best For | Local desktop clients, subprocess tools | Web clients, remote access, networked services |
| Setup | Configured in client | Server must be started separately |
| Network | Local only (subprocess) | Can be accessed over network |
| Port | N/A | 8000 (configurable) |
| Process Model | Launched by client | Long-running server |
| Health Check | N/A | Available at /health endpoint |
| Debugging | Logs to stderr | Logs to stderr + HTTP responses |
The HTTP/SSE server supports these environment variables:
# Change default port
export MCP_HTTP_PORT=8080
python mcp_http_server.py
# Change default host
export MCP_HTTP_HOST=127.0.0.1
python mcp_http_server.py
# Combine with command-line args
python mcp_http_server.py --port 9000 --host 0.0.0.0If you need to use a specific Python version or virtual environment:
Claude Desktop (STDIO):
{
"mcpServers": {
"story-teller": {
"command": "/path/to/venv/bin/python",
"args": ["/absolute/path/to/SimpleMCP/mcp_server.py"]
}
}
}Command Line (HTTP/SSE):
/path/to/venv/bin/python mcp_http_server.pyTo run the HTTP/SSE server as a background service:
Using nohup (Linux/macOS):
nohup python mcp_http_server.py > /tmp/mcp_server.log 2>&1 &Using screen (Linux/macOS):
screen -dmS mcp python mcp_http_server.py
# To view: screen -r mcpUsing systemd (Linux):
Create /etc/systemd/system/simplemcp.service:
[Unit]
Description=SimpleMCP HTTP/SSE Server
After=network.target
[Service]
Type=simple
User=yourusername
WorkingDirectory=/path/to/SimpleMCP
ExecStart=/usr/bin/python3 /path/to/SimpleMCP/mcp_http_server.py
Restart=on-failure
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl enable simplemcp
sudo systemctl start simplemcp
sudo systemctl status simplemcp- Runs as a subprocess of the client
- Inherits client's permissions
- No network exposure
- Generally safe for local use
- Default binding: 0.0.0.0 (all interfaces) on port 8000
- Security note: This makes the server accessible from your network
- For local-only: Use
--host 127.0.0.1to bind to localhost only - Authentication: Not implemented (add reverse proxy with auth if needed)
- CORS: Enabled by default for browser clients
- Production: Use a reverse proxy (nginx, Apache) with SSL/TLS
Recommended for Production:
# Local-only binding
python mcp_http_server.py --host 127.0.0.1 --port 8000
# Behind nginx with SSL
# Configure nginx to proxy to http://127.0.0.1:80001. "Module 'mcp' not found"
pip install -r requirements.txt2. "Permission denied" when running scripts
chmod +x mcp_server.py mcp_http_server.py examples/test_mcp_client.py3. "Address already in use" (HTTP/SSE server)
# Check what's using port 8000
lsof -i :8000 # macOS/Linux
netstat -ano | findstr :8000 # Windows
# Use a different port
python mcp_http_server.py --port 80804. "Cannot connect to server" (HTTP/SSE)
# Verify server is running
curl http://localhost:8000/health
# Check firewall
sudo ufw allow 8000 # Linux
# Or configure Windows Firewall5. MCP client doesn't see the server
- Use absolute paths in configuration
- Restart your MCP client after config changes
- Check your client's logs for errors
- Verify Python is in system PATH
- Test server manually first
If you encounter issues:
- Check the logs: Both servers log to stderr
- Test manually: Run the servers directly to see error messages
- Use test script: Run
python examples/test_mcp_client.pyto diagnose issues - Check dependencies: Ensure all requirements are installed
- Review documentation: See main README.md for more details
- Customize the stories: Edit
stories/stories.jsonto add your own content - Add more tools: Extend
mcp_server.pyandmcp_http_server.pywith new tools - Build integrations: Use SimpleMCP as a template for your own MCP servers
- Deploy to production: Set up a reverse proxy and authentication
Happy building with SimpleMCP!