README Update

This commit is contained in:
Markus Pfundstein
2024-11-29 13:36:59 +01:00
parent 35dc274660
commit 213980c2bf

View File

@@ -1,18 +1,35 @@
# mcp-knowledge-base MCP server # mcp-knowledge-base MCP server
Example MCP server to call command line apps Example MCP server to interact with Obsidian vaults.
## Components ## Components
### Tools ### Tools
The server implements one tool: The server implements two tools:
- run_command: Runs a command line comment - list_files_in_vault: Lists all files and directories in the root directory of your Obsidian vault
- Takes "cmd" and "args" as string arguments - Takes no arguments
- Runs the command and returns stdout, stderr, status_code, etc. - Returns a JSON list of files and directories
- list_files_in_dir: Lists all files and directories in a specific Obsidian directory
- Takes "dirpath" as a string argument
- Returns a JSON list of files and directories in the specified path
### Example prompts
- List all files in my vault
- List all files in the XYZ directory
## Configuration ## Configuration
### Environment Variables
Create a `.env` file in the root directory with the following required variable:
```
OBSIDIAN_API_KEY=your_api_key_here
```
Without this API key, the server will not be able to function.
## Quickstart ## Quickstart
@@ -25,24 +42,29 @@ On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
<details> <details>
<summary>Development/Unpublished Servers Configuration</summary> <summary>Development/Unpublished Servers Configuration</summary>
```
```json
{
"mcpServers": { "mcpServers": {
"mcp-knowledge-base": { "mcp-knowledge-base": {
"command": "uv", "command": "uv",
"args": [ "args": [
"--directory", "--directory",
"/Users/$(whoami)/experiments/claude-mvp/mcp-knowledge-base", "<dir_to>/mcp-knowledge-base",
"run", "run",
"mcp-knowledge-base" "mcp-knowledge-base"
] ]
} }
} }
``` }
```
</details> </details>
<details> <details>
<summary>Published Servers Configuration</summary> <summary>Published Servers Configuration</summary>
```
```json
{
"mcpServers": { "mcpServers": {
"mcp-knowledge-base": { "mcp-knowledge-base": {
"command": "uvx", "command": "uvx",
@@ -51,7 +73,8 @@ On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
] ]
} }
} }
``` }
```
</details> </details>
## Development ## Development
@@ -86,12 +109,16 @@ Note: You'll need to set PyPI credentials via environment variables or command f
Since MCP servers run over stdio, debugging can be challenging. For the best debugging Since MCP servers run over stdio, debugging can be challenging. For the best debugging
experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector). experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).
You can launch the MCP Inspector via [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command: You can launch the MCP Inspector via [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command:
```bash ```bash
npx @modelcontextprotocol/inspector uv --directory /Users/markus/experiments/claude-mvp/mcp-knowledge-base run mcp-knowledge-base npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-knowledge-base run mcp-knowledge-base
``` ```
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging. Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
You can also watch the server logs with this command:
```bash
tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-knowledge-base.log
```