@docsagent/docsagent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -0
- package/bin/docsagent-aarch64-apple-darwin +0 -0
- package/bin/docsagent-universal-apple-darwin +0 -0
- package/bin/docsagent-x86_64-apple-darwin +0 -0
- package/bin/docsagent-x86_64-pc-windows-msvc.exe +0 -0
- package/bin/libawadb.dll +0 -0
- package/bin/libawadb.dylib +0 -0
- package/bin/libcrypto-3-x64.dll +0 -0
- package/bin/libomp.dylib +0 -0
- package/bin/libpdfium.dylib +0 -0
- package/bin/libssl-3-x64.dll +0 -0
- package/bin/libwinpthread-1.dll +0 -0
- package/bin/pdfium.dll +0 -0
- package/dist/chunk-D7PCT4W2.mjs +4 -0
- package/dist/cli.mjs +21 -0
- package/dist/index.mjs +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# DocsAgent 🛡️
|
|
2
|
+
|
|
3
|
+
**The High-Performance Local Intelligence Layer for AI Agents.**
|
|
4
|
+
|
|
5
|
+
DocsAgent is a professional, local-first document intelligence engine and MCP (Model Context Protocol) server. It provides a secure, near-instant bridge between your private local files and advanced agentic platforms like **OpenClaw**, **Claude Code**, and **Cursor**.
|
|
6
|
+
|
|
7
|
+
**100% Local. 100% Private. Zero Data Leakage.**
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](#)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### 🔥 Why DocsAgent?
|
|
15
|
+
|
|
16
|
+
Modern AI Agents are incredibly smart, but they are "blind" to your private desktop documents. DocsAgent acts as a **High-Performance Intelligence Engine** that indexes your local data, allowing agents to search, read, and analyze thousands of files (1,000+) with absolute privacy.
|
|
17
|
+
|
|
18
|
+
* **🔒 Absolute Privacy:** All document parsing, indexing, and vector storage happen strictly on your own hardware. Your data never leaves your machine.
|
|
19
|
+
* **⚡ High-Performance Core:** Powered by a native C++ engine. Experience millisecond-level retrieval even across massive document libraries.
|
|
20
|
+
* **🔌 MCP Native:** Built-in support for the **Model Context Protocol (MCP)**, making it instantly compatible with the latest AI tools.
|
|
21
|
+
* **📂 Format Mastery:** Native parsing for PDF, Word (.docx), Excel (.xlsx), PPTX, Markdown, and TXT.
|
|
22
|
+
* **🤖 Local LLM Ready:** Works seamlessly with Claude 3.5/GPT-4o or run completely air-gapped with local models via Ollama.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### 🚀 Quick Start
|
|
27
|
+
|
|
28
|
+
#### 1. Install via NPM
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @docsagent/docsagent
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### 2. CLI Usage (Local Indexing & Search)
|
|
34
|
+
DocsAgent provides a powerful CLI for managing your local knowledge base.
|
|
35
|
+
|
|
36
|
+
* **Index your folders:**
|
|
37
|
+
```bash
|
|
38
|
+
# Add one or more directories or files to the index
|
|
39
|
+
docsagent add ~/Documents/Legal_Archive ~/Documents/Research
|
|
40
|
+
```
|
|
41
|
+
* **Search your documents:**
|
|
42
|
+
```bash
|
|
43
|
+
# Perform a semantic search directly from the terminal
|
|
44
|
+
docsagent search "What are the key terms in the Barclays contract?"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### 3. MCP Usage (Connect to AI Agents)
|
|
48
|
+
DocsAgent is a native **Model Context Protocol (MCP)** server. This allows AI agents to "see" your local documents.
|
|
49
|
+
|
|
50
|
+
**Start the MCP server:**
|
|
51
|
+
```bash
|
|
52
|
+
docsagent server
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### 🔌 Agent Integration Examples
|
|
58
|
+
|
|
59
|
+
Connect DocsAgent to your favorite tools using the following configurations:
|
|
60
|
+
|
|
61
|
+
#### **OpenClaw (Recommended)**
|
|
62
|
+
OpenClaw is the most powerful UI for local-first agents. Add DocsAgent in your `config.yaml`:
|
|
63
|
+
```yaml
|
|
64
|
+
mcpServers:
|
|
65
|
+
docsagent:
|
|
66
|
+
command: "docsagent"
|
|
67
|
+
args: ["server"]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### **Claude Code**
|
|
71
|
+
Integrate with Anthropic's CLI tool:
|
|
72
|
+
```bash
|
|
73
|
+
claude code mcp add docsagent -- docsagent server
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### **Cursor / Windsurf**
|
|
77
|
+
1. Open **Settings** > **Features** > **MCP Servers**.
|
|
78
|
+
2. Click **+ Add New MCP Server**.
|
|
79
|
+
3. Name: `DocsAgent`
|
|
80
|
+
4. Type: `command`
|
|
81
|
+
5. Command: `docsagent server`
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### 🛠️ Agent Tools (via MCP)
|
|
86
|
+
|
|
87
|
+
Once integrated, your AI agent gains professional-grade document capabilities through these tools:
|
|
88
|
+
|
|
89
|
+
- **`search`**: Perform deep semantic search across your entire local library to find relevant snippets.
|
|
90
|
+
- **`add_docs`**: Instantly index new local folders or files during a conversation.
|
|
91
|
+
- *(More tools coming soon: `list_documents`, `remove_document`, `status`)*
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 💻 CLI Reference
|
|
96
|
+
|
|
97
|
+
DocsAgent provides a powerful CLI with convenient aliases (`dag`, `da`):
|
|
98
|
+
|
|
99
|
+
| Command | Alias Example | Description |
|
|
100
|
+
| :--- | :--- | :--- |
|
|
101
|
+
| `server` | `da server` | Start the MCP server service |
|
|
102
|
+
| `add` | `dag add <path>` | Add directories or files to the index |
|
|
103
|
+
| `search` | `da search "query"`| Search for documents directly from CLI |
|
|
104
|
+
| `status`| `dag status` | Check engine and indexing status |
|
|
105
|
+
| `stop` | `da stop` | Stop the background engine service |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### 📂 Support Matrix
|
|
110
|
+
|
|
111
|
+
| Format | Status | Features |
|
|
112
|
+
| :--- | :--- | :--- |
|
|
113
|
+
| **PDF** | ✅ Full | Deep layout analysis & high-speed parsing |
|
|
114
|
+
| **Word (.docx)** | ✅ Full | Table extraction & heading hierarchy preserved |
|
|
115
|
+
| **PPTX** | ✅ Full | Extracts slides, shapes, and speaker notes |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### 🤝 Community & Contributing
|
|
120
|
+
|
|
121
|
+
We are building the open standard for Local RAG. Join us in making AI respect personal data sovereignty!
|
|
122
|
+
|
|
123
|
+
- **GitHub Issues:** Found a bug? Have a feature request? Open an issue.
|
|
124
|
+
- **Star the Repo:** If DocsAgent improved your workflow, please give us a ⭐ to help others find the project!
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### ⚖️ License
|
|
129
|
+
|
|
130
|
+
DocsAgent is open-source under the **Apache-2.0 License**.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
**Desktop Sovereignty is here. Empower your Agents with DocsAgent.**
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/libawadb.dll
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/libomp.dylib
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/pdfium.dll
ADDED
|
Binary file
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{spawn as g}from"child_process";import n from"path";import{fileURLToPath as m}from"url";var d=m(import.meta.url),y=n.dirname(d),c=()=>{let a=process.platform,e=process.arch,t="";return a==="darwin"?e==="arm64"?t="docsagent-aarch64-apple-darwin":e==="x64"?t="docsagent-x86_64-apple-darwin":t="docsagent-universal-apple-darwin":a==="win32"?t="docsagent-x86_64-pc-windows-msvc.exe":a==="linux"&&(t="docsagent-universal-apple-darwin"),n.join(y,"../bin",t)};import{McpServer as f}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as w}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as l}from"zod";var P=18688,h=class{process=null;binaryPath;port;baseUrl;initialPath;readyPromise;constructor(e,t=P){this.binaryPath=c(),this.initialPath=e,this.port=t,this.baseUrl=`http://localhost:${this.port}`,this.readyPromise=this.startEngine()}async startEngine(){try{let t=new AbortController,s=setTimeout(()=>t.abort(),200),i=await fetch(`${this.baseUrl}/status`,{signal:t.signal});if(clearTimeout(s),i.ok)return}catch{}let e=["--port",this.port.toString()];if(this.initialPath){let t=Array.isArray(this.initialPath)?this.initialPath.join(" "):this.initialPath;e.push("--source",t)}return new Promise((t,s)=>{this.process=g(this.binaryPath,e,{stdio:"ignore",detached:!0}),this.process.unref(),this.process.on("error",r=>{this.process=null,s(r)}),this.process.on("exit",r=>{r!==0&&this.process&&console.error(`DocsAgent engine exited with code ${r}`),this.process=null});let i=0,o=async()=>{try{let r=new AbortController,p=setTimeout(()=>r.abort(),100),u=await fetch(`${this.baseUrl}/status`,{signal:r.signal});if(clearTimeout(p),u.ok)t();else throw new Error}catch{i++,i>50?s(new Error(`Timeout waiting for DocsAgent service to start on port ${this.port}`)):setTimeout(o,100)}};setTimeout(o,50)})}async request(e,t,s){await this.readyPromise;let i=`${this.baseUrl}${e}`;try{let o=await fetch(i,{method:t,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(o){throw new Error(`Failed to communicate with DocsAgent service: ${o.message}`)}}async add(e){let t=Array.isArray(e)?e:[e];await this.request("/add","POST",{source:t})}async search(e){let t=await this.request("/search","POST",{query:e});return t&&t.code===200&&Array.isArray(t.result_items)?t.result_items:[]}async status(){return await this.request("/status","GET")}async list(){let e=await this.request("/list","GET");return Array.isArray(e)?e:[]}async remove(e){await this.request("/remove","POST",{path:e})}async close(){try{await this.request("/close","POST")}catch{this.process&&(this.process.kill(),this.process=null)}}async startMcpServer(){await this.readyPromise;let e=new f({name:"DocsAgent",version:"1.0.0"});e.tool("search",{query:l.string().describe("The search query for local documents")},async({query:s})=>{try{let i=await this.search(s);return i.length===0?{content:[{type:"text",text:"No results found."}]}:{content:[{type:"text",text:i.map(r=>`[Score: ${r.score.toFixed(2)}]${r.path?` ${r.path}`:""}${r.page?` (P${r.page})`:""}
|
|
2
|
+
Context: ${r.context}`).join(`
|
|
3
|
+
|
|
4
|
+
`)}]}}catch(i){return{content:[{type:"text",text:i.message}],isError:!0}}}),e.tool("add_docs",{dir:l.string().describe("The directory or file path to add")},async({dir:s})=>{try{return await this.add(s),{content:[{type:"text",text:`Added ${s}`}]}}catch(i){return{content:[{type:"text",text:i.message}],isError:!0}}});let t=new w;await e.connect(t)}};export{h as a};
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as f}from"./chunk-D7PCT4W2.mjs";import l from"path";var a=process.argv.slice(2),n=18688,r=a.findIndex(o=>o==="--port"||o==="-p");r!==-1&&a[r+1]&&(n=parseInt(a[r+1]),a.splice(r,2));var m=a[0],t=a.slice(1),x=async()=>{let o;m==="server"&&(o=(t.length>0?t:["."]).map(c=>l.resolve(c)));let s=new f(o,n);switch(m){case"server":let i=o?o.join(", "):".";console.log(`Starting DocsAgent MCP Server on port ${n} (indexing: ${i})...`),await s.startMcpServer();break;case"add":t.length===0&&(console.error("Please specify at least one directory or file to add."),process.exit(1));let c=t.map(e=>l.resolve(e));await s.add(c),console.log(`Added ${c.join(", ")} to DocsAgent.`);break;case"search":let d=t.join(" ");d||(console.error("Please specify a search query."),process.exit(1));let p=await s.search(d);p.length===0?console.log("No results found."):p.forEach((e,v)=>{console.log(`${v+1}. [Score: ${e.score.toFixed(2)}]${e.path?` ${e.path}`:""}${e.page?` (Page ${e.page})`:""}`),console.log(` Context: ${e.context}`),console.log("---")});break;case"status":let u=await s.status();console.log(JSON.stringify(u,null,2));break;case"list":let g=await s.list();g.length===0?console.log("No documents indexed."):g.forEach(e=>console.log(`- ${e}`));break;case"remove":t[0]||(console.error("Please specify a path to remove."),process.exit(1));let h=l.resolve(t[0]);await s.remove(h),console.log(`Removed ${h} from DocsAgent.`);break;case"stop":case"close":console.log(`Stopping DocsAgent service on port ${n}...`),await s.close(),console.log("Service stopped.");break;default:console.log(`
|
|
3
|
+
DocsAgent CLI (Aliases: dag, da)
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
docsagent server [paths...] [--port <n>] Start persistent service (MCP)
|
|
7
|
+
docsagent search <q> [paths...] [--port <n>] Search for documents
|
|
8
|
+
docsagent add <paths...> [--port <n>] Add directories or files to DocsAgent
|
|
9
|
+
docsagent status [--port <n>] Check engine status
|
|
10
|
+
docsagent list [--port <n>] List all indexed documents
|
|
11
|
+
docsagent remove <path> [--port <n>] Remove a document/folder from index
|
|
12
|
+
docsagent stop [--port <n>] Stop the background service
|
|
13
|
+
|
|
14
|
+
Examples:
|
|
15
|
+
docsagent search "Barclays case" (Formal)
|
|
16
|
+
dag search "Barclays case" (Geeky)
|
|
17
|
+
da status (Short)
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
-p, --port <n> Port for the local service (default: 18688)
|
|
21
|
+
`);break}};x().catch(o=>{console.error("Error:",o.message),process.exit(1)});process.on("SIGINT",()=>{process.exit(0)});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-D7PCT4W2.mjs";export{a as DocsAgent};
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@docsagent/docsagent",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Private Local Documents Search Assistant",
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
|
+
"bin": {
|
|
7
|
+
"docsagent": "./dist/cli.mjs",
|
|
8
|
+
"dag": "./dist/cli.mjs",
|
|
9
|
+
"da": "./dist/cli.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"bin"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsup src/index.ts src/cli.ts --format esm --tsconfig tsconfig.json --clean --minify",
|
|
17
|
+
"dev": "tsup src/index.ts --format esm --watch",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.0.1",
|
|
22
|
+
"tsup": "^8.0.0",
|
|
23
|
+
"typescript": "^5.0.0",
|
|
24
|
+
"zod": "^3.22.4"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"private",
|
|
28
|
+
"personal",
|
|
29
|
+
"local",
|
|
30
|
+
"documents",
|
|
31
|
+
"search"
|
|
32
|
+
],
|
|
33
|
+
"author": "Vincent",
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/docsagent/docsagent",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/docsagent/docsagent.git"
|
|
42
|
+
}
|
|
43
|
+
}
|