codeforces-mcp-avinash 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.

Potentially problematic release.


This version of codeforces-mcp-avinash might be problematic. Click here for more details.

@@ -0,0 +1,216 @@
1
+ The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
2
+
3
+ Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
4
+
5
+ No rights beyond those granted by the applicable original license are conveyed for such contributions.
6
+
7
+ ---
8
+
9
+ Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to the Licensor for inclusion in the Work by the copyright
60
+ owner or by an individual or Legal Entity authorized to submit on behalf
61
+ of the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or
103
+ Derivative Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ ---
187
+
188
+ MIT License
189
+
190
+ Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
191
+
192
+ Permission is hereby granted, free of charge, to any person obtaining a copy
193
+ of this software and associated documentation files (the "Software"), to deal
194
+ in the Software without restriction, including without limitation the rights
195
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
196
+ copies of the Software, and to permit persons to whom the Software is
197
+ furnished to do so, subject to the following conditions:
198
+
199
+ The above copyright notice and this permission notice shall be included in all
200
+ copies or substantial portions of the Software.
201
+
202
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
203
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
204
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
205
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
206
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
208
+ SOFTWARE.
209
+
210
+ ---
211
+
212
+ Creative Commons Attribution 4.0 International (CC-BY-4.0)
213
+
214
+ Documentation in this project (excluding specifications) is licensed under
215
+ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
216
+ the full license text.
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.5
2
+ Name: codeforces-mcp-avinash
3
+ Version: 0.1.1
4
+ Summary: Production MCP server for Codeforces competitive programming, upsolving, and automated stress testing
5
+ Project-URL: Repository, https://github.com/avinash111921/codeforces-mcp
6
+ Author-email: Avinash Verma <your.email@example.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.12
10
+ Requires-Dist: beautifulsoup4>=4.12.3
11
+ Requires-Dist: curl-cffi>=0.9.0
12
+ Requires-Dist: diskcache>=5.6.3
13
+ Requires-Dist: httpx>=0.28.0
14
+ Requires-Dist: mcp[cli]>=1.4.0
15
+ Requires-Dist: pydantic>=2.10.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
18
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
19
+ Requires-Dist: respx>=0.22.0; extra == 'dev'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # MCP Registry
23
+
24
+ mcp-name: io.github.avinash111921/codeforces-mcp
25
+
26
+ The MCP registry provides MCP clients with a list of MCP servers, like an app store for MCP servers.
27
+
28
+ [**📤 Publish my MCP server**](docs/modelcontextprotocol-io/quickstart.mdx) | [**⚡️ Live API docs**](https://registry.modelcontextprotocol.io/docs) | [**👀 Ecosystem vision**](docs/design/ecosystem-vision.md) | 📖 **[Full documentation](./docs)**
29
+
30
+ ## Development Status
31
+
32
+ **2025-10-24 update**: The Registry API has entered an **API freeze (v0.1)** 🎉. For the next month or more, the API will remain stable with no breaking changes, allowing integrators to confidently implement support. This freeze applies to v0.1 while development continues on v0. We'll use this period to validate the API in real-world integrations and gather feedback to shape v1 for general availability. Thank you to everyone for your contributions and patience—your involvement has been key to getting us here!
33
+
34
+ **2025-09-08 update**: The registry has launched in preview 🎉 ([announcement blog post](https://blog.modelcontextprotocol.io/posts/2025-09-08-mcp-registry-preview/)). While the system is now more stable, this is still a preview release and breaking changes or data resets may occur. A general availability (GA) release will follow later. We'd love your feedback in [GitHub discussions](https://github.com/modelcontextprotocol/registry/discussions/new?category=ideas) or in the [#registry-dev Discord](https://discord.com/channels/1358869848138059966/1369487942862504016) ([joining details here](https://modelcontextprotocol.io/community/communication)).
35
+
36
+ Registry Working Group:
37
+ - **Radoslav (Rado) Dimitrov** (Stacklok) [@rdimitrov](https://github.com/rdimitrov) - WG Lead
38
+ - **Tadas Antanavicius** (PulseMCP) [@tadasant](https://github.com/tadasant)
39
+ - **Bob Dickinson** (TeamSpark) [@BobDickinson](https://github.com/BobDickinson)
40
+ - **Preeti (Pree) Dewani** (Ravenmail) [@pree-dew](https://github.com/pree-dew)
41
+
42
+ ## Contributing
43
+
44
+ We use multiple channels for collaboration - see [modelcontextprotocol.io/community/communication](https://modelcontextprotocol.io/community/communication).
45
+
46
+ Often (but not always) ideas flow through this pipeline:
47
+
48
+ - **[Discord](https://modelcontextprotocol.io/community/communication)** - Real-time community discussions
49
+ - **[Discussions](https://github.com/modelcontextprotocol/registry/discussions)** - Propose and discuss product/technical requirements
50
+ - **[Issues](https://github.com/modelcontextprotocol/registry/issues)** - Track well-scoped technical work
51
+ - **[Pull Requests](https://github.com/modelcontextprotocol/registry/pulls)** - Contribute work towards issues
52
+
53
+ ### Quick start:
54
+
55
+ #### Pre-requisites
56
+
57
+ - **Docker**
58
+ - **Go** - version per the `go` directive in [go.mod](./go.mod); the Go toolchain fetches it for you
59
+ - **ko** - Container image builder for Go ([installation instructions](https://ko.build/install/))
60
+ - **golangci-lint** - version per the `golangci-lint-action` pin in [ci.yml](./.github/workflows/ci.yml), so local lint matches CI
61
+
62
+ #### Running the server
63
+
64
+ ```bash
65
+ # Start full development environment
66
+ make dev-compose
67
+ ```
68
+
69
+ This starts the registry at [`localhost:8080`](http://localhost:8080) with PostgreSQL. The database uses ephemeral storage and is reset each time you restart the containers, ensuring a clean state for development and testing.
70
+
71
+ **Note:** The registry uses [ko](https://ko.build) to build container images. The `make dev-compose` command automatically builds the registry image with ko and loads it into your local Docker daemon before starting the services.
72
+
73
+ By default, the registry seeds from the production API with a filtered subset of servers (to keep startup fast). This ensures your local environment mirrors production behavior and all seed data passes validation. For offline development you can seed from a file without validation with `MCP_REGISTRY_SEED_FROM=data/seed.json MCP_REGISTRY_ENABLE_REGISTRY_VALIDATION=false make dev-compose`.
74
+
75
+ The setup can be configured with environment variables in [docker-compose.yml](./docker-compose.yml) - see [.env.example](./.env.example) for a reference.
76
+
77
+ <details>
78
+ <summary>Alternative: Running a pre-built Docker image</summary>
79
+
80
+ Pre-built Docker images are automatically published to GitHub Container Registry. Note that the image does not bundle PostgreSQL, so you need to run your own and point the registry at it via `MCP_REGISTRY_DATABASE_URL` (see [docker-compose.yml](./docker-compose.yml) for a working example):
81
+
82
+ ```bash
83
+ # Run latest stable release
84
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:latest
85
+
86
+ # Run latest from main branch (continuous deployment)
87
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main
88
+
89
+ # Run specific release version
90
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:v1.0.0
91
+
92
+ # Run development build from main branch
93
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main-20250906-abc123d
94
+ ```
95
+
96
+ **Available tags:**
97
+ - **Releases**: `latest`, `v1.0.0`, `v1.1.0`, etc.
98
+ - **Continuous**: `main` (latest main branch build)
99
+ - **Development**: `main-<date>-<sha>` (specific commit builds)
100
+
101
+ </details>
102
+
103
+ #### Publishing a server
104
+
105
+ Publishing an MCP server does **not** happen through a pull request to this repository. Adding a `server.json`, a server directory, or an entry in `data/seed.json` will not publish or list your server, even if the PR is merged. Use the `mcp-publisher` CLI from your server's own project instead.
106
+
107
+ To publish a server, we've built a simple CLI. You can use it with:
108
+
109
+ ```bash
110
+ # Build the latest CLI
111
+ make publisher
112
+
113
+ # Use it!
114
+ ./bin/mcp-publisher --help
115
+ ```
116
+
117
+ See [the publisher guide](./docs/modelcontextprotocol-io/quickstart.mdx) for more details.
118
+
119
+ #### Other commands
120
+
121
+ ```bash
122
+ # Run lint, schema validation, and all tests
123
+ # Note: this also runs `make dev-down`, stopping any running dev-compose environment
124
+ make check
125
+ ```
126
+
127
+ There are also a few more helpful commands for development. Run `make help` to learn more, or look in [Makefile](./Makefile).
128
+
129
+ <!--
130
+ For Claude and other AI tools: Always prefer make targets over custom commands where possible.
131
+ -->
132
+
133
+ ## Architecture
134
+
135
+ ### Project Structure
136
+
137
+ ```
138
+ ├── cmd/ # Application entry points
139
+ │ ├── publisher/ # Server publishing tool
140
+ │ └── registry/ # Registry API server
141
+ ├── data/ # Seed data
142
+ ├── deploy/ # Deployment configuration (Pulumi)
143
+ ├── docs/ # Documentation
144
+ ├── internal/ # Private application code
145
+ │ ├── api/ # HTTP handlers and routing
146
+ │ ├── auth/ # Authentication (GitHub OAuth, JWT, namespace blocking)
147
+ │ ├── config/ # Configuration management
148
+ │ ├── database/ # Data persistence (PostgreSQL)
149
+ │ ├── importer/ # Seed data import
150
+ │ ├── service/ # Business logic
151
+ │ ├── telemetry/ # Metrics and monitoring
152
+ │ └── validators/ # Input validation
153
+ ├── pkg/ # Public packages
154
+ │ ├── api/ # API types and structures
155
+ │ │ └── v0/ # Version 0 API types
156
+ │ └── model/ # Data models for server.json
157
+ ├── scripts/ # Development and testing scripts
158
+ ├── tests/ # Integration tests
159
+ └── tools/ # CLI tools and utilities
160
+ └── validate-*.sh # Schema validation tools
161
+ ```
162
+
163
+ ### Authentication
164
+
165
+ Publishing supports multiple authentication methods:
166
+ - **GitHub OAuth** - For publishing by logging into GitHub
167
+ - **GitHub OIDC** - For publishing from GitHub Actions
168
+ - **DNS verification** - For proving ownership of a domain and its subdomains
169
+ - **HTTP verification** - For proving ownership of a domain
170
+
171
+ The registry validates namespace ownership when publishing. E.g. to publish...:
172
+ - `io.github.domdomegg/my-cool-mcp` you must login to GitHub as `domdomegg`, or be in a GitHub Action on domdomegg's repos
173
+ - `me.adamjones/my-cool-mcp` you must prove ownership of `adamjones.me` via DNS or HTTP challenge
174
+
175
+ ## Community Projects
176
+
177
+ Check out [community projects](docs/community-projects.md) to explore notable registry-related work created by the community.
178
+
179
+ ## More documentation
180
+
181
+ See the [documentation](./docs) for more details if your question has not been answered here!
@@ -0,0 +1,160 @@
1
+ # MCP Registry
2
+
3
+ mcp-name: io.github.avinash111921/codeforces-mcp
4
+
5
+ The MCP registry provides MCP clients with a list of MCP servers, like an app store for MCP servers.
6
+
7
+ [**📤 Publish my MCP server**](docs/modelcontextprotocol-io/quickstart.mdx) | [**⚡️ Live API docs**](https://registry.modelcontextprotocol.io/docs) | [**👀 Ecosystem vision**](docs/design/ecosystem-vision.md) | 📖 **[Full documentation](./docs)**
8
+
9
+ ## Development Status
10
+
11
+ **2025-10-24 update**: The Registry API has entered an **API freeze (v0.1)** 🎉. For the next month or more, the API will remain stable with no breaking changes, allowing integrators to confidently implement support. This freeze applies to v0.1 while development continues on v0. We'll use this period to validate the API in real-world integrations and gather feedback to shape v1 for general availability. Thank you to everyone for your contributions and patience—your involvement has been key to getting us here!
12
+
13
+ **2025-09-08 update**: The registry has launched in preview 🎉 ([announcement blog post](https://blog.modelcontextprotocol.io/posts/2025-09-08-mcp-registry-preview/)). While the system is now more stable, this is still a preview release and breaking changes or data resets may occur. A general availability (GA) release will follow later. We'd love your feedback in [GitHub discussions](https://github.com/modelcontextprotocol/registry/discussions/new?category=ideas) or in the [#registry-dev Discord](https://discord.com/channels/1358869848138059966/1369487942862504016) ([joining details here](https://modelcontextprotocol.io/community/communication)).
14
+
15
+ Registry Working Group:
16
+ - **Radoslav (Rado) Dimitrov** (Stacklok) [@rdimitrov](https://github.com/rdimitrov) - WG Lead
17
+ - **Tadas Antanavicius** (PulseMCP) [@tadasant](https://github.com/tadasant)
18
+ - **Bob Dickinson** (TeamSpark) [@BobDickinson](https://github.com/BobDickinson)
19
+ - **Preeti (Pree) Dewani** (Ravenmail) [@pree-dew](https://github.com/pree-dew)
20
+
21
+ ## Contributing
22
+
23
+ We use multiple channels for collaboration - see [modelcontextprotocol.io/community/communication](https://modelcontextprotocol.io/community/communication).
24
+
25
+ Often (but not always) ideas flow through this pipeline:
26
+
27
+ - **[Discord](https://modelcontextprotocol.io/community/communication)** - Real-time community discussions
28
+ - **[Discussions](https://github.com/modelcontextprotocol/registry/discussions)** - Propose and discuss product/technical requirements
29
+ - **[Issues](https://github.com/modelcontextprotocol/registry/issues)** - Track well-scoped technical work
30
+ - **[Pull Requests](https://github.com/modelcontextprotocol/registry/pulls)** - Contribute work towards issues
31
+
32
+ ### Quick start:
33
+
34
+ #### Pre-requisites
35
+
36
+ - **Docker**
37
+ - **Go** - version per the `go` directive in [go.mod](./go.mod); the Go toolchain fetches it for you
38
+ - **ko** - Container image builder for Go ([installation instructions](https://ko.build/install/))
39
+ - **golangci-lint** - version per the `golangci-lint-action` pin in [ci.yml](./.github/workflows/ci.yml), so local lint matches CI
40
+
41
+ #### Running the server
42
+
43
+ ```bash
44
+ # Start full development environment
45
+ make dev-compose
46
+ ```
47
+
48
+ This starts the registry at [`localhost:8080`](http://localhost:8080) with PostgreSQL. The database uses ephemeral storage and is reset each time you restart the containers, ensuring a clean state for development and testing.
49
+
50
+ **Note:** The registry uses [ko](https://ko.build) to build container images. The `make dev-compose` command automatically builds the registry image with ko and loads it into your local Docker daemon before starting the services.
51
+
52
+ By default, the registry seeds from the production API with a filtered subset of servers (to keep startup fast). This ensures your local environment mirrors production behavior and all seed data passes validation. For offline development you can seed from a file without validation with `MCP_REGISTRY_SEED_FROM=data/seed.json MCP_REGISTRY_ENABLE_REGISTRY_VALIDATION=false make dev-compose`.
53
+
54
+ The setup can be configured with environment variables in [docker-compose.yml](./docker-compose.yml) - see [.env.example](./.env.example) for a reference.
55
+
56
+ <details>
57
+ <summary>Alternative: Running a pre-built Docker image</summary>
58
+
59
+ Pre-built Docker images are automatically published to GitHub Container Registry. Note that the image does not bundle PostgreSQL, so you need to run your own and point the registry at it via `MCP_REGISTRY_DATABASE_URL` (see [docker-compose.yml](./docker-compose.yml) for a working example):
60
+
61
+ ```bash
62
+ # Run latest stable release
63
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:latest
64
+
65
+ # Run latest from main branch (continuous deployment)
66
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main
67
+
68
+ # Run specific release version
69
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:v1.0.0
70
+
71
+ # Run development build from main branch
72
+ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main-20250906-abc123d
73
+ ```
74
+
75
+ **Available tags:**
76
+ - **Releases**: `latest`, `v1.0.0`, `v1.1.0`, etc.
77
+ - **Continuous**: `main` (latest main branch build)
78
+ - **Development**: `main-<date>-<sha>` (specific commit builds)
79
+
80
+ </details>
81
+
82
+ #### Publishing a server
83
+
84
+ Publishing an MCP server does **not** happen through a pull request to this repository. Adding a `server.json`, a server directory, or an entry in `data/seed.json` will not publish or list your server, even if the PR is merged. Use the `mcp-publisher` CLI from your server's own project instead.
85
+
86
+ To publish a server, we've built a simple CLI. You can use it with:
87
+
88
+ ```bash
89
+ # Build the latest CLI
90
+ make publisher
91
+
92
+ # Use it!
93
+ ./bin/mcp-publisher --help
94
+ ```
95
+
96
+ See [the publisher guide](./docs/modelcontextprotocol-io/quickstart.mdx) for more details.
97
+
98
+ #### Other commands
99
+
100
+ ```bash
101
+ # Run lint, schema validation, and all tests
102
+ # Note: this also runs `make dev-down`, stopping any running dev-compose environment
103
+ make check
104
+ ```
105
+
106
+ There are also a few more helpful commands for development. Run `make help` to learn more, or look in [Makefile](./Makefile).
107
+
108
+ <!--
109
+ For Claude and other AI tools: Always prefer make targets over custom commands where possible.
110
+ -->
111
+
112
+ ## Architecture
113
+
114
+ ### Project Structure
115
+
116
+ ```
117
+ ├── cmd/ # Application entry points
118
+ │ ├── publisher/ # Server publishing tool
119
+ │ └── registry/ # Registry API server
120
+ ├── data/ # Seed data
121
+ ├── deploy/ # Deployment configuration (Pulumi)
122
+ ├── docs/ # Documentation
123
+ ├── internal/ # Private application code
124
+ │ ├── api/ # HTTP handlers and routing
125
+ │ ├── auth/ # Authentication (GitHub OAuth, JWT, namespace blocking)
126
+ │ ├── config/ # Configuration management
127
+ │ ├── database/ # Data persistence (PostgreSQL)
128
+ │ ├── importer/ # Seed data import
129
+ │ ├── service/ # Business logic
130
+ │ ├── telemetry/ # Metrics and monitoring
131
+ │ └── validators/ # Input validation
132
+ ├── pkg/ # Public packages
133
+ │ ├── api/ # API types and structures
134
+ │ │ └── v0/ # Version 0 API types
135
+ │ └── model/ # Data models for server.json
136
+ ├── scripts/ # Development and testing scripts
137
+ ├── tests/ # Integration tests
138
+ └── tools/ # CLI tools and utilities
139
+ └── validate-*.sh # Schema validation tools
140
+ ```
141
+
142
+ ### Authentication
143
+
144
+ Publishing supports multiple authentication methods:
145
+ - **GitHub OAuth** - For publishing by logging into GitHub
146
+ - **GitHub OIDC** - For publishing from GitHub Actions
147
+ - **DNS verification** - For proving ownership of a domain and its subdomains
148
+ - **HTTP verification** - For proving ownership of a domain
149
+
150
+ The registry validates namespace ownership when publishing. E.g. to publish...:
151
+ - `io.github.domdomegg/my-cool-mcp` you must login to GitHub as `domdomegg`, or be in a GitHub Action on domdomegg's repos
152
+ - `me.adamjones/my-cool-mcp` you must prove ownership of `adamjones.me` via DNS or HTTP challenge
153
+
154
+ ## Community Projects
155
+
156
+ Check out [community projects](docs/community-projects.md) to explore notable registry-related work created by the community.
157
+
158
+ ## More documentation
159
+
160
+ See the [documentation](./docs) for more details if your question has not been answered here!
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "codeforces-mcp-avinash"
7
+ version = "0.1.1"
8
+ description = "Production MCP server for Codeforces competitive programming, upsolving, and automated stress testing"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ authors = [{ name = "Avinash Verma", email = "your.email@example.com" }]
12
+ urls = { Repository = "https://github.com/avinash111921/codeforces-mcp" }
13
+ license = { text = "MIT" }
14
+ dependencies = [
15
+ "mcp[cli]>=1.4.0",
16
+ "httpx>=0.28.0",
17
+ "curl-cffi>=0.9.0",
18
+ "beautifulsoup4>=4.12.3",
19
+ "pydantic>=2.10.0",
20
+ "diskcache>=5.6.3",
21
+ ]
22
+
23
+ [project.optional-dependencies]
24
+ dev = [
25
+ "pytest>=8.3.0",
26
+ "pytest-asyncio>=0.25.0",
27
+ "respx>=0.22.0",
28
+ ]
29
+
30
+ [project.scripts]
31
+ codeforces-mcp = "codeforces_mcp.server:main"
32
+
33
+ [tool.pytest.ini_options]
34
+ asyncio_mode = "auto"
35
+ testpaths = ["tests"]
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
3
+ "name": "io.github.avinash111921/codeforces-mcp",
4
+ "description": "Production MCP server for Codeforces competitive programming, upsolving, and automated stress testing",
5
+ "version": "0.1.1",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/avinash111921/codeforces-mcp"
9
+ },
10
+ "packages": [
11
+ {
12
+ "registry_type": "pypi",
13
+ "identifier": "codeforces-mcp-avinash",
14
+ "version": "0.1.1"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,64 @@
1
+ import asyncio
2
+ import time
3
+ from pathlib import Path
4
+ from typing import Any
5
+ import httpx
6
+ from diskcache import Cache
7
+
8
+ CACHE_DIR = Path.home() / ".cache" / "codeforces-mcp"
9
+
10
+
11
+ class CodeforcesClient:
12
+ BASE_URL = "https://codeforces.com/api"
13
+
14
+ def __init__(self, rate_limit_delay: float = 2.1) -> None:
15
+ self.rate_limit_delay = rate_limit_delay
16
+ self._lock = asyncio.Lock()
17
+ self._last_call_time = 0.0
18
+ self.cache = Cache(str(CACHE_DIR))
19
+ self._http = httpx.AsyncClient(timeout=15.0)
20
+
21
+ async def _request(self, endpoint: str, params: dict[str, Any] | None = None) -> Any:
22
+ async with self._lock:
23
+ elapsed = time.monotonic() - self._last_call_time
24
+ if elapsed < self.rate_limit_delay:
25
+ await asyncio.sleep(self.rate_limit_delay - elapsed)
26
+
27
+ url = f"{self.BASE_URL}/{endpoint}"
28
+ response = await self._http.get(url, params=params)
29
+ self._last_call_time = time.monotonic()
30
+
31
+ response.raise_for_status()
32
+ data = response.json()
33
+ if data.get("status") != "OK":
34
+ raise RuntimeError(data.get("comment", "Unknown Codeforces API error"))
35
+ return data["result"]
36
+
37
+ async def get_user_info(self, handle: str) -> dict[str, Any]:
38
+ result = await self._request("user.info", {"handles": handle})
39
+ return result[0]
40
+
41
+ async def get_user_submissions(self, handle: str, count: int = 50) -> list[dict[str, Any]]:
42
+ return await self._request("user.status", {"handle": handle, "from": 1, "count": count})
43
+
44
+ async def get_problemset(self) -> dict[str, Any]:
45
+ cached = self.cache.get("problemset_all")
46
+ if cached is not None:
47
+ return cached
48
+ result = await self._request("problemset.problems")
49
+ # Cache the 10,000+ problem catalog for 1 hour
50
+ self.cache.set("problemset_all", result, expire=3600)
51
+ return result
52
+
53
+ async def get_upcoming_contests(self) -> list[dict[str, Any]]:
54
+ cached = self.cache.get("upcoming_contests")
55
+ if cached is not None:
56
+ return cached
57
+ contests = await self._request("contest.list", {"gym": "false"})
58
+ upcoming = [c for c in contests if c.get("phase") == "BEFORE"]
59
+ upcoming.sort(key=lambda x: x.get("startTimeSeconds", 0))
60
+ self.cache.set("upcoming_contests", upcoming, expire=900)
61
+ return upcoming
62
+
63
+ async def close(self) -> None:
64
+ await self._http.aclose()
@@ -0,0 +1,116 @@
1
+ import subprocess
2
+ import tempfile
3
+ import time
4
+ from pathlib import Path
5
+ from typing import Any
6
+
7
+
8
+ def compile_if_cpp(source_path: Path, work_dir: Path) -> list[str]:
9
+ if source_path.suffix == ".cpp":
10
+ exe_path = work_dir / ("sol.exe" if Path.cwd().drive else "sol.out")
11
+ cmd = ["g++", "-O2", "-std=c++20", str(source_path), "-o", str(exe_path)]
12
+ res = subprocess.run(cmd, capture_output=True, text=True, timeout=15)
13
+ if res.returncode != 0:
14
+ raise RuntimeError(f"Compilation Error in {source_path.name}:\n{res.stderr}")
15
+ return [str(exe_path)]
16
+ elif source_path.suffix == ".py":
17
+ return ["python", str(source_path)]
18
+ raise ValueError(f"Unsupported file extension: {source_path.suffix}. Use .cpp or .py")
19
+
20
+
21
+ def execute_cmd(cmd: list[str], stdin_data: str, timeout_sec: float = 2.0) -> dict[str, Any]:
22
+ start = time.perf_counter()
23
+ try:
24
+ proc = subprocess.run(
25
+ cmd,
26
+ input=stdin_data,
27
+ capture_output=True,
28
+ text=True,
29
+ timeout=timeout_sec,
30
+ )
31
+ elapsed_ms = round((time.perf_counter() - start) * 1000, 2)
32
+ return {
33
+ "verdict": "OK" if proc.returncode == 0 else "RTE",
34
+ "stdout": proc.stdout.strip(),
35
+ "stderr": proc.stderr.strip(),
36
+ "time_ms": elapsed_ms,
37
+ }
38
+ except subprocess.TimeoutExpired:
39
+ return {"verdict": "TLE", "stdout": "", "stderr": "Time Limit Exceeded", "time_ms": timeout_sec * 1000}
40
+
41
+
42
+ def run_samples(source_file: str, samples: list[dict[str, str]]) -> dict[str, Any]:
43
+ src = Path(source_file).resolve()
44
+ if not src.exists():
45
+ raise FileNotFoundError(f"File not found: {src}")
46
+
47
+ with tempfile.TemporaryDirectory() as tmp:
48
+ cmd = compile_if_cpp(src, Path(tmp))
49
+ results = []
50
+ all_passed = True
51
+
52
+ for idx, sample in enumerate(samples, start=1):
53
+ run_res = execute_cmd(cmd, sample["input"])
54
+ expected = sample["output"].strip()
55
+ actual = run_res["stdout"]
56
+ passed = (run_res["verdict"] == "OK") and (actual == expected)
57
+ if not passed:
58
+ all_passed = False
59
+
60
+ results.append({
61
+ "test_case": idx,
62
+ "status": "PASSED" if passed else (run_res["verdict"] if run_res["verdict"] != "OK" else "WA"),
63
+ "time_ms": run_res["time_ms"],
64
+ "input": sample["input"],
65
+ "expected_output": expected,
66
+ "actual_output": actual,
67
+ })
68
+
69
+ return {"all_passed": all_passed, "results": results}
70
+
71
+
72
+ def run_stress_test(
73
+ optimal_file: str,
74
+ brute_file: str,
75
+ generator_file: str,
76
+ iterations: int = 100,
77
+ ) -> dict[str, Any]:
78
+ opt_path = Path(optimal_file).resolve()
79
+ brute_path = Path(brute_file).resolve()
80
+ gen_path = Path(generator_file).resolve()
81
+
82
+ with tempfile.TemporaryDirectory() as tmp:
83
+ tmp_dir = Path(tmp)
84
+ opt_cmd = compile_if_cpp(opt_path, tmp_dir / "opt") if opt_path.suffix == ".cpp" else ["python", str(opt_path)]
85
+ if opt_path.suffix == ".cpp":
86
+ (tmp_dir / "opt").mkdir(exist_ok=True)
87
+ opt_cmd = compile_if_cpp(opt_path, tmp_dir / "opt")
88
+
89
+ if brute_path.suffix == ".cpp":
90
+ (tmp_dir / "brute").mkdir(exist_ok=True)
91
+ brute_cmd = compile_if_cpp(brute_path, tmp_dir / "brute")
92
+ else:
93
+ brute_cmd = ["python", str(brute_path)]
94
+
95
+ gen_cmd = ["python", str(gen_path)]
96
+
97
+ for i in range(1, min(iterations, 500) + 1):
98
+ gen_res = execute_cmd(gen_cmd, str(i))
99
+ if gen_res["verdict"] != "OK":
100
+ raise RuntimeError(f"Generator crashed on iteration {i}: {gen_res['stderr']}")
101
+
102
+ test_input = gen_res["stdout"]
103
+ opt_res = execute_cmd(opt_cmd, test_input)
104
+ brute_res = execute_cmd(brute_cmd, test_input)
105
+
106
+ if opt_res["verdict"] != "OK" or opt_res["stdout"] != brute_res["stdout"]:
107
+ return {
108
+ "found_counterexample": True,
109
+ "iteration": i,
110
+ "failing_input": test_input,
111
+ "expected_brute_output": brute_res["stdout"],
112
+ "actual_optimal_output": opt_res["stdout"],
113
+ "optimal_verdict": opt_res["verdict"],
114
+ }
115
+
116
+ return {"found_counterexample": False, "iterations_tested": iterations}
@@ -0,0 +1,69 @@
1
+ import asyncio
2
+ from typing import Any
3
+ from bs4 import BeautifulSoup
4
+ from curl_cffi.requests import AsyncSession
5
+ from diskcache import Cache
6
+ from .client import CACHE_DIR
7
+
8
+ scraper_cache = Cache(str(CACHE_DIR / "problems"))
9
+
10
+
11
+ def _parse_problem_html(html: str, contest_id: int, index: str) -> dict[str, Any]:
12
+ soup = BeautifulSoup(html, "html.parser")
13
+ statement = soup.select_one("div.problem-statement")
14
+ if not statement:
15
+ raise ValueError(f"Could not locate problem statement for {contest_id}{index}.")
16
+
17
+ header = statement.select_one("div.header")
18
+ title = header.select_one("div.title").get_text(strip=True) if header else f"{contest_id}{index}"
19
+ time_limit = (
20
+ header.select_one("div.time-limit").get_text(separator=" ", strip=True)
21
+ if header else "Unknown"
22
+ )
23
+ memory_limit = (
24
+ header.select_one("div.memory-limit").get_text(separator=" ", strip=True)
25
+ if header else "Unknown"
26
+ )
27
+
28
+ # Extract sample test cases preserving exact newlines
29
+ samples: list[dict[str, str]] = []
30
+ inputs = statement.select("div.sample-test div.input pre")
31
+ outputs = statement.select("div.sample-test div.output pre")
32
+
33
+ for inp, out in zip(inputs, outputs):
34
+ in_lines = [div.get_text() for div in inp.select("div.test-example-line")]
35
+ in_text = "\n".join(in_lines) if in_lines else inp.get_text("\n", strip=True)
36
+ out_text = out.get_text("\n", strip=True)
37
+ samples.append({"input": in_text.strip(), "output": out_text.strip()})
38
+
39
+ # Extract body paragraphs
40
+ body_parts = []
41
+ for div in statement.find_all("div", recursive=False):
42
+ classes = div.get("class") or []
43
+ if "header" not in classes and "sample-test" not in classes:
44
+ body_parts.append(div.get_text("\n", strip=True))
45
+
46
+ return {
47
+ "problem_id": f"{contest_id}{index.upper()}",
48
+ "title": title,
49
+ "time_limit": time_limit,
50
+ "memory_limit": memory_limit,
51
+ "description": "\n\n".join(body_parts),
52
+ "samples": samples,
53
+ }
54
+
55
+
56
+ async def fetch_problem_statement(contest_id: int, index: str) -> dict[str, Any]:
57
+ key = f"prob_{contest_id}_{index.upper()}"
58
+ cached = scraper_cache.get(key)
59
+ if cached is not None:
60
+ return cached
61
+
62
+ url = f"https://codeforces.com/contest/{contest_id}/problem/{index.upper()}"
63
+ async with AsyncSession(impersonate="chrome124", timeout=15) as session:
64
+ response = await session.get(url)
65
+ if response.status_code != 200:
66
+ raise RuntimeError(f"Failed to fetch problem page (HTTP {response.status_code})")
67
+ parsed = await asyncio.to_thread(_parse_problem_html, response.text, contest_id, index)
68
+ scraper_cache.set(key, parsed)
69
+ return parsed
@@ -0,0 +1,114 @@
1
+ from typing import Any
2
+ from mcp.server.mcpserver import MCPServer
3
+ from mcp.types import ToolAnnotations
4
+ from .client import CodeforcesClient
5
+ from .scraper import fetch_problem_statement
6
+ from .sandbox import run_samples, run_stress_test
7
+
8
+ mcp = MCPServer("Codeforces-MCP")
9
+ cf_client = CodeforcesClient()
10
+
11
+ READ_ONLY = ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True)
12
+ LOCAL_EXEC = ToolAnnotations(readOnlyHint=False, destructiveHint=False)
13
+
14
+
15
+ @mcp.tool(annotations=READ_ONLY)
16
+ async def get_user_profile(handle: str) -> dict[str, Any]:
17
+ """Fetch a Codeforces user's current rating, max rating, rank, and recent verdict breakdown."""
18
+ info = await cf_client.get_user_info(handle)
19
+ submissions = await cf_client.get_user_submissions(handle, count=100)
20
+
21
+ verdicts: dict[str, int] = {}
22
+ weak_tags: dict[str, int] = {}
23
+
24
+ for sub in submissions:
25
+ v = sub.get("verdict", "UNKNOWN")
26
+ verdicts[v] = verdicts.get(v, 0) + 1
27
+ if v != "OK":
28
+ for tag in sub.get("problem", {}).get("tags", []):
29
+ weak_tags[tag] = weak_tags.get(tag, 0) + 1
30
+
31
+ top_weak_tags = sorted(weak_tags.items(), key=lambda x: x[1], reverse=True)[:5]
32
+
33
+ return {
34
+ "handle": info.get("handle"),
35
+ "rating": info.get("rating", "Unrated"),
36
+ "maxRating": info.get("maxRating", "Unrated"),
37
+ "rank": info.get("rank", "Unrated"),
38
+ "recent_100_verdicts": verdicts,
39
+ "most_failed_tags_recently": [t[0] for t in top_weak_tags],
40
+ }
41
+
42
+
43
+ @mcp.tool(annotations=READ_ONLY)
44
+ async def get_problem(contest_id: int, index: str) -> dict[str, Any]:
45
+ """Fetch the full problem statement, constraints, and sample test cases for a Codeforces problem."""
46
+ return await fetch_problem_statement(contest_id, index)
47
+
48
+
49
+ @mcp.tool(annotations=READ_ONLY)
50
+ async def recommend_upsolve_problems(
51
+ handle: str,
52
+ tag: str | None = None,
53
+ min_rating: int = 1600,
54
+ max_rating: int = 1900,
55
+ limit: int = 5,
56
+ ) -> list[dict[str, Any]]:
57
+ """Recommend unsolved Codeforces problems filtered by rating range and optional topic tag."""
58
+ subs = await cf_client.get_user_submissions(handle, count=500)
59
+ solved = {
60
+ f"{s['problem'].get('contestId')}{s['problem'].get('index')}"
61
+ for s in subs
62
+ if s.get("verdict") == "OK" and "problem" in s
63
+ }
64
+
65
+ catalog = await cf_client.get_problemset()
66
+ recommendations = []
67
+
68
+ for prob in catalog.get("problems", []):
69
+ pid = f"{prob.get('contestId')}{prob.get('index')}"
70
+ rating = prob.get("rating", 0)
71
+ tags = prob.get("tags", [])
72
+
73
+ if pid in solved or not (min_rating <= rating <= max_rating):
74
+ continue
75
+ if tag and tag.lower() not in [t.lower() for t in tags]:
76
+ continue
77
+
78
+ recommendations.append({
79
+ "problem_id": pid,
80
+ "name": prob.get("name"),
81
+ "rating": rating,
82
+ "tags": tags,
83
+ "url": f"https://codeforces.com/contest/{prob.get('contestId')}/problem/{prob.get('index')}",
84
+ })
85
+ if len(recommendations) >= limit:
86
+ break
87
+
88
+ return recommendations
89
+
90
+
91
+ @mcp.tool(annotations=LOCAL_EXEC)
92
+ async def test_local_solution(source_file: str, contest_id: int, index: str) -> dict[str, Any]:
93
+ """Compile and run a local .cpp or .py file against official Codeforces sample test cases."""
94
+ problem = await fetch_problem_statement(contest_id, index)
95
+ return run_samples(source_file, problem["samples"])
96
+
97
+
98
+ @mcp.tool(annotations=LOCAL_EXEC)
99
+ async def find_counterexample(
100
+ optimal_file: str,
101
+ brute_file: str,
102
+ generator_file: str,
103
+ iterations: int = 100,
104
+ ) -> dict[str, Any]:
105
+ """Stress test an optimal solution against a brute-force solution using a generator script."""
106
+ return run_stress_test(optimal_file, brute_file, generator_file, iterations)
107
+
108
+
109
+ def main() -> None:
110
+ mcp.run()
111
+
112
+
113
+ if __name__ == "__main__":
114
+ main()
File without changes