https://github.com/jhj0517/mcp-python-tutorial
Tutorial App For MCP
https://github.com/jhj0517/mcp-python-tutorial
mcp python
Last synced: 3 months ago
JSON representation
Tutorial App For MCP
- Host: GitHub
- URL: https://github.com/jhj0517/mcp-python-tutorial
- Owner: jhj0517
- Created: 2025-03-24T12:10:09.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-24T12:16:37.000Z (3 months ago)
- Last Synced: 2025-03-24T13:26:59.273Z (3 months ago)
- Topics: mcp, python
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- mcp-index - Python MCP Tutorial Server - Set up a local MCP server to interact with a simple database and mock data. Manage resources such as users and posts while utilizing reusable prompts for efficient LLM interactions. (Task and Project Management)
README
# MCP Python Tutorial
Tutorial app for MCP in Python with simple local DB with mocking data## Installation & Run
1. Clone this repository
2. Install dependencies:```bash
pip install -r requirements.txt
```3. Run MCP server:
```bash
mcp dev app.py
```4. Default port for MCP server is `5173`. Access to `http://localhost:5173`.
## MCP Features
This tutorial app demonstrates core MCP concepts.
You can check annotation-per-role in [tutorial_app/mcp_server.py](https://github.com/jhj0517/mcp-python-tutorial/blob/main/tutorial_app/mcp_server.py):### `@mcp.resource`
Basically, this annotation is about the agent "getting" the resource, just like `GET` in the RESTAPI.
- `users://all` - Get all users
- `users://{user_id}/profile` - Get a user's profile
- `posts://all` - Get all posts
- `posts://{post_id}` - Get a post by ID### `@mcp.tool`
This is about the agent "generating" the new resource, just like `POST` in the RESTAPI.
- `create_user` - Create a new user
- `create_post` - Create a new post
- `search_posts` - Search posts by title or content### `@mcp.prompt`
This is just a reusable template to interact with LLM conveniently.
- `user_profile_analysis` - Generate analysis of a user's profile
- `post_feedback` - Interactive prompt for post feedback> [!NOTE]
> For more annotations, please read : https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#core-concepts