thefaftek-git/mcp_notes_server
If you are the rightful owner of mcp_notes_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Notes Server is a FastAPI-based application designed to accept and store notes in a JSON file, leveraging the Model Context Protocol (MCP) for efficient data handling.
mcp_notes_server/ āāā app/ ā āāā main.py # FastAPI app ā āāā models.py # Pydantic Note model ā āāā storage.py # JSON file storage logic āāā data/ ā āāā notes.json # Notes storage (created at runtime) āāā tests/ ā āāā test_notes.py # Test suite āāā requirements.txt āāā .gitignore āāā README.md
MCP Notes Server
A Model Context Protocol (MCP) server for accepting and storing notes in a JSON file. Built with FastAPI and Python 3.10+.
Technology Stack
- Python 3.10+
- FastAPI (web framework)
- Uvicorn (ASGI server)
- Pydantic (data validation)
- pytest, httpx (testing)
Project Structure
mcp_notes_server/
āāā app/
ā āāā main.py # FastAPI app
ā āāā models.py # Pydantic Note model
ā āāā storage.py # JSON file storage logic
āāā data/
ā āāā notes.json # Notes storage (created at runtime)
āāā tests/
ā āāā test_notes.py # Test suite
āāā requirements.txt
āāā .gitignore
āāā README.md
Setup & Installation
- Clone the repository
git clone <repo-url> cd mcp_notes_server
- Create and activate a virtual environment
python3 -m venv venv source venv/bin/activate
- Install dependencies
pip install -r requirements.txt
Configuration
- Notes Storage:
- By default, notes are stored in
data/notes.json
. - To change the storage location, set the
NOTES_FILE
environment variable:export NOTES_FILE=/path/to/your/notes.json
- By default, notes are stored in
- Directory Structure:
- All required folders are created automatically if missing.
- Port:
- Default server port is 8000. Change with
--port <number>
when running uvicorn.
- Default server port is 8000. Change with
- Environment Variables:
NOTES_FILE
(optional): Path to the notes JSON file.
Running the Server
From the project root (/home/nathan/plan1
):
source mcp_notes_server/venv/bin/activate
PYTHONPATH=$(pwd)/mcp_notes_server uvicorn mcp_notes_server.app.main:app --reload --port 8000
- Access the API at: http://127.0.0.1:8000
- Interactive API docs: http://127.0.0.1:8000/docs
API Usage
POST /notes
- Request Body:
{ "text": "This is a note.", "timestamp": "2025-07-22T12:34:56Z", // optional "user_id": "user123" // optional }
- Response:
201 Created
on success:{ "message": "Note saved successfully." }
400/422
for invalid input500
for server errors
Example curl
curl -X POST http://127.0.0.1:8000/notes \
-H "Content-Type: application/json" \
-d '{"text": "Hello world!", "user_id": "alice"}'
Testing
Run all tests:
source venv/bin/activate
pytest
- Tests cover valid/invalid note submissions and file handling.
Troubleshooting
- ModuleNotFoundError: No module named 'app'
- Make sure to set
PYTHONPATH
as shown above when running the server.
- Make sure to set
- Permission errors:
- Ensure the
data/
directory is writable by the server process.
- Ensure the
- Dependencies missing:
- Run
pip install -r requirements.txt
in your virtual environment.
- Run
- Port conflicts:
- Use
--port <number>
to specify a different port.
- Use
Extending the Project
- Add endpoints for reading/searching notes.
- Implement authentication and authorization.
- Support multiple users or sessions.
- Add data backup and recovery features.
- Integrate with a conversational agent app.
- Use a database for scalability if needed.
License
MIT (or specify your own)