# MCP server

A Model Context Protocol server with tools to save and list notes. Your AI assistant gets a memory that runs on your phone all day.

## Get it

```sh
$ npx dukoi init mcp-server
```

It makes a `mcp-server` folder and deploys it. On the phone instead: **Try a template → MCP server → Deploy**.

## What you get

MCP over HTTP at `/mcp`. Open the URL and it tells you its tools and how to connect. Notes are kept in `DATA_DIR`.

192.168.0.112:3002

```
{
  "name": "mcp-server",
  "mcp": "http://192.168.0.112:3002/mcp",
  "tools": ["save_note", "list_notes"],
  "connect": "claude mcp add --transport http dukoi http://192.168.0.112:3002/mcp"
}
```

Connect Claude Code to it:

```sh
$ claude mcp add --transport http dukoi http://192.168.0.112:3002/mcp
```

For an assistant outside your Wi-Fi, give the app a [public URL](/docs/public-urls.md) and use that, plus `/mcp`.

## Make it yours

Four files. You only need to touch one.

- `tools.js`: The tools. Edit this one.
- `server.js`: MCP over HTTP. No need to touch it.
- `package.json`: Its name and packages
- `README.md`: How to run it, in five minutes

Add a tool to the list in `tools.js`:

```
{
  name: 'roll_dice',
  description: 'Roll a dice with the given number of sides',
  inputSchema: { type: 'object', properties: { sides: { type: 'number' } } },
  run: ({ sides = 6 }) => `You rolled ${1 + Math.floor(Math.random() * sides)}`,
},
```

Then deploy again. Your assistant sees the new tool the next time it connects.

```sh
$ npx dukoi deploy
```
