|
1 |
| -# MCP Noko Server |
| 1 | +# Noko MCP Server |
2 | 2 |
|
3 |
| -A Model Context Protocol (MCP) server for integrating Noko time tracking with Claude Desktop. |
| 3 | +A Model Context Protocol (MCP) server for interacting with the [Noko](https://nokotime.com/) time tracking API. |
4 | 4 |
|
5 | 5 | ## Features
|
6 | 6 |
|
7 |
| -- Full Noko API v2 integration |
8 |
| -- Secure authentication handling |
9 |
| -- Time entry management |
10 |
| -- Project and user listing |
11 |
| -- Error handling and validation |
12 |
| -- Async/await support |
| 7 | +This MCP server allows Claude and other AI assistants to: |
| 8 | + |
| 9 | +- List time entries with filtering options |
| 10 | +- Create new time entries |
| 11 | +- List projects |
| 12 | +- List users |
13 | 13 |
|
14 | 14 | ## Installation
|
15 | 15 |
|
16 |
| -1. Ensure you have Python 3.9+ installed |
17 |
| -2. Clone this repository: |
18 | 16 | ```bash
|
| 17 | +# Clone the repository |
19 | 18 | git clone https://github.com/yourusername/mcp-nokotime.git
|
20 | 19 | cd mcp-nokotime
|
21 |
| -``` |
22 |
| - |
23 |
| -3. Install `uv` if you haven't already: |
24 |
| -```bash |
25 |
| -curl -LsSf https://astral.sh/uv/install.sh | sh |
26 |
| -``` |
27 | 20 |
|
28 |
| -4. Create and activate a virtual environment: |
29 |
| -```bash |
30 |
| -uv venv |
31 |
| -source .venv/bin/activate # On Unix/macOS |
32 |
| -# or |
33 |
| -.venv\Scripts\activate # On Windows |
34 |
| -``` |
| 21 | +# Install dependencies |
| 22 | +npm install |
35 | 23 |
|
36 |
| -5. Install the package in development mode: |
37 |
| -```bash |
38 |
| -uv pip install -e . |
| 24 | +# Build the project |
| 25 | +npm run build |
39 | 26 | ```
|
40 | 27 |
|
41 |
| -6. Test the server: |
42 |
| -```bash |
43 |
| -python -m nokotime.server |
44 |
| -``` |
45 |
| - |
46 |
| -### Claude Desktop Setup |
47 |
| - |
48 |
| -1. Open Claude Desktop settings at: |
49 |
| - - MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json` |
50 |
| - - Windows: `%APPDATA%\Claude\claude_desktop_config.json` |
51 |
| - |
52 |
| -2. Add or update the Noko server configuration: |
53 |
| -```json |
54 |
| -{ |
55 |
| - "mcpServers": { |
56 |
| - "noko": { |
57 |
| - "command": "/Users/sirkitree/repos/mcp-nokotime/.venv/bin/python3", |
58 |
| - "args": [ |
59 |
| - "-m", |
60 |
| - "nokotime.server" |
61 |
| - ], |
62 |
| - "env": { |
63 |
| - "NOKO_API_TOKEN": "your_existing_token", |
64 |
| - "PYTHONPATH": "/Users/sirkitree/repos/mcp-nokotime" |
65 |
| - } |
66 |
| - } |
67 |
| - } |
68 |
| -} |
69 |
| -``` |
70 |
| - |
71 |
| -**Important Notes:** |
72 |
| -- The `command` should point to Python in your virtual environment (shown above is an example path) |
73 |
| -- Keep your existing `NOKO_API_TOKEN` value; don't replace it with the example value shown above |
74 |
| -- Make sure you've completed all installation steps before starting Claude Desktop |
75 |
| -- Restart Claude Desktop after making configuration changes |
76 |
| -- If you get connection errors, check Claude Desktop logs at `~/Library/Logs/Claude/mcp*.log` |
77 |
| - |
78 |
| -## Available Tools |
| 28 | +## Configuration |
79 | 29 |
|
80 |
| -### 1. List Time Entries |
81 |
| -Lists time entries with optional filters. |
82 |
| - |
83 |
| -**Example:** |
84 |
| -```json |
85 |
| -{ |
86 |
| - "from": "2023-12-01", |
87 |
| - "to": "2023-12-31", |
88 |
| - "user_ids": [123], |
89 |
| - "project_ids": [456] |
90 |
| -} |
91 |
| -``` |
| 30 | +Create a `.env` file in the root directory with the following content: |
92 | 31 |
|
93 |
| -### 2. Create Time Entry |
94 |
| -Creates a new time entry. |
95 |
| - |
96 |
| -**Example:** |
97 |
| -```json |
98 |
| -{ |
99 |
| - "date": "2023-12-14", |
100 |
| - "minutes": 60, |
101 |
| - "description": "Working on project documentation", |
102 |
| - "project_id": 123 |
103 |
| -} |
104 | 32 | ```
|
105 |
| - |
106 |
| -### 3. List Projects |
107 |
| -Lists all available projects. |
108 |
| - |
109 |
| -**Example:** |
110 |
| -```json |
111 |
| -{ |
112 |
| - "state": "active" // Options: "active", "archived", "all" |
113 |
| -} |
| 33 | +NOKO_API_TOKEN=your_noko_api_token |
114 | 34 | ```
|
115 | 35 |
|
116 |
| -### 4. List Users |
117 |
| -Lists all users. |
118 |
| - |
119 |
| -**Example:** |
120 |
| -```json |
121 |
| -{ |
122 |
| - "state": "active" // Options: "active", "suspended", "all" |
123 |
| -} |
124 |
| -``` |
| 36 | +You can obtain your Noko API token from your Noko account settings. |
125 | 37 |
|
126 |
| -## Development |
| 38 | +## Usage |
127 | 39 |
|
128 |
| -### Running Tests |
| 40 | +### Running the Server |
129 | 41 |
|
130 |
| -Run the test suite with: |
131 | 42 | ```bash
|
132 |
| -pytest |
| 43 | +npm start |
133 | 44 | ```
|
134 | 45 |
|
135 |
| -For test coverage report: |
| 46 | +### Development |
| 47 | + |
136 | 48 | ```bash
|
137 |
| -pytest --cov=nokotime |
| 49 | +npm run dev |
138 | 50 | ```
|
139 | 51 |
|
140 |
| -### Project Structure |
141 |
| - |
142 |
| -- `src/nokotime/server.py`: Main server implementation |
143 |
| -- `src/nokotime/tools.py`: Tool definitions and schemas |
144 |
| -- `tests/`: Test suite |
145 |
| - - `conftest.py`: Test fixtures and configuration |
146 |
| - - `test_server.py`: Server tests |
147 |
| - - `test_tools.py`: Tool schema tests |
148 |
| - |
149 |
| -## Troubleshooting |
150 |
| - |
151 |
| -### Common Issues |
152 |
| - |
153 |
| -1. **Authentication Errors** |
154 |
| - - Ensure your Noko API token is valid |
155 |
| - - Check that the token is correctly set in Claude Desktop configuration |
156 |
| - - Verify the `X-NokoToken` header is being sent with requests |
157 |
| - |
158 |
| -2. **Connection Issues** |
159 |
| - - Check your internet connection |
160 |
| - - Verify the Noko API is accessible |
161 |
| - - Check for any firewall restrictions |
162 |
| - |
163 |
| -3. **Tool Errors** |
164 |
| - - Ensure request parameters match the tool schemas |
165 |
| - - Check date formats are YYYY-MM-DD |
166 |
| - - Verify project and user IDs exist in your Noko account |
| 52 | +## Available Tools |
167 | 53 |
|
168 |
| -4. **Virtual Environment Issues** |
169 |
| - - Make sure the virtual environment is activated when installing packages |
170 |
| - - Verify the path to Python in the Claude Desktop configuration matches your virtual environment |
171 |
| - - On Windows, use backslashes in paths: `.venv\Scripts\python` |
| 54 | +The server provides the following tools to AI assistants: |
172 | 55 |
|
173 |
| -### Debug Mode |
| 56 | +1. `noko_list_entries` - List time entries with optional filters |
| 57 | + - Parameters: `user_ids[]`, `project_ids[]`, `from`, `to`, `invoiced`, `updated_from`, `updated_to`, `per_page`, `page` |
174 | 58 |
|
175 |
| -To enable debug logging, set the environment variable: |
176 |
| -```bash |
177 |
| -export MCP_DEBUG=1 |
178 |
| -``` |
| 59 | +2. `noko_create_entry` - Create a new time entry |
| 60 | + - Required parameters: `date`, `minutes`, `description` |
| 61 | + - Optional parameters: `project_id`, `user_id`, `billable`, `tags`, `invoice_id` |
179 | 62 |
|
180 |
| -## Contributing |
| 63 | +3. `noko_list_projects` - List all available projects |
| 64 | + - Parameters: `name`, `state`, `billing_increment`, `enabled_for_tracking`, `per_page`, `page` |
181 | 65 |
|
182 |
| -1. Fork the repository |
183 |
| -2. Create a feature branch |
184 |
| -3. Make your changes |
185 |
| -4. Add tests for new functionality |
186 |
| -5. Submit a pull request |
| 66 | +4. `noko_list_users` - List all users |
| 67 | + - Parameters: `name`, `email`, `state`, `role`, `per_page`, `page` |
187 | 68 |
|
188 | 69 | ## License
|
189 | 70 |
|
190 |
| -MIT License - see LICENSE file for details |
| 71 | +MIT |
0 commit comments