Skip to content

Commit 8832b9a

Browse files
sridharavinashtoby
authored andcommitted
feat: add MongoDB data importer tool and update README
1 parent d25404b commit 8832b9a

File tree

3 files changed

+426
-0
lines changed

3 files changed

+426
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ The MCP Registry service provides a centralized repository for MCP server entrie
3030
│ └── service/ # Business logic
3131
├── pkg/ # Public libraries
3232
├── scripts/ # Utility scripts
33+
├── tools/ # Command line tools
34+
│ └── importer/ # MongoDB data importer tool
3335
└── build/ # Build artifacts
3436
```
3537

@@ -109,6 +111,19 @@ The fake service is useful for:
109111
- Testing API integrations
110112
- Example data structure reference
111113

114+
## Tools
115+
116+
### Data Importer
117+
118+
A command-line tool for importing server data from a JSON file into a MongoDB database:
119+
120+
```bash
121+
cd tools/importer
122+
go run main.go -uri mongodb://localhost:27017 -db mcp_registry -collection servers -seed ../../data/seed.json
123+
```
124+
125+
For more details on the importer tool, see the [importer README](./tools/importer/README.md).
126+
112127
## API Documentation
113128

114129
The API is documented using Swagger/OpenAPI. You can access the interactive Swagger UI at:

tools/importer/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# MCP Registry Importer Tool
2+
3+
This command-line tool imports server data from a JSON file into a MongoDB database for the Model Context Protocol Registry.
4+
5+
## Usage
6+
7+
```bash
8+
go run main.go [options]
9+
```
10+
11+
### Options
12+
13+
- `-uri string`: MongoDB connection URI (default "mongodb://localhost:27017")
14+
- `-db string`: MongoDB database name (default "mcp_registry")
15+
- `-collection string`: MongoDB collection name (default "servers")
16+
- `-seed string`: Path to seed.json file (default: looks for data/seed.json relative to current directory)
17+
- `-drop`: Drop collection before importing (default false)
18+
19+
### Examples
20+
21+
Import data using default settings:
22+
```bash
23+
go run main.go
24+
```
25+
26+
Import data into a specific MongoDB instance:
27+
```bash
28+
go run main.go -uri mongodb://username:[email protected]:27017 -db registry
29+
```
30+
31+
Import data from a specific seed file and replace all existing data:
32+
```bash
33+
go run main.go -seed /path/to/custom-seed.json -drop
34+
```
35+
36+
## Building
37+
38+
To build the tool as an executable:
39+
40+
```bash
41+
go build -o registry-importer
42+
```
43+
44+
Then you can run it directly:
45+
46+
```bash
47+
./registry-importer [options]
48+
```

0 commit comments

Comments
 (0)