Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 95 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,78 +8,19 @@ Features
- Automatic JSON Schema & handler generation via Scala 3 macros
- Seamless integration with the Java MCP SDK

---

## Installation (Coming Soon)
## Installation

Add to your **`build.sbt`** (defaulting to **Scala 3.6.4**):

```scala
libraryDependencies += "com.tjclp" %% "fast-mcp-scala" % "0.1.0"
```

---

## Developing Locally

When hacking on *FastMCP‑Scala* itself, you can consume a local build in any project.

### 🔨 Publish to the Local Ivy Repository with `sbt` (Recommended)

```bash
# From the fast-mcp-scala root
sbt publishLocal
```

Then, in your consuming sbt project:
## Quickstart

```scala
libraryDependencies += "com.tjclp" %% "fast-mcp-scala" % "0.1.0-SNAPSHOT"
```

> `publishLocal` installs the artifact under `~/.ivy2/local` (or the Coursier cache when enabled).

---

### 📦 Use the JAR Directly (Unmanaged Dependencies)

```bash
# Package the library
sbt package

# Copy the JAR – adjust Scala version / name if you change them
cp target/scala-3.6.4/fast-mcp-scala_3-0.1.0-SNAPSHOT.jar \
/path/to/other-project/lib/
```

Unmanaged JARs placed in a project’s `lib/` folder are picked up automatically by sbt.

---

### 🚀 Using with **scala‑cli**

You can use `fast-mcp-scala` in another scala‑cli project:
```scala
//> using scala 3.6.4
//> using dep com.tjclp::fast-mcp-scala:0.1.0-SNAPSHOT
//> using options "-Xcheck-macros" "-experimental"
```

You can also point directly at the local JAR:

```scala
//> using scala 3.6.4
//> using lib "/absolute/path/to/fast-mcp-scala_3-0.1.0-SNAPSHOT.jar"
//> using options "-Xcheck-macros" "-experimental"
```

---

## Quickstart (Annotation‑based)

```scala
//> using scala 3.6.4
//> using dep com.tjclp::fast-mcp-scala:0.1.0-SNAPSHOT
//> using dep com.tjclp::fast-mcp-scala:0.1.0
//> using options "-Xcheck-macros" "-experimental"

import com.tjclp.fastmcp.core.{Tool, ToolParam, Prompt, PromptParam, Resource}
Expand Down Expand Up @@ -113,15 +54,103 @@ object ExampleServer extends ZIOAppDefault:
yield ()
```

The above example can be run using `scala-cli scripts/quickstart.scala` from the repo root (make sure to run `sbt publishLocal` first). You can run the server via the MCP inspector by running
### Running Examples

The above example can be run using `scala-cli scripts/quickstart.scala` from the repo root. You can run the server via the MCP inspector by running:

```bash
npx @modelcontextprotocol/inspector scala-cli <path_to_repo>/scripts/quickstart.scala
```

You can also run examples directly from the command line:
```bash
npx @modelcontextprotocol/inspector scala-cli <path_to_repo>/scripts/quickstart.scala
scala-cli \
-e '//> using dep com.tjclp::fast-mcp-scala:0.1.0' \
--main-class com.tjclp.fastmcp.examples.AnnotatedServer
```

### Integration with Claude Desktop

In Claude desktop, you can add the following to your `claude_desktop_config.json`:

```json
{
"mcpServers": {
"example-fast-mcp-server": {
"command": "scala-cli",
"args": [
"-e",
"//> using dep com.tjclp::fast-mcp-scala:0.1.0",
"--main-class",
"com.tjclp.fastmcp.examples.AnnotatedServer"
]
}
}
}
```

> Note: FastMCP-Scala example servers are for demo purposes only and don't do anything useful

For additional examples and in‑depth docs, see **`docs/guide.md`**.

## License

[MIT](LICENSE)

---

## License
## Development Documentation

### Developing Locally

When hacking on *FastMCP‑Scala* itself, you can consume a local build in any project.

#### 🔨 Publish to the Local Ivy Repository with `sbt`

In your cloned repository, set a working version
```scala
ThisBuild / version := "0.1.1-SNAPSHOT"
```

[MIT](LICENSE)
```bash
# From the fast-mcp-scala root
sbt publishLocal
```

Then, in your consuming sbt project:

```scala
libraryDependencies += "com.tjclp" %% "fast-mcp-scala" % "0.1.1-SNAPSHOT"
```

> `publishLocal` installs the artifact under `~/.ivy2/local` (or the Coursier cache when enabled).

#### 📦 Use the JAR Directly (Unmanaged Dependencies)

```bash
# Package the library
sbt package

# Copy the JAR – adjust Scala version / name if you change them
cp target/scala-3.6.4/fast-mcp-scala_3-0.1.1-SNAPSHOT.jar \
/path/to/other-project/lib/
```

Unmanaged JARs placed in a project's `lib/` folder are picked up automatically by sbt.

#### 🚀 Using with `scala‑cli`

You can use `fast-mcp-scala` in another scala‑cli project:
```scala
//> using scala 3.6.4
//> using dep com.tjclp::fast-mcp-scala:0.1.0
//> using options "-Xcheck-macros" "-experimental"
```

You can also point directly at the local JAR:

```scala
//> using scala 3.6.4
//> using lib "/absolute/path/to/fast-mcp-scala_3-0.1.0.jar"
//> using options "-Xcheck-macros" "-experimental"
```
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sonatypeTimeoutMillis := 60000

ThisBuild / sonatypeCredentialHost := sonatypeCentralHost

ThisBuild / version := "0.1.0"
ThisBuild / version := "0.1.1-SNAPSHOT"

ThisBuild / scalaVersion := "3.6.4" // Using Scala 3
ThisBuild / versionScheme := Some("semver-spec")
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "3.6.4"
//> using dep com.tjclp::fast-mcp-scala:0.1.0-SNAPSHOT
//> using dep com.tjclp::fast-mcp-scala:0.1.0
//> using options "-Xcheck-macros" "-experimental" // Enable verbose macro processing

// This is a launcher file for scala-cli
Expand Down
2 changes: 1 addition & 1 deletion scripts/quickstart.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala 3.6.4
//> using dep com.tjclp::fast-mcp-scala:0.1.0-SNAPSHOT
//> using dep com.tjclp::fast-mcp-scala:0.1.0
//> using options "-Xcheck-macros" "-experimental"

import com.tjclp.fastmcp.core.{Tool, ToolParam, Prompt, PromptParam, Resource}
Expand Down