py-easy-mcp 0.2.0__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.
- py_easy_mcp-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +39 -0
- py_easy_mcp-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +27 -0
- py_easy_mcp-0.2.0/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- py_easy_mcp-0.2.0/.github/workflows/ci.yml +32 -0
- py_easy_mcp-0.2.0/.github/workflows/release.yml +30 -0
- py_easy_mcp-0.2.0/.gitignore +26 -0
- py_easy_mcp-0.2.0/CODE_OF_CONDUCT.md +114 -0
- py_easy_mcp-0.2.0/CONTRIBUTING.md +38 -0
- py_easy_mcp-0.2.0/LICENSE +21 -0
- py_easy_mcp-0.2.0/PKG-INFO +161 -0
- py_easy_mcp-0.2.0/README.md +134 -0
- py_easy_mcp-0.2.0/easy_mcp/__init__.py +28 -0
- py_easy_mcp-0.2.0/easy_mcp/cli.py +128 -0
- py_easy_mcp-0.2.0/easy_mcp/protocol.py +92 -0
- py_easy_mcp-0.2.0/easy_mcp/schema.py +158 -0
- py_easy_mcp-0.2.0/easy_mcp/server.py +444 -0
- py_easy_mcp-0.2.0/examples/basic_math.py +44 -0
- py_easy_mcp-0.2.0/examples/pii_shield_mcp.py +28 -0
- py_easy_mcp-0.2.0/pyproject.toml +53 -0
- py_easy_mcp-0.2.0/tests/test_server.py +403 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: "๐ Bug Report"
|
|
2
|
+
description: File a bug report for easy-mcp.
|
|
3
|
+
labels: ["bug"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for taking the time to report an issue with easy-mcp!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: description
|
|
11
|
+
attributes:
|
|
12
|
+
label: Bug Description
|
|
13
|
+
description: A clear description of the issue or unexpected MCP behavior.
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: client
|
|
18
|
+
attributes:
|
|
19
|
+
label: MCP Client
|
|
20
|
+
description: Which client is connecting? (e.g., Claude Desktop, Claude Code, Cursor, Custom Inspector)
|
|
21
|
+
validations:
|
|
22
|
+
required: true
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: reproduction
|
|
25
|
+
attributes:
|
|
26
|
+
label: Reproduction Code Snippet
|
|
27
|
+
description: Minimal Python script reproducing the issue.
|
|
28
|
+
placeholder: |
|
|
29
|
+
from easy_mcp import EasyMCP
|
|
30
|
+
mcp = EasyMCP("test")
|
|
31
|
+
...
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
34
|
+
- type: input
|
|
35
|
+
id: environment
|
|
36
|
+
attributes:
|
|
37
|
+
label: Environment
|
|
38
|
+
description: OS version, Python version, easy-mcp version
|
|
39
|
+
placeholder: Windows 11 / macOS / Linux, Python 3.12, easy-mcp v0.2.0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: "๐ก Feature Request"
|
|
2
|
+
description: Propose a new MCP feature, protocol extension, or example.
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
We welcome ideas to make building MCP servers even easier and more powerful!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: problem
|
|
11
|
+
attributes:
|
|
12
|
+
label: Problem / Motivation
|
|
13
|
+
description: What capability or MCP feature are you looking for?
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: proposal
|
|
18
|
+
attributes:
|
|
19
|
+
label: Proposed Solution or API Design
|
|
20
|
+
description: How should the Python API look? (e.g., decorator syntax, helper utility)
|
|
21
|
+
validations:
|
|
22
|
+
required: true
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: client_compatibility
|
|
25
|
+
attributes:
|
|
26
|
+
label: Client Compatibility
|
|
27
|
+
description: Does this target Claude Desktop, Cursor, or general MCP clients?
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
<!-- Briefly describe what this PR does, why it is needed, and link any related issues. -->
|
|
3
|
+
Fixes #
|
|
4
|
+
|
|
5
|
+
## Type of Change
|
|
6
|
+
- [ ] โจ New MCP capability (tools, resources, prompts, transports)
|
|
7
|
+
- [ ] ๐ Bug fix (JSON-RPC protocol compliance, schema generation)
|
|
8
|
+
- [ ] ๐ Documentation & examples
|
|
9
|
+
- [ ] ๐งช Tests improvement
|
|
10
|
+
- [ ] โก Performance improvement
|
|
11
|
+
|
|
12
|
+
## Checklist
|
|
13
|
+
- [ ] My code adheres to the project's zero-external-dependency rule for runtime code.
|
|
14
|
+
- [ ] All unit tests pass locally with `python -m unittest discover -s tests`.
|
|
15
|
+
- [ ] I have added new unit tests for any new features or bug fixes.
|
|
16
|
+
- [ ] Tested against Claude Desktop or MCP JSON-RPC stdio protocol.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Run unit tests
|
|
25
|
+
run: |
|
|
26
|
+
python -m unittest discover tests
|
|
27
|
+
|
|
28
|
+
- name: Test CLI installation
|
|
29
|
+
run: |
|
|
30
|
+
pip install .
|
|
31
|
+
easy-mcp --version
|
|
32
|
+
easy-mcp config examples/basic_math.py
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Build and upload to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Install build tool
|
|
24
|
+
run: pip install build
|
|
25
|
+
|
|
26
|
+
- name: Build sdist and wheel
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- name: Publish package to PyPI
|
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
.Python
|
|
6
|
+
build/
|
|
7
|
+
develop-eggs/
|
|
8
|
+
dist/
|
|
9
|
+
downloads/
|
|
10
|
+
eggs/
|
|
11
|
+
.eggs/
|
|
12
|
+
lib/
|
|
13
|
+
lib64/
|
|
14
|
+
parts/
|
|
15
|
+
sdist/
|
|
16
|
+
var/
|
|
17
|
+
wheels/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
.installed.cfg
|
|
20
|
+
*.egg
|
|
21
|
+
.venv
|
|
22
|
+
venv/
|
|
23
|
+
ENV/
|
|
24
|
+
.env
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.ruff_cache/
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
luynbv@glotechvn.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
76
|
+
unprofessional or unwelcome in the community.
|
|
77
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
78
|
+
clarity around the nature of the violation and an explanation of why the
|
|
79
|
+
behavior was inappropriate. A public apology may be requested.
|
|
80
|
+
|
|
81
|
+
### 2. Warning
|
|
82
|
+
**Community Impact**: A violation through a single incident or series of
|
|
83
|
+
actions.
|
|
84
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
85
|
+
interaction with the people involved, including unsolicited interaction with
|
|
86
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
87
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
88
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
89
|
+
ban.
|
|
90
|
+
|
|
91
|
+
### 3. Temporary Ban
|
|
92
|
+
**Community Impact**: A serious violation of community standards, including
|
|
93
|
+
sustained inappropriate behavior.
|
|
94
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
95
|
+
communication with the community for a specified period of time. No public or
|
|
96
|
+
private interaction with the people involved, including unsolicited interaction
|
|
97
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
98
|
+
Violating these terms may lead to a permanent ban.
|
|
99
|
+
|
|
100
|
+
### 4. Permanent Ban
|
|
101
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
102
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
103
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
104
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
105
|
+
community.
|
|
106
|
+
|
|
107
|
+
## Attribution
|
|
108
|
+
|
|
109
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
110
|
+
version 2.1, available at
|
|
111
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
112
|
+
|
|
113
|
+
[homepage]: https://www.contributor-covenant.org
|
|
114
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing to easy-mcp
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in **easy-mcp**! We welcome contributions to make building Model Context Protocol servers as easy and accessible as possible.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ๐ Great First Issues
|
|
8
|
+
|
|
9
|
+
- **Add an MCP server example in `examples/`:**
|
|
10
|
+
Build a small tool server (e.g., SQLite query, currency converter, file search, RSS reader).
|
|
11
|
+
- **Add unit tests:**
|
|
12
|
+
Add test cases in `tests/test_server.py`.
|
|
13
|
+
- **Improve schema parsing:**
|
|
14
|
+
Support additional type annotations in `easy_mcp/schema.py`.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ๐ ๏ธ Development Setup
|
|
19
|
+
|
|
20
|
+
1. **Clone the repository:**
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/<your-username>/easy-mcp.git
|
|
23
|
+
cd easy-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **Zero external dependencies:**
|
|
27
|
+
`easy-mcp` is 100% standard library Python. No heavy external frameworks required!
|
|
28
|
+
|
|
29
|
+
3. **Running tests:**
|
|
30
|
+
```bash
|
|
31
|
+
python -m unittest discover tests
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
4. **Submitting changes:**
|
|
35
|
+
- Create a branch: `git checkout -b feat/add-sqlite-example`
|
|
36
|
+
- Test your changes: `python -m unittest`
|
|
37
|
+
- Commit with Conventional Commits: `git commit -m "feat(examples): add sqlite query mcp server"`
|
|
38
|
+
- Push and open a Pull Request!
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lui01212
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: py-easy-mcp
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Ultra-lightweight, zero-dependency Python framework to build Model Context Protocol (MCP) servers for Claude.
|
|
5
|
+
Project-URL: Homepage, https://github.com/lui01212/easy-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/lui01212/easy-mcp.git
|
|
7
|
+
Project-URL: Issues, https://github.com/lui01212/easy-mcp/issues
|
|
8
|
+
Author-email: lui01212 <luynbv@glotechvn.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agent,ai,anthropic,claude,json-rpc,llm,mcp,model-context-protocol,tools
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# py-easy-mcp โก๐ค
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/py-easy-mcp/)
|
|
31
|
+
[](https://pypi.org/project/py-easy-mcp/)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
[](https://github.com/lui01212/easy-mcp/actions)
|
|
34
|
+
[](https://github.com/lui01212/easy-mcp/issues?q=is%3Aissue+state%3Aopen+label%3A%22good+first+issue%22)
|
|
35
|
+
[](https://hacktoberfest.com/)
|
|
36
|
+
|
|
37
|
+
**Ultra-lightweight, zero-dependency Python framework for Model Context Protocol (MCP). Build MCP servers for Claude in seconds.**
|
|
38
|
+
|
|
39
|
+
Turn standard Python functions into Model Context Protocol tools, resources, and prompt templates for **Claude Desktop** and **Claude Code** with simple decorators.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## โก Why easy-mcp?
|
|
44
|
+
|
|
45
|
+
- **Zero dependencies:** Written in 100% pure standard Python. No heavy ASGI servers, no complex async overhead.
|
|
46
|
+
- **Full MCP Protocol Support (v0.2.0):** Supports Tools (`@mcp.tool()`), Resources (`@mcp.resource()`), and Prompt Templates (`@mcp.prompt()`).
|
|
47
|
+
- **Pythonic & Simple:** Turn any Python function into an MCP primitive with clean decorators.
|
|
48
|
+
- **Automatic Schema Inspection:** Docstrings and type annotations are automatically converted into standard JSON Schemas.
|
|
49
|
+
- **Claude Desktop Ready:** Built-in config generator outputs the exact JSON configuration to paste into `claude_desktop_config.json`.
|
|
50
|
+
- **Offline & Safe:** Standard I/O (stdio) JSON-RPC 2.0 communication.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ๐ฆ Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install py-easy-mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## ๐ 30-Second Quickstart
|
|
63
|
+
|
|
64
|
+
### 1. Write your server (`my_server.py`)
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from easy_mcp import EasyMCP
|
|
68
|
+
|
|
69
|
+
mcp = EasyMCP(name="my-server", version="0.2.0")
|
|
70
|
+
|
|
71
|
+
# 1. Register a Tool
|
|
72
|
+
@mcp.tool()
|
|
73
|
+
def add(a: float, b: float) -> float:
|
|
74
|
+
"""Add two numbers together.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
a: First number
|
|
78
|
+
b: Second number
|
|
79
|
+
"""
|
|
80
|
+
return a + b
|
|
81
|
+
|
|
82
|
+
# 2. Register a Resource (readable context)
|
|
83
|
+
@mcp.resource("memo://project-guidelines")
|
|
84
|
+
def guidelines() -> str:
|
|
85
|
+
"""Project engineering principles."""
|
|
86
|
+
return "1. Keep it simple.\n2. Zero external dependencies.\n3. Write clear tests."
|
|
87
|
+
|
|
88
|
+
# 3. Register a Prompt Template
|
|
89
|
+
@mcp.prompt()
|
|
90
|
+
def code_review(code: str, language: str = "python") -> str:
|
|
91
|
+
"""Review code for bugs and maintainability."""
|
|
92
|
+
return f"Please review this {language} snippet:\n\n{code}"
|
|
93
|
+
|
|
94
|
+
if __name__ == "__main__":
|
|
95
|
+
mcp.run()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. Add to Claude Desktop
|
|
99
|
+
|
|
100
|
+
Generate the configuration snippet:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
easy-mcp config my_server.py
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Output:
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"my-server": {
|
|
111
|
+
"command": "python",
|
|
112
|
+
"args": [
|
|
113
|
+
"/path/to/my_server.py"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Paste this into your `claude_desktop_config.json`:
|
|
121
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
122
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
123
|
+
|
|
124
|
+
Restart Claude Desktop, and your tools, resources, and prompts will appear!
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## ๐ ๏ธ CLI Utilities
|
|
129
|
+
|
|
130
|
+
Scaffold a new server in 1 second:
|
|
131
|
+
```bash
|
|
132
|
+
easy-mcp init weather-server
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Generate config for Claude Desktop:
|
|
136
|
+
```bash
|
|
137
|
+
easy-mcp config server.py
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## ๐ Community MCP Examples (Help Wanted!)
|
|
143
|
+
|
|
144
|
+
We are building a curated collection of lightweight MCP tool servers in `examples/`:
|
|
145
|
+
- `examples/basic_math.py` - Math calculator
|
|
146
|
+
- `examples/pii_shield_mcp.py` - AI data privacy sanitizer
|
|
147
|
+
|
|
148
|
+
### Want to contribute?
|
|
149
|
+
Help us add more examples for Hacktoberfest:
|
|
150
|
+
- ๐ SQLite database query tool
|
|
151
|
+
- ๐ฐ Hacker News API reader
|
|
152
|
+
- ๐ Local markdown note searcher
|
|
153
|
+
- โ
Weather lookup
|
|
154
|
+
|
|
155
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) to submit an example!
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## ๐ License
|
|
160
|
+
|
|
161
|
+
[MIT License](LICENSE) ยฉ 2026 lui01212
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# py-easy-mcp โก๐ค
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/py-easy-mcp/)
|
|
4
|
+
[](https://pypi.org/project/py-easy-mcp/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/lui01212/easy-mcp/actions)
|
|
7
|
+
[](https://github.com/lui01212/easy-mcp/issues?q=is%3Aissue+state%3Aopen+label%3A%22good+first+issue%22)
|
|
8
|
+
[](https://hacktoberfest.com/)
|
|
9
|
+
|
|
10
|
+
**Ultra-lightweight, zero-dependency Python framework for Model Context Protocol (MCP). Build MCP servers for Claude in seconds.**
|
|
11
|
+
|
|
12
|
+
Turn standard Python functions into Model Context Protocol tools, resources, and prompt templates for **Claude Desktop** and **Claude Code** with simple decorators.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## โก Why easy-mcp?
|
|
17
|
+
|
|
18
|
+
- **Zero dependencies:** Written in 100% pure standard Python. No heavy ASGI servers, no complex async overhead.
|
|
19
|
+
- **Full MCP Protocol Support (v0.2.0):** Supports Tools (`@mcp.tool()`), Resources (`@mcp.resource()`), and Prompt Templates (`@mcp.prompt()`).
|
|
20
|
+
- **Pythonic & Simple:** Turn any Python function into an MCP primitive with clean decorators.
|
|
21
|
+
- **Automatic Schema Inspection:** Docstrings and type annotations are automatically converted into standard JSON Schemas.
|
|
22
|
+
- **Claude Desktop Ready:** Built-in config generator outputs the exact JSON configuration to paste into `claude_desktop_config.json`.
|
|
23
|
+
- **Offline & Safe:** Standard I/O (stdio) JSON-RPC 2.0 communication.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ๐ฆ Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install py-easy-mcp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## ๐ 30-Second Quickstart
|
|
36
|
+
|
|
37
|
+
### 1. Write your server (`my_server.py`)
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from easy_mcp import EasyMCP
|
|
41
|
+
|
|
42
|
+
mcp = EasyMCP(name="my-server", version="0.2.0")
|
|
43
|
+
|
|
44
|
+
# 1. Register a Tool
|
|
45
|
+
@mcp.tool()
|
|
46
|
+
def add(a: float, b: float) -> float:
|
|
47
|
+
"""Add two numbers together.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
a: First number
|
|
51
|
+
b: Second number
|
|
52
|
+
"""
|
|
53
|
+
return a + b
|
|
54
|
+
|
|
55
|
+
# 2. Register a Resource (readable context)
|
|
56
|
+
@mcp.resource("memo://project-guidelines")
|
|
57
|
+
def guidelines() -> str:
|
|
58
|
+
"""Project engineering principles."""
|
|
59
|
+
return "1. Keep it simple.\n2. Zero external dependencies.\n3. Write clear tests."
|
|
60
|
+
|
|
61
|
+
# 3. Register a Prompt Template
|
|
62
|
+
@mcp.prompt()
|
|
63
|
+
def code_review(code: str, language: str = "python") -> str:
|
|
64
|
+
"""Review code for bugs and maintainability."""
|
|
65
|
+
return f"Please review this {language} snippet:\n\n{code}"
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
mcp.run()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Add to Claude Desktop
|
|
72
|
+
|
|
73
|
+
Generate the configuration snippet:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
easy-mcp config my_server.py
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Output:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"my-server": {
|
|
84
|
+
"command": "python",
|
|
85
|
+
"args": [
|
|
86
|
+
"/path/to/my_server.py"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Paste this into your `claude_desktop_config.json`:
|
|
94
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
95
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
96
|
+
|
|
97
|
+
Restart Claude Desktop, and your tools, resources, and prompts will appear!
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ๐ ๏ธ CLI Utilities
|
|
102
|
+
|
|
103
|
+
Scaffold a new server in 1 second:
|
|
104
|
+
```bash
|
|
105
|
+
easy-mcp init weather-server
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Generate config for Claude Desktop:
|
|
109
|
+
```bash
|
|
110
|
+
easy-mcp config server.py
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## ๐ Community MCP Examples (Help Wanted!)
|
|
116
|
+
|
|
117
|
+
We are building a curated collection of lightweight MCP tool servers in `examples/`:
|
|
118
|
+
- `examples/basic_math.py` - Math calculator
|
|
119
|
+
- `examples/pii_shield_mcp.py` - AI data privacy sanitizer
|
|
120
|
+
|
|
121
|
+
### Want to contribute?
|
|
122
|
+
Help us add more examples for Hacktoberfest:
|
|
123
|
+
- ๐ SQLite database query tool
|
|
124
|
+
- ๐ฐ Hacker News API reader
|
|
125
|
+
- ๐ Local markdown note searcher
|
|
126
|
+
- โ
Weather lookup
|
|
127
|
+
|
|
128
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) to submit an example!
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## ๐ License
|
|
133
|
+
|
|
134
|
+
[MIT License](LICENSE) ยฉ 2026 lui01212
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
easy-mcp: Ultra-lightweight, zero-dependency Python framework for Model Context Protocol (MCP).
|
|
3
|
+
Build MCP servers for Claude in seconds.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from easy_mcp.server import EasyMCP
|
|
7
|
+
from easy_mcp.schema import function_to_tool_schema, function_to_prompt_arguments
|
|
8
|
+
from easy_mcp.protocol import (
|
|
9
|
+
MCPError,
|
|
10
|
+
ParseError,
|
|
11
|
+
InvalidRequestError,
|
|
12
|
+
MethodNotFoundError,
|
|
13
|
+
InvalidParamsError,
|
|
14
|
+
InternalError,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__version__ = "0.2.0"
|
|
18
|
+
__all__ = [
|
|
19
|
+
"EasyMCP",
|
|
20
|
+
"function_to_tool_schema",
|
|
21
|
+
"function_to_prompt_arguments",
|
|
22
|
+
"MCPError",
|
|
23
|
+
"ParseError",
|
|
24
|
+
"InvalidRequestError",
|
|
25
|
+
"MethodNotFoundError",
|
|
26
|
+
"InvalidParamsError",
|
|
27
|
+
"InternalError",
|
|
28
|
+
]
|