Skip to content

Commit 521813b

Browse files
committed
Add TypeScript conversion plan for Noko MCP Server
rel #1 - Created a comprehensive plan for converting the Noko MCP Server from Python to TypeScript. - Outlined project setup, including TypeScript configuration, directory structure, and environment variable management. - Defined tasks for implementing core server functionality, tools module, API integration, authentication, testing framework, and documentation. - Included notes on best practices for TypeScript development and project distribution.
1 parent 1d7d3a8 commit 521813b

30 files changed

+7032
-5682
lines changed

.env.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Noko API token
2-
NOKO_TOKEN=your_noko_api_token_here
1+
# Noko API token from https://nokotime.com/api/
2+
NOKO_API_TOKEN=your_token_here

.eslintrc.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"prettier"
6+
],
7+
"parser": "@typescript-eslint/parser",
8+
"plugins": ["@typescript-eslint"],
9+
"root": true,
10+
"env": {
11+
"node": true,
12+
"es2022": true
13+
},
14+
"rules": {
15+
"@typescript-eslint/no-explicit-any": "off",
16+
"@typescript-eslint/explicit-module-boundary-types": "off"
17+
}
18+
}

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,21 @@ wheels/
88

99
# Virtual environments
1010
.venv
11+
12+
# Node.js dependencies
13+
node_modules/
14+
15+
# TypeScript build output
16+
dist/
17+
*.tsbuildinfo
18+
19+
# Environment variables
20+
.env
21+
22+
# IDE files
23+
.vscode/
24+
.idea/
25+
26+
# Logs
27+
*.log
28+
npm-debug.log*

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2
7+
}

.python-version

-1
This file was deleted.

README.md

+35-154
Original file line numberDiff line numberDiff line change
@@ -1,190 +1,71 @@
1-
# MCP Noko Server
1+
# Noko MCP Server
22

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.
44

55
## Features
66

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
1313

1414
## Installation
1515

16-
1. Ensure you have Python 3.9+ installed
17-
2. Clone this repository:
1816
```bash
17+
# Clone the repository
1918
git clone https://github.com/yourusername/mcp-nokotime.git
2019
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-
```
2720

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
3523

36-
5. Install the package in development mode:
37-
```bash
38-
uv pip install -e .
24+
# Build the project
25+
npm run build
3926
```
4027

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
7929

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:
9231

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-
}
10432
```
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
11434
```
11535

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.
12537

126-
## Development
38+
## Usage
12739

128-
### Running Tests
40+
### Running the Server
12941

130-
Run the test suite with:
13142
```bash
132-
pytest
43+
npm start
13344
```
13445

135-
For test coverage report:
46+
### Development
47+
13648
```bash
137-
pytest --cov=nokotime
49+
npm run dev
13850
```
13951

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
16753

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:
17255

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`
17458

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`
17962

180-
## Contributing
63+
3. `noko_list_projects` - List all available projects
64+
- Parameters: `name`, `state`, `billing_increment`, `enabled_for_tracking`, `per_page`, `page`
18165

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`
18768

18869
## License
18970

190-
MIT License - see LICENSE file for details
71+
MIT

claude-desktop.json

-12
This file was deleted.

jest.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
roots: ['<rootDir>/tests'],
5+
transform: {
6+
'^.+\\.tsx?$': 'ts-jest',
7+
},
8+
testRegex: '(/tests/.*\\.(test|spec))\\.(ts|tsx)$',
9+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
10+
collectCoverage: true,
11+
coverageReporters: ['text', 'lcov'],
12+
coverageDirectory: 'coverage',
13+
};

0 commit comments

Comments
 (0)