mcpscore 0.3.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.
- mcpscore-0.3.0/.gitignore +157 -0
- mcpscore-0.3.0/LICENSE +21 -0
- mcpscore-0.3.0/PKG-INFO +150 -0
- mcpscore-0.3.0/README.md +120 -0
- mcpscore-0.3.0/mcpscore/__init__.py +34 -0
- mcpscore-0.3.0/mcpscore/cli.py +64 -0
- mcpscore-0.3.0/mcpscore/enums.py +44 -0
- mcpscore-0.3.0/mcpscore/mcp_auditor.py +224 -0
- mcpscore-0.3.0/mcpscore/mcp_client.py +408 -0
- mcpscore-0.3.0/mcpscore/py.typed +0 -0
- mcpscore-0.3.0/mcpscore/rules/__init__.py +89 -0
- mcpscore-0.3.0/mcpscore/rules/base.py +229 -0
- mcpscore-0.3.0/mcpscore/rules/capabilities.py +398 -0
- mcpscore-0.3.0/mcpscore/rules/protocol_version.py +187 -0
- mcpscore-0.3.0/mcpscore/rules/registry.py +105 -0
- mcpscore-0.3.0/mcpscore/rules/security.py +277 -0
- mcpscore-0.3.0/mcpscore/rules/server_info.py +181 -0
- mcpscore-0.3.0/mcpscore/rules/tools.py +472 -0
- mcpscore-0.3.0/mcpscore/rules/transport.py +77 -0
- mcpscore-0.3.0/pyproject.toml +118 -0
- mcpscore-0.3.0/tests/__init__.py +1 -0
- mcpscore-0.3.0/tests/conftest.py +83 -0
- mcpscore-0.3.0/tests/test_auditor.py +652 -0
- mcpscore-0.3.0/tests/test_capabilities_rules.py +51 -0
- mcpscore-0.3.0/tests/test_cli.py +548 -0
- mcpscore-0.3.0/tests/test_mcp_client_http.py +232 -0
- mcpscore-0.3.0/tests/test_mcp_client_session.py +193 -0
- mcpscore-0.3.0/tests/test_mcp_client_sse.py +207 -0
- mcpscore-0.3.0/tests/test_mcp_client_stdio.py +146 -0
- mcpscore-0.3.0/tests/test_protocol_version_rules.py +57 -0
- mcpscore-0.3.0/tests/test_registry.py +26 -0
- mcpscore-0.3.0/tests/test_security_rules.py +208 -0
- mcpscore-0.3.0/tests/test_server_info_rules.py +24 -0
- mcpscore-0.3.0/tests/test_tools_rules.py +810 -0
- mcpscore-0.3.0/tests/test_transport_rules.py +64 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
coverage.json
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
.python-version
|
|
87
|
+
|
|
88
|
+
# pipenv
|
|
89
|
+
Pipfile.lock
|
|
90
|
+
|
|
91
|
+
# PEP 582
|
|
92
|
+
__pypackages__/
|
|
93
|
+
|
|
94
|
+
# Celery stuff
|
|
95
|
+
celerybeat-schedule
|
|
96
|
+
celerybeat.pid
|
|
97
|
+
|
|
98
|
+
# SageMath parsed files
|
|
99
|
+
*.sage.py
|
|
100
|
+
|
|
101
|
+
# Environments
|
|
102
|
+
.env
|
|
103
|
+
.venv
|
|
104
|
+
env/
|
|
105
|
+
venv/
|
|
106
|
+
ENV/
|
|
107
|
+
env.bak/
|
|
108
|
+
venv.bak/
|
|
109
|
+
|
|
110
|
+
# Spyder project settings
|
|
111
|
+
.spyderproject
|
|
112
|
+
.spyproject
|
|
113
|
+
|
|
114
|
+
# Rope project settings
|
|
115
|
+
.ropeproject
|
|
116
|
+
|
|
117
|
+
# mkdocs documentation
|
|
118
|
+
/site
|
|
119
|
+
|
|
120
|
+
# mypy
|
|
121
|
+
.mypy_cache/
|
|
122
|
+
.dmypy.json
|
|
123
|
+
dmypy.json
|
|
124
|
+
|
|
125
|
+
# Pyre type checker
|
|
126
|
+
.pyre/
|
|
127
|
+
|
|
128
|
+
# pytype static type analyzer
|
|
129
|
+
.pytype/
|
|
130
|
+
|
|
131
|
+
# Cython debug symbols
|
|
132
|
+
cython_debug/
|
|
133
|
+
|
|
134
|
+
# Ruff
|
|
135
|
+
.ruff_cache/
|
|
136
|
+
|
|
137
|
+
# Pyright
|
|
138
|
+
pyrightconfig.json
|
|
139
|
+
|
|
140
|
+
# IDEs
|
|
141
|
+
.idea/
|
|
142
|
+
.vscode/
|
|
143
|
+
*.swp
|
|
144
|
+
*.swo
|
|
145
|
+
*~
|
|
146
|
+
.project
|
|
147
|
+
.pydevproject
|
|
148
|
+
.settings/
|
|
149
|
+
|
|
150
|
+
# OS
|
|
151
|
+
.DS_Store
|
|
152
|
+
.DS_Store?
|
|
153
|
+
._*
|
|
154
|
+
.Spotlight-V100
|
|
155
|
+
.Trashes
|
|
156
|
+
ehthumbs.db
|
|
157
|
+
Thumbs.db
|
mcpscore-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alex Akimov
|
|
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.
|
mcpscore-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcpscore
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: CLI tool to analyze your MCP server and get a comprehensive report on its quality
|
|
5
|
+
Project-URL: Homepage, https://mcp-box.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/mcp-box/mcpscore
|
|
7
|
+
Project-URL: Issues, https://github.com/mcp-box/mcpscore/issues
|
|
8
|
+
Author: Alex Akimov
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,audit,cli,developer-tools,llm,mcp,mcp-server,model-context-protocol,quality
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.13
|
|
26
|
+
Requires-Dist: httpx-sse>=0.4.0
|
|
27
|
+
Requires-Dist: httpx>=0.28.0
|
|
28
|
+
Requires-Dist: mcp>=1.23.0
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# MCPScore
|
|
32
|
+
|
|
33
|
+
A command-line tool for auditing MCP (Model Context Protocol) servers. MCPScore connects to your server, runs a comprehensive set of validation rules against it, and produces a severity-based report showing what's compliant and what needs attention.
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- **Multiple transports**: STDIO (local servers), Streamable HTTP, and SSE (remote servers)
|
|
38
|
+
- **Auto-detection**: Picks the right transport automatically — tries Streamable HTTP first, falls back to SSE for URLs
|
|
39
|
+
- **Multi-language**: Audits both Python (`.py`) and Node.js (`.js`) MCP servers via STDIO
|
|
40
|
+
- **Severity-based reporting**: Rules categorized as CRITICAL, HIGH, MEDIUM, or LOW
|
|
41
|
+
- **Comprehensive validation**: Protocol compliance, server metadata, capabilities, security, and transport
|
|
42
|
+
|
|
43
|
+
## What it audits
|
|
44
|
+
|
|
45
|
+
- **Protocol Version Compliance**:
|
|
46
|
+
- ✅ Allowed versions check (CRITICAL)
|
|
47
|
+
- ✅ Latest version recommendation (MEDIUM)
|
|
48
|
+
- ✅ Deprecated version detection (HIGH)
|
|
49
|
+
|
|
50
|
+
- **Server Information**:
|
|
51
|
+
- ✅ Server name presence (CRITICAL)
|
|
52
|
+
- ✅ Server title presence (MEDIUM)
|
|
53
|
+
- ✅ Server version presence (HIGH)
|
|
54
|
+
|
|
55
|
+
- **Capabilities**: Tools, resources, prompts, logging, and subscription support
|
|
56
|
+
|
|
57
|
+
- **Security**:
|
|
58
|
+
- ✅ HTTPS/TLS usage verification
|
|
59
|
+
- ✅ Valid certificate checks
|
|
60
|
+
|
|
61
|
+
- **Transport**:
|
|
62
|
+
- ✅ SSE transport support detection
|
|
63
|
+
|
|
64
|
+
## Requirements
|
|
65
|
+
|
|
66
|
+
- Python 3.13+
|
|
67
|
+
- Node.js on `PATH` if auditing a Node.js MCP server
|
|
68
|
+
- A Python interpreter on `PATH` if auditing a Python MCP server
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install mcpscore
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv tool install mcpscore
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Quick start
|
|
83
|
+
|
|
84
|
+
Run `mcpscore` against any MCP server — local script or remote URL. The transport is detected automatically.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Local Python MCP server (STDIO)
|
|
88
|
+
mcpscore path/to/your/server.py
|
|
89
|
+
|
|
90
|
+
# Local Node.js MCP server (STDIO)
|
|
91
|
+
mcpscore path/to/your/server.js
|
|
92
|
+
|
|
93
|
+
# Remote MCP server (auto-detects Streamable HTTP or SSE)
|
|
94
|
+
mcpscore https://example.com/mcp
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Example output
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Welcome to MCPScore!
|
|
101
|
+
Connected to the MCP server: /path/to/server.py
|
|
102
|
+
Transport: stdio
|
|
103
|
+
Starting the audit...
|
|
104
|
+
✅ Protocol version '2025-06-18' is one of the allowed versions
|
|
105
|
+
✅ Protocol version '2025-06-18' is not deprecated
|
|
106
|
+
✅ Protocol version '2025-06-18' is the latest version
|
|
107
|
+
✅ Server name is present: 'weather'
|
|
108
|
+
✅ Server version is present: '1.17.0'
|
|
109
|
+
❌ Server title is not present in server info
|
|
110
|
+
✅ Tools capability is present
|
|
111
|
+
❌ listChanged is not supported by Tools
|
|
112
|
+
✅ Prompts capability is present
|
|
113
|
+
❌ listChanged is not supported by Prompts
|
|
114
|
+
✅ Resources capability is present
|
|
115
|
+
❌ listChanged is not supported by Resources
|
|
116
|
+
❌ subscribe is not supported by Resources
|
|
117
|
+
❌ Logging is not present in capabilities
|
|
118
|
+
✅ MCP Server provides at least one tool
|
|
119
|
+
✅ All Tools have a Name property specified
|
|
120
|
+
✅ All Tools have a Title property specified
|
|
121
|
+
✅ All Tools have a Description property specified
|
|
122
|
+
✅ All Tools have a valid Input Schema
|
|
123
|
+
✅ All Tools have a valid Output Schema
|
|
124
|
+
Audit finished. Final score: 55/71
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Understanding the score
|
|
128
|
+
|
|
129
|
+
Each passing rule contributes points equal to its severity weight: **CRITICAL = 5, HIGH = 3, MEDIUM = 2, LOW = 1**. Higher scores indicate better compliance with MCP standards.
|
|
130
|
+
|
|
131
|
+
## Troubleshooting
|
|
132
|
+
|
|
133
|
+
**Connection fails**
|
|
134
|
+
|
|
135
|
+
- Check the path or URL is correct and reachable
|
|
136
|
+
- For local servers, make sure Python or Node.js is on `PATH`
|
|
137
|
+
- Verify the server actually implements the MCP protocol
|
|
138
|
+
|
|
139
|
+
**Protocol version errors**
|
|
140
|
+
|
|
141
|
+
- Confirm your server uses a currently supported MCP protocol version
|
|
142
|
+
- If your server uses a newer version that MCPScore doesn't yet recognize, please [open an issue](https://github.com/mcp-box/mcpscore/issues)
|
|
143
|
+
|
|
144
|
+
## Feedback
|
|
145
|
+
|
|
146
|
+
Bug reports, feature requests, and general feedback are welcome at <https://github.com/mcp-box/mcpscore/issues>.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
MIT — see [LICENSE](LICENSE).
|
mcpscore-0.3.0/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# MCPScore
|
|
2
|
+
|
|
3
|
+
A command-line tool for auditing MCP (Model Context Protocol) servers. MCPScore connects to your server, runs a comprehensive set of validation rules against it, and produces a severity-based report showing what's compliant and what needs attention.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multiple transports**: STDIO (local servers), Streamable HTTP, and SSE (remote servers)
|
|
8
|
+
- **Auto-detection**: Picks the right transport automatically — tries Streamable HTTP first, falls back to SSE for URLs
|
|
9
|
+
- **Multi-language**: Audits both Python (`.py`) and Node.js (`.js`) MCP servers via STDIO
|
|
10
|
+
- **Severity-based reporting**: Rules categorized as CRITICAL, HIGH, MEDIUM, or LOW
|
|
11
|
+
- **Comprehensive validation**: Protocol compliance, server metadata, capabilities, security, and transport
|
|
12
|
+
|
|
13
|
+
## What it audits
|
|
14
|
+
|
|
15
|
+
- **Protocol Version Compliance**:
|
|
16
|
+
- ✅ Allowed versions check (CRITICAL)
|
|
17
|
+
- ✅ Latest version recommendation (MEDIUM)
|
|
18
|
+
- ✅ Deprecated version detection (HIGH)
|
|
19
|
+
|
|
20
|
+
- **Server Information**:
|
|
21
|
+
- ✅ Server name presence (CRITICAL)
|
|
22
|
+
- ✅ Server title presence (MEDIUM)
|
|
23
|
+
- ✅ Server version presence (HIGH)
|
|
24
|
+
|
|
25
|
+
- **Capabilities**: Tools, resources, prompts, logging, and subscription support
|
|
26
|
+
|
|
27
|
+
- **Security**:
|
|
28
|
+
- ✅ HTTPS/TLS usage verification
|
|
29
|
+
- ✅ Valid certificate checks
|
|
30
|
+
|
|
31
|
+
- **Transport**:
|
|
32
|
+
- ✅ SSE transport support detection
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Python 3.13+
|
|
37
|
+
- Node.js on `PATH` if auditing a Node.js MCP server
|
|
38
|
+
- A Python interpreter on `PATH` if auditing a Python MCP server
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install mcpscore
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv tool install mcpscore
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
Run `mcpscore` against any MCP server — local script or remote URL. The transport is detected automatically.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Local Python MCP server (STDIO)
|
|
58
|
+
mcpscore path/to/your/server.py
|
|
59
|
+
|
|
60
|
+
# Local Node.js MCP server (STDIO)
|
|
61
|
+
mcpscore path/to/your/server.js
|
|
62
|
+
|
|
63
|
+
# Remote MCP server (auto-detects Streamable HTTP or SSE)
|
|
64
|
+
mcpscore https://example.com/mcp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Example output
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Welcome to MCPScore!
|
|
71
|
+
Connected to the MCP server: /path/to/server.py
|
|
72
|
+
Transport: stdio
|
|
73
|
+
Starting the audit...
|
|
74
|
+
✅ Protocol version '2025-06-18' is one of the allowed versions
|
|
75
|
+
✅ Protocol version '2025-06-18' is not deprecated
|
|
76
|
+
✅ Protocol version '2025-06-18' is the latest version
|
|
77
|
+
✅ Server name is present: 'weather'
|
|
78
|
+
✅ Server version is present: '1.17.0'
|
|
79
|
+
❌ Server title is not present in server info
|
|
80
|
+
✅ Tools capability is present
|
|
81
|
+
❌ listChanged is not supported by Tools
|
|
82
|
+
✅ Prompts capability is present
|
|
83
|
+
❌ listChanged is not supported by Prompts
|
|
84
|
+
✅ Resources capability is present
|
|
85
|
+
❌ listChanged is not supported by Resources
|
|
86
|
+
❌ subscribe is not supported by Resources
|
|
87
|
+
❌ Logging is not present in capabilities
|
|
88
|
+
✅ MCP Server provides at least one tool
|
|
89
|
+
✅ All Tools have a Name property specified
|
|
90
|
+
✅ All Tools have a Title property specified
|
|
91
|
+
✅ All Tools have a Description property specified
|
|
92
|
+
✅ All Tools have a valid Input Schema
|
|
93
|
+
✅ All Tools have a valid Output Schema
|
|
94
|
+
Audit finished. Final score: 55/71
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Understanding the score
|
|
98
|
+
|
|
99
|
+
Each passing rule contributes points equal to its severity weight: **CRITICAL = 5, HIGH = 3, MEDIUM = 2, LOW = 1**. Higher scores indicate better compliance with MCP standards.
|
|
100
|
+
|
|
101
|
+
## Troubleshooting
|
|
102
|
+
|
|
103
|
+
**Connection fails**
|
|
104
|
+
|
|
105
|
+
- Check the path or URL is correct and reachable
|
|
106
|
+
- For local servers, make sure Python or Node.js is on `PATH`
|
|
107
|
+
- Verify the server actually implements the MCP protocol
|
|
108
|
+
|
|
109
|
+
**Protocol version errors**
|
|
110
|
+
|
|
111
|
+
- Confirm your server uses a currently supported MCP protocol version
|
|
112
|
+
- If your server uses a newer version that MCPScore doesn't yet recognize, please [open an issue](https://github.com/mcp-box/mcpscore/issues)
|
|
113
|
+
|
|
114
|
+
## Feedback
|
|
115
|
+
|
|
116
|
+
Bug reports, feature requests, and general feedback are welcome at <https://github.com/mcp-box/mcpscore/issues>.
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""MCPDoctor - A comprehensive auditing tool for MCP (Model Context Protocol) servers.
|
|
2
|
+
|
|
3
|
+
This package provides tools for auditing MCP servers to ensure compliance with
|
|
4
|
+
protocol standards and best practices. It includes:
|
|
5
|
+
|
|
6
|
+
- MCPClient: For connecting to and communicating with MCP servers
|
|
7
|
+
- MCPDoctor: For orchestrating the audit process
|
|
8
|
+
- Rule system: Extensible framework for implementing audit checks
|
|
9
|
+
- Enums: Protocol versions and transport types
|
|
10
|
+
|
|
11
|
+
The audit system uses a rule-based approach where each rule checks specific
|
|
12
|
+
aspects of MCP compliance and contributes to an overall audit score.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from .enums import MCPProtocolVersion, MCPTransportType
|
|
16
|
+
from .mcp_auditor import MCPAuditor
|
|
17
|
+
from .mcp_client import MCPClient
|
|
18
|
+
from .rules import (
|
|
19
|
+
AuditData,
|
|
20
|
+
BaseRule,
|
|
21
|
+
RuleResult,
|
|
22
|
+
RuleSeverity,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
__all__ = (
|
|
26
|
+
"AuditData",
|
|
27
|
+
"BaseRule",
|
|
28
|
+
"MCPAuditor",
|
|
29
|
+
"MCPClient",
|
|
30
|
+
"MCPProtocolVersion",
|
|
31
|
+
"MCPTransportType",
|
|
32
|
+
"RuleResult",
|
|
33
|
+
"RuleSeverity",
|
|
34
|
+
)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Command-line interface for MCPScore."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import logging
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from mcpscore import MCPAuditor, MCPClient
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def async_main() -> None:
|
|
13
|
+
"""Execute the main entry point for the MCPScore CLI application.
|
|
14
|
+
|
|
15
|
+
Orchestrates the audit process by:
|
|
16
|
+
1. Parsing command line arguments for the server path or URL
|
|
17
|
+
2. Creating MCP client and auditor instances
|
|
18
|
+
3. Auto-detecting transport and connecting to the MCP server
|
|
19
|
+
4. Running the audit process and displaying results
|
|
20
|
+
5. Cleaning up resources
|
|
21
|
+
|
|
22
|
+
Supports local servers (.py, .js) via STDIO and remote servers via
|
|
23
|
+
Streamable HTTP or SSE (auto-detected).
|
|
24
|
+
|
|
25
|
+
Exits with code 1 if no server path is provided, or code 2 if connection fails.
|
|
26
|
+
"""
|
|
27
|
+
logger.info("Welcome to MCPScore!")
|
|
28
|
+
|
|
29
|
+
if len(sys.argv) < 2:
|
|
30
|
+
logger.error("Usage: mcpscore <server_path_or_url>")
|
|
31
|
+
sys.exit(1)
|
|
32
|
+
|
|
33
|
+
target: str = sys.argv[1]
|
|
34
|
+
client: MCPClient = MCPClient()
|
|
35
|
+
doctor: MCPAuditor = MCPAuditor()
|
|
36
|
+
|
|
37
|
+
success, transport = await client.detect_and_connect(target)
|
|
38
|
+
|
|
39
|
+
if success:
|
|
40
|
+
logger.info("Connected to the MCP server: %s", target)
|
|
41
|
+
logger.info("Transport: %s", transport)
|
|
42
|
+
else:
|
|
43
|
+
logger.error("Error connecting to the MCP server: %s", target)
|
|
44
|
+
sys.exit(2)
|
|
45
|
+
|
|
46
|
+
logger.info("Starting the audit...")
|
|
47
|
+
final_score, max_score = await doctor.audit(client)
|
|
48
|
+
logger.info("Audit finished. Final score: %s/%s", final_score, max_score)
|
|
49
|
+
|
|
50
|
+
await client.cleanup()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def main() -> None:
|
|
54
|
+
"""Entry point for the mcpscore CLI command.
|
|
55
|
+
|
|
56
|
+
This function is called when running `mcpscore` from the command line.
|
|
57
|
+
It sets up logging and runs the async main function.
|
|
58
|
+
"""
|
|
59
|
+
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
|
60
|
+
asyncio.run(async_main())
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
main()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Enumerations and constants for MCP (Model Context Protocol) auditing.
|
|
2
|
+
|
|
3
|
+
This module defines the core enumerations used throughout the MCPDoctor system:
|
|
4
|
+
|
|
5
|
+
- MCPTransportType: Supported transport methods for MCP communication
|
|
6
|
+
- MCPProtocolVersion: Supported versions of the MCP protocol
|
|
7
|
+
|
|
8
|
+
These enums provide type safety and ensure consistent usage of protocol
|
|
9
|
+
versions and transport types across the audit system.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from enum import StrEnum
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class MCPTransportType(StrEnum):
|
|
16
|
+
"""Transport types supported by MCP (Model Context Protocol)."""
|
|
17
|
+
|
|
18
|
+
STDIO = "stdio"
|
|
19
|
+
"""Standard input/output transport for local processes."""
|
|
20
|
+
|
|
21
|
+
STREAMABLE_HTTP = "streamable-http"
|
|
22
|
+
"""HTTP-based transport with streaming capabilities."""
|
|
23
|
+
|
|
24
|
+
SSE = "sse"
|
|
25
|
+
"""Server-Sent Events transport for real-time communication."""
|
|
26
|
+
|
|
27
|
+
WEBSOCKET = "websocket"
|
|
28
|
+
"""WebSocket transport for bidirectional communication."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class MCPProtocolVersion(StrEnum):
|
|
32
|
+
"""Supported versions of the MCP (Model Context Protocol)."""
|
|
33
|
+
|
|
34
|
+
v2024_11_05 = "2024-11-05"
|
|
35
|
+
"""MCP protocol version from November 5, 2024."""
|
|
36
|
+
|
|
37
|
+
v2025_03_26 = "2025-03-26"
|
|
38
|
+
"""MCP protocol version from March 26, 2025."""
|
|
39
|
+
|
|
40
|
+
v2025_06_18 = "2025-06-18"
|
|
41
|
+
"""Latest MCP protocol version (June 18, 2025)."""
|
|
42
|
+
|
|
43
|
+
Latest = v2025_06_18
|
|
44
|
+
"""Alias for the latest protocol version."""
|