Skip to content

Commit 2dbcd7b

Browse files
committed
Add MCP Inspector support and enhance server functionality
- Updated Makefile to include a new 'inspector' command for running the MCP Inspector. - Added instructions for using the MCP Inspector in README.md. - Introduced a new script (run-inspector.py) to facilitate running the MCP server for the inspector. - Refactored server.py to improve structure and added new random generation tools. - Updated pyproject.toml to include fastmcp as a dependency. - Enhanced test_server.py to accommodate changes in server output handling.
1 parent 88c8ca8 commit 2dbcd7b

File tree

7 files changed

+350
-282
lines changed

7 files changed

+350
-282
lines changed

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help install install-dev test format lint typecheck quality build clean publish publish-test docker docker-test bump-patch bump-minor bump-major
1+
.PHONY: help install install-dev test format lint typecheck quality build clean publish publish-test docker docker-test bump-patch bump-minor bump-major inspector
22

33
help:
44
@echo "Available commands:"
@@ -15,6 +15,7 @@ help:
1515
@echo " publish-test Publish to Test PyPI"
1616
@echo " docker Build Docker image"
1717
@echo " docker-test Run tests in Docker"
18+
@echo " inspector Run MCP Inspector"
1819
@echo " bump-patch Bump patch version"
1920
@echo " bump-minor Bump minor version"
2021
@echo " bump-major Bump major version"
@@ -82,4 +83,11 @@ docker-minimal:
8283
docker build -f Dockerfile.minimal -t pluggedin-random-number-generator-mcp-python:minimal .
8384

8485
docker-smithery:
85-
docker build -f Dockerfile.smithery -t pluggedin-random-number-generator-mcp-python:smithery .
86+
docker build -f Dockerfile.smithery -t pluggedin-random-number-generator-mcp-python:smithery .
87+
88+
# MCP Inspector
89+
inspector:
90+
@echo "Starting MCP Inspector for Python server..."
91+
@echo "Server will be available at http://localhost:5173"
92+
@echo "Note: Make sure you have @modelcontextprotocol/inspector installed (npm install -g @modelcontextprotocol/inspector)"
93+
npx @modelcontextprotocol/inspector python3 scripts/run-inspector.py

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,24 @@ docker-compose --profile test up
387387
docker-compose --profile dev up
388388
```
389389

390+
### Using MCP Inspector
391+
392+
The MCP Inspector provides a web interface to interact with and test the server:
393+
394+
```bash
395+
# Install MCP Inspector (if not already installed)
396+
npm install -g @modelcontextprotocol/inspector
397+
398+
# Run inspector with the Python server
399+
make inspector
400+
```
401+
402+
The inspector will start on `http://localhost:5173` where you can:
403+
- View available tools and prompts
404+
- Test tool execution with different parameters
405+
- Inspect request/response payloads
406+
- Debug server behavior
407+
390408
## 🤝 Contributing
391409

392410
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ classifiers = [
1616
"Topic :: Software Development :: Libraries",
1717
]
1818
keywords = ["mcp", "model-context-protocol", "random", "cryptography", "rng", "prng", "csprng", "ai", "llm", "python"]
19+
dependencies = [
20+
"fastmcp>=0.1.0",
21+
]
1922

2023
[project.urls]
2124
"Homepage" = "https://github.com/VeriTeknik/pluggedin-random-number-generator-mcp-python"
2225
"Bug Tracker" = "https://github.com/VeriTeknik/pluggedin-random-number-generator-mcp-python/issues"
2326
"Repository" = "https://github.com/VeriTeknik/pluggedin-random-number-generator-mcp-python"
2427
"Documentation" = "https://github.com/VeriTeknik/pluggedin-random-number-generator-mcp-python#readme"
2528

26-
[project.dependencies]
27-
fastmcp = ">=0.1.0"
28-
2929
[project.scripts]
3030
pluggedin-random-number-generator-mcp-python = "pluggedin_random_number_generator_mcp.server:main"
3131

scripts/run-inspector.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python3
2+
"""Simple wrapper to run the MCP server for the inspector."""
3+
import os
4+
import sys
5+
6+
os.environ["MCP_NO_BANNER"] = "1"
7+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
8+
9+
from pluggedin_random_number_generator_mcp.server import main
10+
main()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Entry point for running the module with python -m"""
2+
from .server import main
3+
4+
if __name__ == "__main__":
5+
main()

0 commit comments

Comments
 (0)