strava-activity-mcp-server 0.1.0__tar.gz → 0.1.1__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,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: strava-activity-mcp-server
3
+ Version: 0.1.1
4
+ Summary: Add your description here
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.13
7
+ Requires-Dist: build>=1.3.0
8
+ Requires-Dist: mcp[cli]>=1.16.0
9
+ Requires-Dist: twine>=6.2.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # strava-activity-mcp-server
13
+
14
+ A small Model Context Protocol (MCP) server that exposes your Strava athlete data to language-model tooling.
15
+
16
+ This package provides a lightweight MCP server which communicates with the Strava API and exposes a few helper tools (authorization URL, token exchange/refresh, and fetching athlete activities) that language models or other local tools can call.
17
+
18
+ The project is intended to be used locally (for example with Claude MCP integrations) and is published on PyPI as `strava-activity-mcp-server`.
19
+
20
+ ## Installation
21
+
22
+ Install from PyPI with pip (recommended inside a virtual environment):
23
+
24
+ ```powershell
25
+ pip install strava-activity-mcp-server
26
+ ```
27
+
28
+ ## Requirements
29
+
30
+ - Python >= 3.13 (see `pyproject.toml`)
31
+ - The package depends on `mcp[cli]` and `requests` (installed from PyPI).
32
+
33
+ ## Quick start
34
+
35
+ After installing, you can run the MCP server using the provided console script or by importing and calling `main()`.
36
+
37
+ Run via the console script (entry point defined in `pyproject.toml`):
38
+
39
+ ```powershell
40
+ strava-activity-mcp-server
41
+ ```
42
+
43
+ Or, from Python:
44
+
45
+ ```python
46
+ from strava_activity_mcp_server import main
47
+ main()
48
+ ```
49
+
50
+ By default the server starts the MCP runtime; when used with an MCP-aware client (for example Claude MCP integrations) the exposed tools become callable.
51
+
52
+ ## Authentication (Strava OAuth)
53
+
54
+ This server requires Strava OAuth credentials to access athlete data. You will need:
55
+
56
+ - STRAVA_CLIENT_ID
57
+ - STRAVA_CLIENT_SECRET
58
+ - STRAVA_REFRESH_TOKEN (or a short-lived access token obtained from the authorization flow)
59
+
60
+ Steps:
61
+
62
+ 1. Create a Strava API application at https://www.strava.com/settings/api and note your Client ID and Client Secret. Use `localhost` as the Authorization Callback Domain.
63
+ 2. Open the authorization URL produced by the `strava://auth/url` tool (see Tools below) in a browser to obtain an authorization code.
64
+ 3. Exchange the code for tokens using `strava://auth/token` or use the included helper to save refresh/access tokens to your environment.
65
+
66
+ For local testing you can also manually set the environment variables before running the server:
67
+
68
+ ```powershell
69
+ $env:STRAVA_CLIENT_ID = "<your client id>";
70
+ $env:STRAVA_CLIENT_SECRET = "<your client secret>";
71
+ $env:STRAVA_REFRESH_TOKEN = "<your refresh token>";
72
+ strava-activity-mcp-server
73
+ ```
74
+
75
+ Note: Keep secrets out of version control. Use a `.env` file and a tool such as `direnv` or your system secrets manager for convenience.
76
+
77
+ ## Exposed Tools (what the server provides)
78
+
79
+ The MCP server exposes the following tools (tool IDs shown):
80
+
81
+ - `strava://auth/url` — Build the Strava OAuth authorization URL. Input: `client_id` (int). Output: URL string to open in a browser.
82
+ - `strava://auth/token` — Exchange an authorization code for access + refresh tokens. Inputs: `code` (str), `client_id` (int), `client_secret` (str). Output: token dict (with `access_token`, `refresh_token`).
83
+ - `strava://athlete/stats` — Fetch recent athlete activities. Input: `token` (str). Output: JSON with activity list.
84
+
85
+ These tools map to the functions implemented in `src/strava_activity_mcp_server/strava_activity_mcp_server.py` and are intended to be called by MCP clients.
86
+
87
+ ## Example flows
88
+
89
+ 1) Get an authorization URL and retrieve tokens
90
+
91
+ - Call `strava://auth/url` with your `client_id` and open the returned URL in your browser.
92
+ - After authorizing, Strava will provide a `code`. Call `strava://auth/token` with `code`, `client_id`, and `client_secret` to receive `access_token` and `refresh_token`.
93
+
94
+ 2) Fetch recent activities
95
+
96
+ - Use `strava://athlete/stats` with a valid access token. If the access token is expired, use the refresh flow to get a new access token.
97
+
98
+ ## Developer notes
99
+
100
+ - The package entry point calls `mcp.run()` which runs the MCP server. If you want to change transport or logging settings, modify `src/strava_activity_mcp_server/__init__.py` or `strava_activity_mcp_server.py`.
101
+ - The code uses the `requests` library for HTTP calls.
102
+
103
+
104
+ ### Client config example and quick inspector test
105
+
106
+ Any MCP-capable client can launch the server using a config similar to the following (example file often called `config.json`):
107
+
108
+ ```json
109
+ {
110
+ "command": "uvx",
111
+ "args": [
112
+ "strava-activity-mcp-server"
113
+ ]
114
+ }
115
+ ```
116
+
117
+ To quickly test the server using the Model Context Protocol inspector tool, run:
118
+
119
+ ```powershell
120
+ npx @modelcontextprotocol/inspector uvx strava-mcp-server
121
+ ```
122
+
123
+ This will attempt to start the server with the `uvx` transport and connect the inspector to the running MCP server instance named `strava-mcp-server`.
124
+
125
+
126
+ ## Contributing
127
+
128
+ Contributions are welcome. Please open issues or pull requests that include a clear description and tests where applicable.
129
+
130
+ ## License
131
+
132
+ This project is licensed under the GNU GENERAL PUBLIC LICENSE — see the `LICENSE` file for details.
133
+
134
+ ## Links
135
+
136
+ - Source: repository root
137
+ - Documentation note: see `ref/mcp_pypi_example.md` for an example MCP configuration
@@ -0,0 +1,126 @@
1
+ # strava-activity-mcp-server
2
+
3
+ A small Model Context Protocol (MCP) server that exposes your Strava athlete data to language-model tooling.
4
+
5
+ This package provides a lightweight MCP server which communicates with the Strava API and exposes a few helper tools (authorization URL, token exchange/refresh, and fetching athlete activities) that language models or other local tools can call.
6
+
7
+ The project is intended to be used locally (for example with Claude MCP integrations) and is published on PyPI as `strava-activity-mcp-server`.
8
+
9
+ ## Installation
10
+
11
+ Install from PyPI with pip (recommended inside a virtual environment):
12
+
13
+ ```powershell
14
+ pip install strava-activity-mcp-server
15
+ ```
16
+
17
+ ## Requirements
18
+
19
+ - Python >= 3.13 (see `pyproject.toml`)
20
+ - The package depends on `mcp[cli]` and `requests` (installed from PyPI).
21
+
22
+ ## Quick start
23
+
24
+ After installing, you can run the MCP server using the provided console script or by importing and calling `main()`.
25
+
26
+ Run via the console script (entry point defined in `pyproject.toml`):
27
+
28
+ ```powershell
29
+ strava-activity-mcp-server
30
+ ```
31
+
32
+ Or, from Python:
33
+
34
+ ```python
35
+ from strava_activity_mcp_server import main
36
+ main()
37
+ ```
38
+
39
+ By default the server starts the MCP runtime; when used with an MCP-aware client (for example Claude MCP integrations) the exposed tools become callable.
40
+
41
+ ## Authentication (Strava OAuth)
42
+
43
+ This server requires Strava OAuth credentials to access athlete data. You will need:
44
+
45
+ - STRAVA_CLIENT_ID
46
+ - STRAVA_CLIENT_SECRET
47
+ - STRAVA_REFRESH_TOKEN (or a short-lived access token obtained from the authorization flow)
48
+
49
+ Steps:
50
+
51
+ 1. Create a Strava API application at https://www.strava.com/settings/api and note your Client ID and Client Secret. Use `localhost` as the Authorization Callback Domain.
52
+ 2. Open the authorization URL produced by the `strava://auth/url` tool (see Tools below) in a browser to obtain an authorization code.
53
+ 3. Exchange the code for tokens using `strava://auth/token` or use the included helper to save refresh/access tokens to your environment.
54
+
55
+ For local testing you can also manually set the environment variables before running the server:
56
+
57
+ ```powershell
58
+ $env:STRAVA_CLIENT_ID = "<your client id>";
59
+ $env:STRAVA_CLIENT_SECRET = "<your client secret>";
60
+ $env:STRAVA_REFRESH_TOKEN = "<your refresh token>";
61
+ strava-activity-mcp-server
62
+ ```
63
+
64
+ Note: Keep secrets out of version control. Use a `.env` file and a tool such as `direnv` or your system secrets manager for convenience.
65
+
66
+ ## Exposed Tools (what the server provides)
67
+
68
+ The MCP server exposes the following tools (tool IDs shown):
69
+
70
+ - `strava://auth/url` — Build the Strava OAuth authorization URL. Input: `client_id` (int). Output: URL string to open in a browser.
71
+ - `strava://auth/token` — Exchange an authorization code for access + refresh tokens. Inputs: `code` (str), `client_id` (int), `client_secret` (str). Output: token dict (with `access_token`, `refresh_token`).
72
+ - `strava://athlete/stats` — Fetch recent athlete activities. Input: `token` (str). Output: JSON with activity list.
73
+
74
+ These tools map to the functions implemented in `src/strava_activity_mcp_server/strava_activity_mcp_server.py` and are intended to be called by MCP clients.
75
+
76
+ ## Example flows
77
+
78
+ 1) Get an authorization URL and retrieve tokens
79
+
80
+ - Call `strava://auth/url` with your `client_id` and open the returned URL in your browser.
81
+ - After authorizing, Strava will provide a `code`. Call `strava://auth/token` with `code`, `client_id`, and `client_secret` to receive `access_token` and `refresh_token`.
82
+
83
+ 2) Fetch recent activities
84
+
85
+ - Use `strava://athlete/stats` with a valid access token. If the access token is expired, use the refresh flow to get a new access token.
86
+
87
+ ## Developer notes
88
+
89
+ - The package entry point calls `mcp.run()` which runs the MCP server. If you want to change transport or logging settings, modify `src/strava_activity_mcp_server/__init__.py` or `strava_activity_mcp_server.py`.
90
+ - The code uses the `requests` library for HTTP calls.
91
+
92
+
93
+ ### Client config example and quick inspector test
94
+
95
+ Any MCP-capable client can launch the server using a config similar to the following (example file often called `config.json`):
96
+
97
+ ```json
98
+ {
99
+ "command": "uvx",
100
+ "args": [
101
+ "strava-activity-mcp-server"
102
+ ]
103
+ }
104
+ ```
105
+
106
+ To quickly test the server using the Model Context Protocol inspector tool, run:
107
+
108
+ ```powershell
109
+ npx @modelcontextprotocol/inspector uvx strava-mcp-server
110
+ ```
111
+
112
+ This will attempt to start the server with the `uvx` transport and connect the inspector to the running MCP server instance named `strava-mcp-server`.
113
+
114
+
115
+ ## Contributing
116
+
117
+ Contributions are welcome. Please open issues or pull requests that include a clear description and tests where applicable.
118
+
119
+ ## License
120
+
121
+ This project is licensed under the GNU GENERAL PUBLIC LICENSE — see the `LICENSE` file for details.
122
+
123
+ ## Links
124
+
125
+ - Source: repository root
126
+ - Documentation note: see `ref/mcp_pypi_example.md` for an example MCP configuration
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "strava-activity-mcp-server"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -0,0 +1,195 @@
1
+ Title: strava-mcp-server
2
+
3
+ URL Source: http://pypi.org/project/strava-mcp-server/
4
+
5
+ Markdown Content:
6
+ Project description
7
+ -------------------
8
+
9
+ ![Image 1: Python Package](https://pypi-camo.freetls.fastly.net/0ecf904318113383d77ec39a9c48b8ba0d2baf38/68747470733a2f2f6769746875622e636f6d2f746f6d656b6b6f7262616b2f7374726176612d6d63702d7365727665722f776f726b666c6f77732f507974686f6e2532305061636b6167652f62616467652e737667)[![Image 2: License: MIT](https://pypi-camo.freetls.fastly.net/8645b002dd7ec1b54275a80574942e7a318e03c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Image 3: Python 3.10](https://pypi-camo.freetls.fastly.net/ea10074cb289a2913e3e6b97173e8b2ce3051997/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d332e31302d626c75652e737667)](https://www.python.org/downloads/release/python-3100/)
10
+
11
+ A [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) server that provides access to the Strava API. It allows language models to query athlete activities data from the Strava API.
12
+
13
+ Available Tools
14
+ ---------------
15
+
16
+ The server exposes the following tools:
17
+
18
+ ### Activities Queries
19
+
20
+ * `get_activities(limit: int = 10)`: Get the authenticated athlete's recent activities
21
+ * `get_activities_by_date_range(start_date: str, end_date: str, limit: int = 30)`: Get activities within a specific date range
22
+ * `get_activity_by_id(activity_id: int)`: Get detailed information about a specific activity
23
+ * `get_recent_activities(days: int = 7, limit: int = 10)`: Get activities from the past X days
24
+
25
+ Dates should be provided in ISO format (`YYYY-MM-DD`).
26
+
27
+ Activity Data Format
28
+ --------------------
29
+
30
+ The server returns activity data with consistent field names and units:
31
+
32
+ | Field | Description | Unit |
33
+ | --- | --- | --- |
34
+ | `name` | Activity name | - |
35
+ | `sport_type` | Type of sport | - |
36
+ | `start_date` | Start date and time | ISO 8601 |
37
+ | `distance_metres` | Distance | meters |
38
+ | `elapsed_time_seconds` | Total elapsed time | seconds |
39
+ | `moving_time_seconds` | Moving time | seconds |
40
+ | `average_speed_mps` | Average speed | meters per second |
41
+ | `max_speed_mps` | Maximum speed | meters per second |
42
+ | `total_elevation_gain_metres` | Total elevation gain | meters |
43
+ | `elev_high_metres` | Highest elevation | meters |
44
+ | `elev_low_metres` | Lowest elevation | meters |
45
+ | `calories` | Calories burned | kcal |
46
+ | `start_latlng` | Start coordinates | [lat, lng] |
47
+ | `end_latlng` | End coordinates | [lat, lng] |
48
+
49
+ Authentication
50
+ --------------
51
+
52
+ To use this server, you'll need to authenticate with the Strava API. Follow these steps:
53
+
54
+ 1. Create a Strava API application:
55
+
56
+ * Go to [Strava API Settings](https://www.strava.com/settings/api)
57
+ * Create an application to get your Client ID and Client Secret
58
+ * Set the Authorization Callback Domain to `localhost`
59
+
60
+ 2. Get your refresh token:
61
+
62
+ * Use the included `get_strava_token.py` script:
63
+
64
+ python get_strava_token.py
65
+
66
+ * Follow the prompts to authorize your application
67
+ * The script will save your tokens to a `.env` file
68
+
69
+ 3. Set environment variables: The server requires the following environment variables:
70
+
71
+ * `STRAVA_CLIENT_ID`: Your Strava API Client ID
72
+ * `STRAVA_CLIENT_SECRET`: Your Strava API Client Secret
73
+ * `STRAVA_REFRESH_TOKEN`: Your Strava API Refresh Token
74
+
75
+ Usage
76
+ -----
77
+
78
+ ### Claude for Desktop
79
+
80
+ Update your `claude_desktop_config.json` (located in `~/Library/Application\ Support/Claude/claude_desktop_config.json` on macOS and `%APPDATA%/Claude/claude_desktop_config.json` on Windows) to include the following:
81
+
82
+ {
83
+ "mcpServers": {
84
+ "strava": {
85
+ "command": "uvx",
86
+ "args": [
87
+ "strava-mcp-server"
88
+ ],
89
+ "env": {
90
+ "STRAVA_CLIENT_ID": "YOUR_CLIENT_ID",
91
+ "STRAVA_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
92
+ "STRAVA_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ ### Claude Web
99
+
100
+ For Claude Web, you can run the server locally and connect it using the MCP extension.
101
+
102
+ Example Queries
103
+ ---------------
104
+
105
+ Once connected, you can ask Claude questions like:
106
+
107
+ * "What are my recent activities?"
108
+ * "Show me my activities from last week"
109
+ * "What was my longest run in the past month?"
110
+ * "Get details about my latest cycling activity"
111
+
112
+ Error Handling
113
+ --------------
114
+
115
+ The server provides human-readable error messages for common issues:
116
+
117
+ * Invalid date formats
118
+ * API authentication errors
119
+ * Network connectivity problems
120
+
121
+ License
122
+ -------
123
+
124
+ This project is licensed under the MIT License - see the LICENSE file for details.
125
+
126
+ Download files
127
+ --------------
128
+
129
+ Download the file for your platform. If you're not sure which to choose, learn more about [installing packages](https://packaging.python.org/tutorials/installing-packages/ "External link").
130
+
131
+ ### Source Distribution
132
+
133
+ ### Built Distribution
134
+
135
+ Filter files by name, interpreter, ABI, and platform.
136
+
137
+ If you're not sure about the file name format, learn more about [wheel file names](https://packaging.python.org/en/latest/specifications/binary-distribution-format/ "External link").
138
+
139
+ Copy a direct link to the current filters [](https://pypi.org/project/strava-mcp-server/#files)
140
+
141
+ File name
142
+
143
+ Interpreter
144
+
145
+ ABI
146
+
147
+ Platform
148
+
149
+ File details
150
+ ------------
151
+
152
+ Details for the file `strava_mcp_server-0.1.3.tar.gz`.
153
+
154
+ ### File metadata
155
+
156
+ * Download URL: [strava_mcp_server-0.1.3.tar.gz](https://files.pythonhosted.org/packages/c5/af/6d0b992c2d5a01b5494d6388e714072ccd47d84a1d0e4ffe9c4e077ad877/strava_mcp_server-0.1.3.tar.gz)
157
+ * Upload date: Feb 28, 2025
158
+ * Size: 6.1 kB
159
+ * Tags: Source
160
+ * Uploaded using Trusted Publishing? No
161
+ * Uploaded via: uv/0.6.0
162
+
163
+ ### File hashes
164
+
165
+ Hashes for strava_mcp_server-0.1.3.tar.gz| Algorithm | Hash digest | |
166
+ | --- | --- | --- |
167
+ | SHA256 | `8713d2e206dec10e65a67d22220677df221c02247ad4bcf0a7a4e0ae2a682202` | |
168
+ | MD5 | `95d9c00594437c032360dd2d3da1667f` | |
169
+ | BLAKE2b-256 | `c5af6d0b992c2d5a01b5494d6388e714072ccd47d84a1d0e4ffe9c4e077ad877` | |
170
+
171
+ [See more details on using hashes here.](https://pip.pypa.io/en/stable/topics/secure-installs/#hash-checking-mode "External link")
172
+
173
+ File details
174
+ ------------
175
+
176
+ Details for the file `strava_mcp_server-0.1.3-py3-none-any.whl`.
177
+
178
+ ### File metadata
179
+
180
+ * Download URL: [strava_mcp_server-0.1.3-py3-none-any.whl](https://files.pythonhosted.org/packages/ed/ae/72c2ea3d9a59a235f89ad0013741add100df968153e6c737b2d199b9a9ba/strava_mcp_server-0.1.3-py3-none-any.whl)
181
+ * Upload date: Feb 28, 2025
182
+ * Size: 7.5 kB
183
+ * Tags: Python 3
184
+ * Uploaded using Trusted Publishing? No
185
+ * Uploaded via: uv/0.6.0
186
+
187
+ ### File hashes
188
+
189
+ Hashes for strava_mcp_server-0.1.3-py3-none-any.whl| Algorithm | Hash digest | |
190
+ | --- | --- | --- |
191
+ | SHA256 | `b048109b3bae7601fcb65285405c38424996bccd59904ba443bb0a7150b00cc8` | |
192
+ | MD5 | `843e3701478e827fc36dfcf9c8e539aa` | |
193
+ | BLAKE2b-256 | `edae72c2ea3d9a59a235f89ad0013741add100df968153e6c737b2d199b9a9ba` | |
194
+
195
+ [See more details on using hashes here.](https://pip.pypa.io/en/stable/topics/secure-installs/#hash-checking-mode "External link")
@@ -784,7 +784,7 @@ wheels = [
784
784
 
785
785
  [[package]]
786
786
  name = "strava-activity-mcp-server"
787
- version = "0.1.0"
787
+ version = "0.1.1"
788
788
  source = { editable = "." }
789
789
  dependencies = [
790
790
  { name = "build" },
@@ -1,21 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: strava-activity-mcp-server
3
- Version: 0.1.0
4
- Summary: Add your description here
5
- License-File: LICENSE
6
- Requires-Python: >=3.13
7
- Requires-Dist: build>=1.3.0
8
- Requires-Dist: mcp[cli]>=1.16.0
9
- Requires-Dist: twine>=6.2.0
10
- Description-Content-Type: text/markdown
11
-
12
- # strava-mcp-server
13
- MCP server that retrieves user activity data from Strava.
14
-
15
- .venv\Scripts\activate
16
-
17
- uv init --build-backend "hatchling"
18
-
19
- uv add mcp["cli"]
20
-
21
- uv run mcp dev scr/strava_mcp_server/strava_mcp_server.py
@@ -1,10 +0,0 @@
1
- # strava-mcp-server
2
- MCP server that retrieves user activity data from Strava.
3
-
4
- .venv\Scripts\activate
5
-
6
- uv init --build-backend "hatchling"
7
-
8
- uv add mcp["cli"]
9
-
10
- uv run mcp dev scr/strava_mcp_server/strava_mcp_server.py