https://github.com/kunchalavikram1427/mcp-example-01
https://github.com/kunchalavikram1427/mcp-example-01
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kunchalavikram1427/mcp-example-01
- Owner: kunchalavikram1427
- Created: 2025-09-01T12:09:21.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-09-01T14:36:11.000Z (about 1 month ago)
- Last Synced: 2025-09-01T16:33:10.133Z (about 1 month ago)
- Language: Python
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MCP Demo
This project demonstrates how to connect a simple **Flask REST API** with a **FastMCP server**, exposing tools, resources, and prompts.
---
## Files
* **`sample_app_flask.py`** — A Flask REST API serving dummy org/employee/project data
* **`mcp_server.py`** — A FastMCP server that:* Exposes tools, resources, and prompts
* Auto-discovers the API schema via `/openapi.json`
* **`requirements.txt`** — Shared dependencies for both components---
## Prerequisites
* Python **3+**
* `curl` (optional, for quick testing)
* (Recommended) `jq` for JSON pretty-printing---
## Setup
```bash
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
```---
## Running the Applications
### 1. Start the Flask Sample App
```bash
python3 sample_app_flask.py
```Verify endpoints:
```bash
curl -s http://127.0.0.1:5000/healthz
curl -s http://127.0.0.1:5000/employees | jq
curl -s "http://127.0.0.1:5000/employees/search?q=dev" | jq
```### 2. Start the MCP Server
```bash
export SAMPLE_API_BASE=http://127.0.0.1:5000 # optional (default is same)
python3 mcp_server.py stdio
```### 3. Configure Claude MCP
Add this snippet to your Claude or VS code configuration(For MAC only. Check official documentation for Windows):
- For Claude(`~/Library/Application\ Support/Claude/claude_desktop_config.json`)
```json
{
"mcpServers": {
"org_mcp": {
"type": "stdio",
"command": "/Users/Vikram.Kunchala/Documents/MCP/venv/bin/python3",
"args": [
"/Users/Vikram.Kunchala/Documents/MCP/mcp_server.py",
"stdio"
],
"env": {
"SAMPLE_API_BASE": "http://127.0.0.1:5000"
}
}
}
}
```- For VS Code(`~/Library/Application\ Support/Code/User/mcp.json`)
```json
{
"mcpServers": {
"org_mcp": {
"type": "stdio",
"command": "/Users/Vikram.Kunchala/Documents/MCP/venv/bin/python3",
"args": [
"/Users/Vikram.Kunchala/Documents/MCP/mcp_server.py",
"stdio"
],
"env": {
"SAMPLE_API_BASE": "http://127.0.0.1:5000"
}
}
}
}
```---
## Example Prompts
For Sample app
- Explain prj_002
- Who is Maria
- Summarize Maria
- List all the projects handled by Maria
- Find employees who know Kubernetes
- List all my employees
- List all my organizations
- Generate an onboarding summary for Asha RaoFor Filesystem
- List all my downloaded filesFor GH MCP Server
- List all my GH repos
- Create a new GH repo called test-mcp-claude and give me instructions to pull the repo locally## MCP Inspector
```bash
npx @modelcontextprotocol/inspector /Users/Vikram.Kunchala/Documents/MCP/venv/bin/python3 /Users/Vikram.Kunchala/Documents/MCP/mcp_server.py stdio
```## Common questions
1. `I’ve built an MCP server locally using Python’s fastmcp library. I’ve connected it to both VS Code and Claude Desktop. However, there’s a difference in behavior: Claude Desktop automatically connects to the MCP server without prompting me to start it, but VS Code requires me to manually start the server. Why does this difference exist?`
This difference comes down to how VS Code and Claude Desktop handle MCP server lifecycle management:
**Claude Desktop:**
- Automatically starts and stops MCP servers based on your configuration
- Manages the server process lifecycle behind the scenes
- When you configure an MCP server in Claude Desktop's settings, it will automatically launch the server when needed and terminate it when the session ends
- This is part of Claude Desktop's integrated MCP experience**VS Code (with MCP extension):**
- Typically requires you to manually start the MCP server process
- The VS Code MCP extension connects to an already-running server rather than managing the server lifecycle itself
- This gives you more control over when servers start/stop, but requires manual intervention
- Some VS Code MCP extensions may have auto-start capabilities, but this varies by extension**Why the difference:**
1. **Architecture philosophy** - Claude Desktop aims for a more seamless, integrated experience where technical details are abstracted away
2. **Process management** - Claude Desktop has built-in process management for MCP servers, while VS Code extensions often expect external process management
3. **User experience** - Claude Desktop prioritizes ease of use, while VS Code tends to give developers more direct controlIf you want VS Code to auto-start your FastMCP server, you might be able to:
- Configure a VS Code task to auto-start the server
- Use a VS Code extension that supports auto-starting MCP servers
- Set up a workspace configuration that launches the server automatically