mseep-fastapi-mcp-sse 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: mseep-fastapi-mcp-sse
3
+ Version: 0.1.2
4
+ Summary: A working example to create a FastAPI server with SSE-based MCP support
5
+ Home-page:
6
+ Author: mseep
7
+ Author-email: mseep <support@skydeck.ai>
8
+ Maintainer-email: mseep <support@skydeck.ai>
9
+ Requires-Python: >=3.6
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: fastapi>=0.115.11
13
+ Requires-Dist: httpx>=0.28.1
14
+ Requires-Dist: mcp[cli]>=1.3.0
15
+ Requires-Dist: unicorn>=2.1.3
16
+ Dynamic: author
17
+ Dynamic: license-file
18
+ Dynamic: requires-python
19
+
20
+ # Package managed by MseeP.ai
@@ -0,0 +1 @@
1
+ # Package managed by MseeP.ai
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mseep-fastapi-mcp-sse"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "A working example to create a FastAPI server with SSE-based MCP support"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: mseep-fastapi-mcp-sse
3
+ Version: 0.1.2
4
+ Summary: A working example to create a FastAPI server with SSE-based MCP support
5
+ Home-page:
6
+ Author: mseep
7
+ Author-email: mseep <support@skydeck.ai>
8
+ Maintainer-email: mseep <support@skydeck.ai>
9
+ Requires-Python: >=3.6
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: fastapi>=0.115.11
13
+ Requires-Dist: httpx>=0.28.1
14
+ Requires-Dist: mcp[cli]>=1.3.0
15
+ Requires-Dist: unicorn>=2.1.3
16
+ Dynamic: author
17
+ Dynamic: license-file
18
+ Dynamic: requires-python
19
+
20
+ # Package managed by MseeP.ai
@@ -1,200 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mseep-fastapi-mcp-sse
3
- Version: 0.1.1
4
- Summary: A working example to create a FastAPI server with SSE-based MCP support
5
- Home-page:
6
- Author: mseep
7
- Author-email: mseep <support@skydeck.ai>
8
- Maintainer-email: mseep <support@skydeck.ai>
9
- Requires-Python: >=3.6
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: fastapi>=0.115.11
13
- Requires-Dist: httpx>=0.28.1
14
- Requires-Dist: mcp[cli]>=1.3.0
15
- Requires-Dist: unicorn>=2.1.3
16
- Dynamic: author
17
- Dynamic: license-file
18
- Dynamic: requires-python
19
-
20
- # FastAPI MCP SSE
21
-
22
- <p align="center">
23
- <strong>English</strong> | <a href="/README.zh-CN.md">简体中文</a>
24
- </p>
25
-
26
- A Server-Sent Events (SSE) implementation using FastAPI framework with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) integration.
27
-
28
- ## What is MCP?
29
-
30
- The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that enables AI models to interact with external tools and data sources. MCP solves several key challenges in AI development:
31
-
32
- - **Context limitations**: Allows models to access up-to-date information beyond their training data
33
- - **Tool integration**: Provides a standardized way for models to use external tools and APIs
34
- - **Interoperability**: Creates a common interface between different AI models and tools
35
- - **Extensibility**: Makes it easy to add new capabilities to AI systems without retraining
36
-
37
- This project demonstrates how to implement MCP using Server-Sent Events (SSE) in a FastAPI web application.
38
-
39
- ## Description
40
-
41
- This project demonstrates how to implement Server-Sent Events (SSE) using the FastAPI framework while integrating Model Context Protocol (MCP) functionality. The key feature is the seamless integration of MCP's SSE capabilities within a full-featured FastAPI web application that includes custom routes.
42
-
43
- ## Features
44
-
45
- - Server-Sent Events (SSE) implementation with MCP
46
- - FastAPI framework integration with custom routes
47
- - Unified web application with both MCP and standard web endpoints
48
- - Customizable route structure
49
- - Clean separation of concerns between MCP and web functionality
50
-
51
- ## Architecture
52
-
53
- This project showcases a modular architecture that:
54
-
55
- 1. Integrates MCP SSE endpoints (`/sse` and `/messages/`) into a FastAPI application
56
- 2. Provides standard web routes (`/`, `/about`, `/status`, `/docs`, `/redoc`)
57
- 3. Demonstrates how to maintain separation between MCP functionality and web routes
58
-
59
- ## Installation & Usage Options
60
-
61
- ### Prerequisites
62
-
63
- Install [UV Package Manager](https://docs.astral.sh/uv/) - A fast Python package installer written in Rust:
64
-
65
- ```cmd
66
- powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
67
- ```
68
-
69
- ### Option 1: Quick Run Without Installation
70
-
71
- Run the application directly without cloning the repository using UV's execution tool:
72
-
73
- ```cmd
74
- uvx --from git+https://github.com/panz2018/fastapi_mcp_sse.git start
75
- ```
76
-
77
- ### Option 2: Full Installation
78
-
79
- #### Create Virtual Environment
80
-
81
- Create an isolated Python environment for the project:
82
-
83
- ```cmd
84
- uv venv
85
- ```
86
-
87
- #### Activate Virtual Environment
88
-
89
- Activate the virtual environment to use it:
90
-
91
- ```cmd
92
- .venv\Scripts\activate
93
- ```
94
-
95
- #### Install Dependencies
96
-
97
- Install all required packages:
98
-
99
- ```cmd
100
- uv pip install -r pyproject.toml
101
- ```
102
-
103
- #### Start the Integrated Server
104
-
105
- Launch the integrated FastAPI server with MCP SSE functionality:
106
-
107
- ```cmd
108
- python src/server.py
109
- ```
110
-
111
- or
112
-
113
- ```cmd
114
- uv run start
115
- ```
116
-
117
- ### Available Endpoints
118
-
119
- After starting the server (using either Option 1 or Option 2), the following endpoints will be available:
120
-
121
- - Main server: http://localhost:8000
122
- - Standard web routes:
123
- - Home page: http://localhost:8000/
124
- - About page: http://localhost:8000/about
125
- - Status API: http://localhost:8000/status
126
- - Documentation (Swagger UI): http://localhost:8000/docs
127
- - Documentation (ReDoc): http://localhost:8000/redoc
128
- - MCP SSE endpoints:
129
- - SSE endpoint: http://localhost:8000/sse
130
- - Message posting: http://localhost:8000/messages/
131
-
132
- ### Debug with MCP Inspector
133
-
134
- For testing and debugging MCP functionality, use the MCP Inspector:
135
-
136
- ```cmd
137
- mcp dev ./src/weather.py
138
- ```
139
-
140
- ### Connect to MCP Inspector
141
-
142
- 1. Open MCP Inspector at http://localhost:5173
143
- 2. Configure the connection:
144
- - Set Transport Type to `SSE`
145
- - Enter URL: http://localhost:8000/sse
146
- - Click `Connect`
147
-
148
- ### Test the Functions
149
-
150
- 1. Navigate to `Tools` section
151
- 2. Click `List Tools` to see available functions:
152
- - `get_alerts` : Get weather alerts
153
- - `get_forcast` : Get weather forecast
154
- 3. Select a function
155
- 4. Enter required parameters
156
- 5. Click `Run Tool` to execute
157
-
158
- ## Extending the Application
159
-
160
- ### Adding Custom Routes
161
-
162
- The application structure makes it easy to add new routes using FastAPI's APIRouter:
163
-
164
- 1. Define new route handlers in routes.py using the APIRouter:
165
-
166
- ```python
167
- @router.get("/new-route")
168
- async def new_route():
169
- return {"message": "This is a new route"}
170
- ```
171
-
172
- 2. All routes defined with the router will be automatically included in the main application
173
-
174
- ### Customizing MCP Integration
175
-
176
- The MCP SSE functionality is integrated in server.py through:
177
-
178
- - Creating an SSE transport
179
- - Setting up an SSE handler
180
- - Adding MCP routes to the FastAPI application
181
-
182
- ## Integration with [Continue](https://www.continue.dev/)
183
-
184
- To use this MCP server with the Continue VS Code extension, add the following configuration to your Continue settings:
185
-
186
- ```json
187
- {
188
- "experimental": {
189
- "modelContextProtocolServers": [
190
- {
191
- "transport": {
192
- "name": "weather",
193
- "type": "sse",
194
- "url": "http://localhost:8000/sse"
195
- }
196
- }
197
- ]
198
- }
199
- }
200
- ```
@@ -1,181 +0,0 @@
1
- # FastAPI MCP SSE
2
-
3
- <p align="center">
4
- <strong>English</strong> | <a href="/README.zh-CN.md">简体中文</a>
5
- </p>
6
-
7
- A Server-Sent Events (SSE) implementation using FastAPI framework with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) integration.
8
-
9
- ## What is MCP?
10
-
11
- The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that enables AI models to interact with external tools and data sources. MCP solves several key challenges in AI development:
12
-
13
- - **Context limitations**: Allows models to access up-to-date information beyond their training data
14
- - **Tool integration**: Provides a standardized way for models to use external tools and APIs
15
- - **Interoperability**: Creates a common interface between different AI models and tools
16
- - **Extensibility**: Makes it easy to add new capabilities to AI systems without retraining
17
-
18
- This project demonstrates how to implement MCP using Server-Sent Events (SSE) in a FastAPI web application.
19
-
20
- ## Description
21
-
22
- This project demonstrates how to implement Server-Sent Events (SSE) using the FastAPI framework while integrating Model Context Protocol (MCP) functionality. The key feature is the seamless integration of MCP's SSE capabilities within a full-featured FastAPI web application that includes custom routes.
23
-
24
- ## Features
25
-
26
- - Server-Sent Events (SSE) implementation with MCP
27
- - FastAPI framework integration with custom routes
28
- - Unified web application with both MCP and standard web endpoints
29
- - Customizable route structure
30
- - Clean separation of concerns between MCP and web functionality
31
-
32
- ## Architecture
33
-
34
- This project showcases a modular architecture that:
35
-
36
- 1. Integrates MCP SSE endpoints (`/sse` and `/messages/`) into a FastAPI application
37
- 2. Provides standard web routes (`/`, `/about`, `/status`, `/docs`, `/redoc`)
38
- 3. Demonstrates how to maintain separation between MCP functionality and web routes
39
-
40
- ## Installation & Usage Options
41
-
42
- ### Prerequisites
43
-
44
- Install [UV Package Manager](https://docs.astral.sh/uv/) - A fast Python package installer written in Rust:
45
-
46
- ```cmd
47
- powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
48
- ```
49
-
50
- ### Option 1: Quick Run Without Installation
51
-
52
- Run the application directly without cloning the repository using UV's execution tool:
53
-
54
- ```cmd
55
- uvx --from git+https://github.com/panz2018/fastapi_mcp_sse.git start
56
- ```
57
-
58
- ### Option 2: Full Installation
59
-
60
- #### Create Virtual Environment
61
-
62
- Create an isolated Python environment for the project:
63
-
64
- ```cmd
65
- uv venv
66
- ```
67
-
68
- #### Activate Virtual Environment
69
-
70
- Activate the virtual environment to use it:
71
-
72
- ```cmd
73
- .venv\Scripts\activate
74
- ```
75
-
76
- #### Install Dependencies
77
-
78
- Install all required packages:
79
-
80
- ```cmd
81
- uv pip install -r pyproject.toml
82
- ```
83
-
84
- #### Start the Integrated Server
85
-
86
- Launch the integrated FastAPI server with MCP SSE functionality:
87
-
88
- ```cmd
89
- python src/server.py
90
- ```
91
-
92
- or
93
-
94
- ```cmd
95
- uv run start
96
- ```
97
-
98
- ### Available Endpoints
99
-
100
- After starting the server (using either Option 1 or Option 2), the following endpoints will be available:
101
-
102
- - Main server: http://localhost:8000
103
- - Standard web routes:
104
- - Home page: http://localhost:8000/
105
- - About page: http://localhost:8000/about
106
- - Status API: http://localhost:8000/status
107
- - Documentation (Swagger UI): http://localhost:8000/docs
108
- - Documentation (ReDoc): http://localhost:8000/redoc
109
- - MCP SSE endpoints:
110
- - SSE endpoint: http://localhost:8000/sse
111
- - Message posting: http://localhost:8000/messages/
112
-
113
- ### Debug with MCP Inspector
114
-
115
- For testing and debugging MCP functionality, use the MCP Inspector:
116
-
117
- ```cmd
118
- mcp dev ./src/weather.py
119
- ```
120
-
121
- ### Connect to MCP Inspector
122
-
123
- 1. Open MCP Inspector at http://localhost:5173
124
- 2. Configure the connection:
125
- - Set Transport Type to `SSE`
126
- - Enter URL: http://localhost:8000/sse
127
- - Click `Connect`
128
-
129
- ### Test the Functions
130
-
131
- 1. Navigate to `Tools` section
132
- 2. Click `List Tools` to see available functions:
133
- - `get_alerts` : Get weather alerts
134
- - `get_forcast` : Get weather forecast
135
- 3. Select a function
136
- 4. Enter required parameters
137
- 5. Click `Run Tool` to execute
138
-
139
- ## Extending the Application
140
-
141
- ### Adding Custom Routes
142
-
143
- The application structure makes it easy to add new routes using FastAPI's APIRouter:
144
-
145
- 1. Define new route handlers in routes.py using the APIRouter:
146
-
147
- ```python
148
- @router.get("/new-route")
149
- async def new_route():
150
- return {"message": "This is a new route"}
151
- ```
152
-
153
- 2. All routes defined with the router will be automatically included in the main application
154
-
155
- ### Customizing MCP Integration
156
-
157
- The MCP SSE functionality is integrated in server.py through:
158
-
159
- - Creating an SSE transport
160
- - Setting up an SSE handler
161
- - Adding MCP routes to the FastAPI application
162
-
163
- ## Integration with [Continue](https://www.continue.dev/)
164
-
165
- To use this MCP server with the Continue VS Code extension, add the following configuration to your Continue settings:
166
-
167
- ```json
168
- {
169
- "experimental": {
170
- "modelContextProtocolServers": [
171
- {
172
- "transport": {
173
- "name": "weather",
174
- "type": "sse",
175
- "url": "http://localhost:8000/sse"
176
- }
177
- }
178
- ]
179
- }
180
- }
181
- ```
@@ -1,200 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mseep-fastapi-mcp-sse
3
- Version: 0.1.1
4
- Summary: A working example to create a FastAPI server with SSE-based MCP support
5
- Home-page:
6
- Author: mseep
7
- Author-email: mseep <support@skydeck.ai>
8
- Maintainer-email: mseep <support@skydeck.ai>
9
- Requires-Python: >=3.6
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: fastapi>=0.115.11
13
- Requires-Dist: httpx>=0.28.1
14
- Requires-Dist: mcp[cli]>=1.3.0
15
- Requires-Dist: unicorn>=2.1.3
16
- Dynamic: author
17
- Dynamic: license-file
18
- Dynamic: requires-python
19
-
20
- # FastAPI MCP SSE
21
-
22
- <p align="center">
23
- <strong>English</strong> | <a href="/README.zh-CN.md">简体中文</a>
24
- </p>
25
-
26
- A Server-Sent Events (SSE) implementation using FastAPI framework with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) integration.
27
-
28
- ## What is MCP?
29
-
30
- The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that enables AI models to interact with external tools and data sources. MCP solves several key challenges in AI development:
31
-
32
- - **Context limitations**: Allows models to access up-to-date information beyond their training data
33
- - **Tool integration**: Provides a standardized way for models to use external tools and APIs
34
- - **Interoperability**: Creates a common interface between different AI models and tools
35
- - **Extensibility**: Makes it easy to add new capabilities to AI systems without retraining
36
-
37
- This project demonstrates how to implement MCP using Server-Sent Events (SSE) in a FastAPI web application.
38
-
39
- ## Description
40
-
41
- This project demonstrates how to implement Server-Sent Events (SSE) using the FastAPI framework while integrating Model Context Protocol (MCP) functionality. The key feature is the seamless integration of MCP's SSE capabilities within a full-featured FastAPI web application that includes custom routes.
42
-
43
- ## Features
44
-
45
- - Server-Sent Events (SSE) implementation with MCP
46
- - FastAPI framework integration with custom routes
47
- - Unified web application with both MCP and standard web endpoints
48
- - Customizable route structure
49
- - Clean separation of concerns between MCP and web functionality
50
-
51
- ## Architecture
52
-
53
- This project showcases a modular architecture that:
54
-
55
- 1. Integrates MCP SSE endpoints (`/sse` and `/messages/`) into a FastAPI application
56
- 2. Provides standard web routes (`/`, `/about`, `/status`, `/docs`, `/redoc`)
57
- 3. Demonstrates how to maintain separation between MCP functionality and web routes
58
-
59
- ## Installation & Usage Options
60
-
61
- ### Prerequisites
62
-
63
- Install [UV Package Manager](https://docs.astral.sh/uv/) - A fast Python package installer written in Rust:
64
-
65
- ```cmd
66
- powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
67
- ```
68
-
69
- ### Option 1: Quick Run Without Installation
70
-
71
- Run the application directly without cloning the repository using UV's execution tool:
72
-
73
- ```cmd
74
- uvx --from git+https://github.com/panz2018/fastapi_mcp_sse.git start
75
- ```
76
-
77
- ### Option 2: Full Installation
78
-
79
- #### Create Virtual Environment
80
-
81
- Create an isolated Python environment for the project:
82
-
83
- ```cmd
84
- uv venv
85
- ```
86
-
87
- #### Activate Virtual Environment
88
-
89
- Activate the virtual environment to use it:
90
-
91
- ```cmd
92
- .venv\Scripts\activate
93
- ```
94
-
95
- #### Install Dependencies
96
-
97
- Install all required packages:
98
-
99
- ```cmd
100
- uv pip install -r pyproject.toml
101
- ```
102
-
103
- #### Start the Integrated Server
104
-
105
- Launch the integrated FastAPI server with MCP SSE functionality:
106
-
107
- ```cmd
108
- python src/server.py
109
- ```
110
-
111
- or
112
-
113
- ```cmd
114
- uv run start
115
- ```
116
-
117
- ### Available Endpoints
118
-
119
- After starting the server (using either Option 1 or Option 2), the following endpoints will be available:
120
-
121
- - Main server: http://localhost:8000
122
- - Standard web routes:
123
- - Home page: http://localhost:8000/
124
- - About page: http://localhost:8000/about
125
- - Status API: http://localhost:8000/status
126
- - Documentation (Swagger UI): http://localhost:8000/docs
127
- - Documentation (ReDoc): http://localhost:8000/redoc
128
- - MCP SSE endpoints:
129
- - SSE endpoint: http://localhost:8000/sse
130
- - Message posting: http://localhost:8000/messages/
131
-
132
- ### Debug with MCP Inspector
133
-
134
- For testing and debugging MCP functionality, use the MCP Inspector:
135
-
136
- ```cmd
137
- mcp dev ./src/weather.py
138
- ```
139
-
140
- ### Connect to MCP Inspector
141
-
142
- 1. Open MCP Inspector at http://localhost:5173
143
- 2. Configure the connection:
144
- - Set Transport Type to `SSE`
145
- - Enter URL: http://localhost:8000/sse
146
- - Click `Connect`
147
-
148
- ### Test the Functions
149
-
150
- 1. Navigate to `Tools` section
151
- 2. Click `List Tools` to see available functions:
152
- - `get_alerts` : Get weather alerts
153
- - `get_forcast` : Get weather forecast
154
- 3. Select a function
155
- 4. Enter required parameters
156
- 5. Click `Run Tool` to execute
157
-
158
- ## Extending the Application
159
-
160
- ### Adding Custom Routes
161
-
162
- The application structure makes it easy to add new routes using FastAPI's APIRouter:
163
-
164
- 1. Define new route handlers in routes.py using the APIRouter:
165
-
166
- ```python
167
- @router.get("/new-route")
168
- async def new_route():
169
- return {"message": "This is a new route"}
170
- ```
171
-
172
- 2. All routes defined with the router will be automatically included in the main application
173
-
174
- ### Customizing MCP Integration
175
-
176
- The MCP SSE functionality is integrated in server.py through:
177
-
178
- - Creating an SSE transport
179
- - Setting up an SSE handler
180
- - Adding MCP routes to the FastAPI application
181
-
182
- ## Integration with [Continue](https://www.continue.dev/)
183
-
184
- To use this MCP server with the Continue VS Code extension, add the following configuration to your Continue settings:
185
-
186
- ```json
187
- {
188
- "experimental": {
189
- "modelContextProtocolServers": [
190
- {
191
- "transport": {
192
- "name": "weather",
193
- "type": "sse",
194
- "url": "http://localhost:8000/sse"
195
- }
196
- }
197
- ]
198
- }
199
- }
200
- ```